1 //****************************************************************************** 2 // 3 // File: BackendInfo.java 4 // Package: edu.rit.pj.cluster 5 // Unit: Class edu.rit.pj.cluster.BackendInfo 6 // 7 // This Java source file is copyright (C) 2012 by Alan Kaminsky. All rights 8 // reserved. For further information, contact the author, Alan Kaminsky, at 9 // ark@cs.rit.edu. 10 // 11 // This Java source file is part of the Parallel Java Library ("PJ"). PJ is free 12 // software; you can redistribute it and/or modify it under the terms of the GNU 13 // General Public License as published by the Free Software Foundation; either 14 // version 3 of the License, or (at your option) any later version. 15 // 16 // PJ is distributed in the hope that it will be useful, but WITHOUT ANY 17 // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 18 // A PARTICULAR PURPOSE. See the GNU General Public License for more details. 19 // 20 // Linking this library statically or dynamically with other modules is making a 21 // combined work based on this library. Thus, the terms and conditions of the GNU 22 // General Public License cover the whole combination. 23 // 24 // As a special exception, the copyright holders of this library give you 25 // permission to link this library with independent modules to produce an 26 // executable, regardless of the license terms of these independent modules, and 27 // to copy and distribute the resulting executable under terms of your choice, 28 // provided that you also meet, for each linked independent module, the terms 29 // and conditions of the license of that module. An independent module is a module 30 // which is not derived from or based on this library. If you modify this library, 31 // you may extend this exception to your version of the library, but you are not 32 // obligated to do so. If you do not wish to do so, delete this exception 33 // statement from your version. 34 // 35 // A copy of the GNU General Public License is provided in the file gpl.txt. You 36 // may also obtain a copy of the GNU General Public License on the World Wide 37 // Web at http://www.gnu.org/licenses/gpl.html. 38 // 39 //****************************************************************************** 40 package edu.rit.pj.cluster; 41 42 /** 43 * Class BackendInfo provides a record of information about one backend node in 44 * the PJ cluster middleware. 45 * 46 * @author Alan Kaminsky 47 * @version 20-Jun-2012 48 */ 49 public class BackendInfo { 50 51 // Exported enumerations. 52 /** 53 * The state of a backend node. 54 */ 55 public static enum State { 56 57 /** 58 * The backend is available for jobs. 59 */ 60 IDLE("Idle"), 61 /** 62 * The backend is reserved for a job that has not yet started running. 63 */ 64 RESERVED("Reserved"), 65 /** 66 * The backend is running a job. 67 */ 68 RUNNING("Running"), 69 /** 70 * The backend has failed. 71 */ 72 FAILED("Failed"); 73 74 private final String stringForm; 75 76 /** 77 * Construct a new State value. 78 * 79 * @param stringForm String form. 80 */ 81 State(String stringForm) { 82 this.stringForm = stringForm; 83 } 84 85 /** 86 * Returns a string version of this State value. 87 * 88 * @return String version. 89 */ 90 public String toString() { 91 return stringForm; 92 } 93 } 94 95 // Exported data members. 96 /** 97 * The backend's name. 98 */ 99 public String name; 100 101 /** 102 * The total number of CPUs in the backend. 103 */ 104 public int totalCpus; 105 106 /** 107 * The backend's state. 108 */ 109 public State state; 110 111 /** 112 * The time when the backend entered its current state (milliseconds since 113 * midnight 01-Jan-1970 GMT). 114 */ 115 public long stateTime; 116 117 /** 118 * The host name for SSH remote logins to the backend. 119 */ 120 public String host; 121 122 /** 123 * The full pathname for executing the Java Virtual Machine (JVM) on the 124 * backend. 125 */ 126 public String jvm; 127 128 /** 129 * The Java class path for the Parallel Java Library on the backend. 130 */ 131 public String classpath; 132 133 /** 134 * Array of command line flags for the JVM (zero or more). 135 */ 136 public String[] jvmflags; 137 138 /** 139 * Shell command string on the backend. 140 */ 141 public String shellCommand; 142 143 /** 144 * The job that has reserved or is running on the backend. 145 */ 146 public JobInfo job; 147 148 // Exported constructors. 149 /** 150 * Construct a new backend information record. 151 * 152 * @param name The backend's name. 153 * @param totalCpus The total number of CPUs in the backend. 154 * @param state The backend's state. 155 * @param stateTime The time when the backend entered its current state. 156 * @param host The host name for SSH remote logins to the backend. 157 * @param jvm The full pathname for executing the Java Virtual Machine (JVM) 158 * on the backend. 159 * @param jvmflags Array of command line flags for the JVM (zero or more). 160 * @param classpath The Java class path for the Parallel Java Library on the 161 * backend. 162 * @param shellCommand Shell command string. 163 */ 164 public BackendInfo(String name, 165 int totalCpus, 166 State state, 167 long stateTime, 168 String host, 169 String jvm, 170 String classpath, 171 String[] jvmflags, 172 String shellCommand) { 173 this.name = name; 174 this.totalCpus = totalCpus; 175 this.state = state; 176 this.stateTime = stateTime; 177 this.host = host; 178 this.jvm = jvm; 179 this.classpath = classpath; 180 this.jvmflags = jvmflags; 181 this.shellCommand = shellCommand; 182 } 183 184 }