3 import jalview.gui.WebserviceInfo;
6 * bookkeeper class for the WebServiceInfo GUI, maintaining records of web
7 * service jobs handled by the window and reflecting any status updates.
12 public class JobStateSummary
15 * number of jobs running
20 * number of jobs queued
25 * number of jobs finished
30 * number of jobs failed
35 * number of jobs stopped due to server error
40 * number of jobs cancelled
45 * number of jobs finished with results
50 * processes an AWSJob's status and updates job status counters and WebService
57 public void updateJobPanelState(WebserviceInfo wsInfo,
58 String OutputHeader, AWsJob j)
62 String progheader = "";
63 // Parse state of job[j]
67 wsInfo.setStatus(j.jobnum, WebserviceInfo.STATE_RUNNING);
69 else if (j.isQueued())
72 wsInfo.setStatus(j.jobnum, WebserviceInfo.STATE_QUEUING);
74 else if (j.isFinished())
77 j.subjobComplete = true;
82 wsInfo.setStatus(j.jobnum, WebserviceInfo.STATE_STOPPED_OK);
84 else if (j.isFailed())
86 progheader += "Job failed.\n";
87 j.subjobComplete = true;
88 wsInfo.setStatus(j.jobnum, WebserviceInfo.STATE_STOPPED_ERROR);
91 else if (j.isServerError())
94 j.subjobComplete = true;
97 WebserviceInfo.STATE_STOPPED_SERVERERROR);
99 else if (j.isBroken())
101 progheader += "Job was broken.\n";
103 j.subjobComplete = true;
104 wsInfo.setStatus(j.jobnum, WebserviceInfo.STATE_STOPPED_ERROR);
106 // and pass on any sub-job messages to the user
107 wsInfo.setProgressText(j.jobnum, OutputHeader);
108 wsInfo.appendProgressText(j.jobnum, progheader);
111 // Could try to squash OOMs here, but it usually doesn't help - there probably won't be
112 // enough memory to handle the results later on anyway.
114 wsInfo.appendProgressText(j.jobnum, j.getStatus());
115 // } catch (OutOfMemoryError e)
117 // System.err.println("Out of memory when displaying status. Squashing error.");
118 // wsInfo.appendProgressText(j.jobnum,
119 // "..\n(Out of memory when displaying status)\n");
125 if (j.submitted && j.subjobComplete)
127 if (j.allowedServerExceptions == 0)
131 else if (!j.hasResults())