1 //******************************************************************************
2 //
3 // File: JobInfo.java
4 // Package: edu.rit.pj.cluster
5 // Unit: Class edu.rit.pj.cluster.JobInfo
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 import edu.rit.util.Timer;
43
44 /**
45 * Class JobInfo provides a record of information about one job in a parallel
46 * computer in the PJ cluster middleware.
47 *
48 * @author Alan Kaminsky
49 * @version 24-Jan-2012
50 */
51 public class JobInfo {
52
53 // Exported enumerations.
54 /**
55 * The state of a job.
56 */
57 public static enum State {
58
59 /**
60 * The job is waiting to run.
61 */
62 WAITING("Waiting"),
63 /**
64 * The job is running.
65 */
66 RUNNING("Running");
67
68 private final String stringForm;
69
70 /**
71 * Construct a new State value.
72 *
73 * @param stringForm String form.
74 */
75 State(String stringForm) {
76 this.stringForm = stringForm;
77 }
78
79 /**
80 * Returns a string version of this State value.
81 *
82 * @return String version.
83 */
84 public String toString() {
85 return stringForm;
86 }
87 }
88
89 // Exported data members.
90 /**
91 * The job number.
92 */
93 public int jobnum;
94
95 /**
96 * The job's state.
97 */
98 public State state;
99
100 /**
101 * The time when the job entered its current state (milliseconds since
102 * midnight 01-Jan-1970 GMT).
103 */
104 public long stateTime;
105
106 /**
107 * The job's user name.
108 */
109 public String username;
110
111 /**
112 * The number of backend nodes in the job.
113 */
114 public int Nn;
115
116 /**
117 * The number of processes in the job.
118 */
119 public int Np;
120
121 /**
122 * The number of CPUs per process in the job.
123 */
124 public int Nt;
125
126 /**
127 * The number of processes that have been assigned to the job so far.
128 */
129 public int count;
130
131 /**
132 * Array of backend nodes for each process assigned to the job in rank
133 * order. The array has <code>Np</code> total elements. The first <code>count</code>
134 * elements have been assigned.
135 */
136 public BackendInfo[] backend;
137
138 /**
139 * Number of CPUs assigned to each process in the job in rank order. The
140 * array has <code>Np</code> total elements. The first <code>count</code> elements
141 * have been assigned.
142 */
143 public int[] cpus;
144
145 /**
146 * The number of nodes that have been assigned to the job so far.
147 */
148 public int nodeCount;
149
150 /**
151 * Reference to the job frontend process.
152 */
153 public JobFrontendRef frontend;
154
155 /**
156 * Lease renewal timer.
157 */
158 public Timer renewTimer;
159
160 /**
161 * Lease expiration timer.
162 */
163 public Timer expireTimer;
164
165 /**
166 * Maximum job time timer.
167 */
168 public Timer jobTimer;
169
170 /**
171 * Comment for each process in the job in rank order. The array has
172 * <code>Np</code> total elements. Initially, these are empty strings. The
173 * process comments appear in the detailed job status display in the Job
174 * Scheduler web interface.
175 */
176 public String[] comment;
177
178 // Exported constructors.
179 /**
180 * Construct a new job information record.
181 *
182 * @param jobnum The job number.
183 * @param state The job's state.
184 * @param stateTime The time when the job entered its current state.
185 * @param username The job's user name.
186 * @param Nn The number of backend nodes in the job.
187 * @param Np The number of processes in the job.
188 * @param Nt The number of CPUs per process in the job.
189 * @param count The number of processes that have been assigned to the job
190 * so far.
191 * @param backend Array of backends assigned to the job in rank order.
192 * @param cpus Array of CPUs for each process in rank order.
193 * @param nodeCount The number of nodes that have been assigned to the job
194 * so far.
195 * @param frontend Reference to the job frontend process.
196 * @param renewTimer Lease renewal timer.
197 * @param expireTimer Lease expiration timer.
198 * @param jobTimer Maximum job time timer.
199 */
200 public JobInfo(int jobnum,
201 State state,
202 long stateTime,
203 String username,
204 int Nn,
205 int Np,
206 int Nt,
207 int count,
208 BackendInfo[] backend,
209 int[] cpus,
210 int nodeCount,
211 JobFrontendRef frontend,
212 Timer renewTimer,
213 Timer expireTimer,
214 Timer jobTimer) {
215 this.jobnum = jobnum;
216 this.state = state;
217 this.stateTime = stateTime;
218 this.username = username;
219 this.Nn = Nn;
220 this.Np = Np;
221 this.Nt = Nt;
222 this.count = count;
223 this.backend = backend;
224 this.cpus = cpus;
225 this.nodeCount = nodeCount;
226 this.frontend = frontend;
227 this.renewTimer = renewTimer;
228 this.expireTimer = expireTimer;
229 this.jobTimer = jobTimer;
230 }
231
232 }