001: /*
002: * This file or a portion of this file is licensed under the terms of
003: * the Globus Toolkit Public License, found in file GTPL, or at
004: * http://www.globus.org/toolkit/download/license.html. This notice must
005: * appear in redistributions of this file, with or without modification.
006: *
007: * Redistributions of this Software, with or without modification, must
008: * reproduce the GTPL in: (1) the Software, or (2) the Documentation or
009: * some other similar material which is provided with the Software (if
010: * any).
011: *
012: * Copyright 1999-2004 University of Chicago and The University of
013: * Southern California. All rights reserved.
014: */
015: package org.griphyn.vdl.diagnozer;
016:
017: import java.util.*;
018: import java.io.*;
019:
020: /**
021: * Description of a job.
022: */
023: class JobInfo {
024: /**
025: * ID of the job.
026: */
027: private String m_id;
028:
029: /**
030: * Job has finished (successfully?)
031: */
032: private boolean m_done;
033:
034: /**
035: * Messages from error files
036: */
037: private ArrayList m_errorFileMessage;
038:
039: /**
040: * lists of prescript exit code, with retries
041: */
042: private String m_prescriptExitCode;
043:
044: /**
045: * lists of postscript exit code, with retries
046: */
047: private String m_postscriptExitCode;
048:
049: /**
050: * the pools they ran.
051: */
052: private String m_pool;
053:
054: /**
055: * Fatal error messages from the remote host
056: */
057: private ArrayList m_fatalErrorMessages;
058:
059: /**
060: * Error messages found in the JobID.out file
061: */
062: private ArrayList m_outFileMessages;
063:
064: /**
065: * The last stage it was performing before failur
066: */
067: private String m_lastStage;
068:
069: /**
070: * The Outfile Exitcodes
071: */
072: private List m_outExitCodes;
073:
074: private String m_retry;
075:
076: /**
077:
078: * c'tor
079: */
080: public JobInfo() {
081: m_id = null;
082: m_done = false;
083: m_outFileMessages = new ArrayList();
084: m_errorFileMessage = new ArrayList();
085: m_prescriptExitCode = null;
086: m_postscriptExitCode = null;
087: m_pool = null;
088: m_fatalErrorMessages = new ArrayList();
089: m_lastStage = null;
090: m_outExitCodes = new ArrayList();
091: m_retry = null;
092: }
093:
094: public void setRetry(String retry) {
095: m_retry = retry;
096: }
097:
098: public void addFatalErrorMessage(String message) {
099: m_fatalErrorMessages.add(message);
100: }
101:
102: public void setId(String id) {
103: m_id = id;
104: }
105:
106: public void setDone(boolean done) {
107: m_done = done;
108: }
109:
110: public void addErroFileMessage(String message) {
111: m_errorFileMessage.add(message);
112: }
113:
114: public void setOutfileExit(List exitcodes) {
115: m_outExitCodes = exitcodes;
116: }
117:
118: public void setPrescriptErrorCode(String exit) {
119: m_prescriptExitCode = exit;
120: }
121:
122: public void setPostcriptErrorCode(String exit) {
123: m_postscriptExitCode = exit;
124: }
125:
126: public void setPool(String pool) {
127: m_pool = pool;
128: }
129:
130: public void updateLastStage(String stage) {
131:
132: m_lastStage = null;
133: m_lastStage = stage;
134: }
135:
136: public String getLastStage() {
137: return m_lastStage;
138: }
139:
140: /**
141: * Dumps the contents of this record into the given writer.
142: *
143: * @param pw is a writable print writer.
144: */
145: public void dump(PrintWriter pw) throws IOException {
146:
147: pw.println("*retry: " + m_retry);
148: if (this .m_lastStage == null) {
149: pw.println("The " + this .m_id + " wasn't submitted");
150: } else {
151: pw.println(this .m_id + " Last Know Stage "
152: + this .m_lastStage.toUpperCase());
153: }
154: if (m_prescriptExitCode != null) {
155: pw.println("Prescript Exit Codes: " + m_prescriptExitCode);
156: } else {
157: pw.println("Prescript Exit Codes: N/A ");
158: }
159: if (m_postscriptExitCode != null) {
160: pw
161: .println("Postscript Exit Codes: "
162: + m_postscriptExitCode);
163: } else {
164: pw.println("Postscript Exit Codes: N/A ");
165: }
166:
167: if (this .m_outExitCodes.size() != 0) {
168:
169: pw.println("kickstart Exit Codes ");
170: for (Iterator i = this .m_outExitCodes.iterator(); i
171: .hasNext();) {
172: int exitcode = ((Integer) i.next()).intValue();
173: switch (exitcode) {
174: case 0:
175: pw.println("\t0 regular exit with exit code 0");
176: break;
177: case 1:
178: pw.println("\t1 regular exit with exit code > 0");
179: break;
180: case 2:
181: pw
182: .println("\t2 failure to run program from kickstart");
183: break;
184: case 3:
185: pw.println("\t3 application had died on signal");
186: break;
187: case 4:
188: pw
189: .println("\t4 application was suspended (should not happen)");
190: break;
191: case 5:
192: pw.println("\t5 failure in exit code parsing");
193: break;
194: case 6:
195: pw.println("\t6 impossible case");
196:
197: }
198: }
199: pw.println("");
200: }
201:
202: if (this .m_pool != null) {
203: pw.println("Ran At " + m_pool);
204: } else {
205: pw.println("No available pool");
206: }
207:
208: if (this .m_fatalErrorMessages.size() > 0) {
209: pw.println("Fatal Error Message: ");
210: for (Iterator i = this .m_fatalErrorMessages.iterator(); i
211: .hasNext();) {
212: pw.println((String) i.next());
213: }
214: pw.println();
215: }
216:
217: if (this .m_errorFileMessage.size() > 0) {
218: pw.println("Errors File: ");
219: for (Iterator i = this .m_errorFileMessage.iterator(); i
220: .hasNext();) {
221: pw.println((String) i.next());
222: }
223: }
224: pw.println();
225:
226: if (this .m_outFileMessages.size() > 0) {
227: pw.println("Job ID :" + this .m_id + " out File: ");
228: for (Iterator i = this .m_outFileMessages.iterator(); i
229: .hasNext();) {
230: pw.println((String) i.next());
231: }
232: pw.println();
233: }
234: pw
235: .println("---------------------------------------------------");
236: pw.flush();
237: }
238: }
|