1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
package jalview.ws; |
22 |
|
|
23 |
|
import jalview.gui.WebserviceInfo; |
24 |
|
|
25 |
|
|
26 |
|
|
27 |
|
|
28 |
|
|
29 |
|
@author |
30 |
|
|
31 |
|
|
|
|
| 38.3% |
Uncovered Elements: 50 (81) |
Complexity: 18 |
Complexity Density: 0.38 |
|
32 |
|
public class JobStateSummary |
33 |
|
{ |
34 |
|
|
35 |
|
|
36 |
|
|
37 |
|
int running = 0; |
38 |
|
|
39 |
|
|
40 |
|
|
41 |
|
|
42 |
|
int queuing = 0; |
43 |
|
|
44 |
|
|
45 |
|
|
46 |
|
|
47 |
|
int finished = 0; |
48 |
|
|
49 |
|
|
50 |
|
|
51 |
|
|
52 |
|
int error = 0; |
53 |
|
|
54 |
|
|
55 |
|
|
56 |
|
|
57 |
|
int serror = 0; |
58 |
|
|
59 |
|
|
60 |
|
|
61 |
|
|
62 |
|
int cancelled = 0; |
63 |
|
|
64 |
|
|
65 |
|
|
66 |
|
|
67 |
|
int results = 0; |
68 |
|
|
69 |
|
|
70 |
|
|
71 |
|
|
72 |
|
|
73 |
|
@param |
74 |
|
@param |
75 |
|
@param |
76 |
|
|
|
|
| 37.5% |
Uncovered Elements: 50 (80) |
Complexity: 18 |
Complexity Density: 0.38 |
|
77 |
1 |
public void updateJobPanelState(WebserviceInfo wsInfo,... |
78 |
|
String OutputHeader, AWsJob j) |
79 |
|
{ |
80 |
1 |
if (j.cancelled) |
81 |
|
{ |
82 |
0 |
cancelled++; |
83 |
0 |
j.subjobComplete = true; |
84 |
0 |
wsInfo.setStatus(j.jobnum, WebserviceInfo.STATE_CANCELLED_OK); |
85 |
0 |
return; |
86 |
|
} |
87 |
1 |
if (j.submitted) |
88 |
|
{ |
89 |
1 |
String progheader = ""; |
90 |
|
|
91 |
1 |
if (j.isRunning()) |
92 |
|
{ |
93 |
0 |
running++; |
94 |
0 |
wsInfo.setStatus(j.jobnum, WebserviceInfo.STATE_RUNNING); |
95 |
|
} |
96 |
1 |
else if (j.isQueued()) |
97 |
|
{ |
98 |
0 |
queuing++; |
99 |
0 |
wsInfo.setStatus(j.jobnum, WebserviceInfo.STATE_QUEUING); |
100 |
|
} |
101 |
1 |
else if (j.isFinished()) |
102 |
|
{ |
103 |
0 |
finished++; |
104 |
0 |
j.subjobComplete = true; |
105 |
0 |
if (j.hasResults()) |
106 |
|
{ |
107 |
0 |
results++; |
108 |
|
} |
109 |
0 |
wsInfo.setStatus(j.jobnum, WebserviceInfo.STATE_STOPPED_OK); |
110 |
|
} |
111 |
1 |
else if (j.isFailed()) |
112 |
|
{ |
113 |
0 |
progheader += "Job failed.\n"; |
114 |
0 |
j.subjobComplete = true; |
115 |
0 |
wsInfo.setStatus(j.jobnum, WebserviceInfo.STATE_STOPPED_ERROR); |
116 |
0 |
error++; |
117 |
|
} |
118 |
1 |
else if (j.isServerError()) |
119 |
|
{ |
120 |
0 |
serror++; |
121 |
0 |
j.subjobComplete = true; |
122 |
0 |
wsInfo.setStatus(j.jobnum, |
123 |
|
WebserviceInfo.STATE_STOPPED_SERVERERROR); |
124 |
|
} |
125 |
1 |
else if (j.isBroken()) |
126 |
|
{ |
127 |
0 |
progheader += "Job was broken.\n"; |
128 |
0 |
error++; |
129 |
0 |
j.subjobComplete = true; |
130 |
0 |
wsInfo.setStatus(j.jobnum, WebserviceInfo.STATE_STOPPED_ERROR); |
131 |
|
} |
132 |
|
|
133 |
1 |
StringBuffer output = new StringBuffer(); |
134 |
1 |
if (OutputHeader != null) |
135 |
|
{ |
136 |
|
|
137 |
0 |
output.append(OutputHeader); |
138 |
|
} |
139 |
1 |
if (progheader != null) |
140 |
|
{ |
141 |
1 |
output.append(progheader); |
142 |
|
} |
143 |
1 |
if (j.hasStatus()) |
144 |
|
{ |
145 |
|
|
146 |
|
|
147 |
|
|
148 |
|
|
149 |
1 |
String stat = j.getStatus(); |
150 |
1 |
if (stat != null) |
151 |
|
{ |
152 |
1 |
output.append(stat); |
153 |
|
} |
154 |
|
|
155 |
|
|
156 |
|
|
157 |
|
|
158 |
|
|
159 |
|
|
160 |
|
|
161 |
|
|
162 |
|
} |
163 |
1 |
wsInfo.setProgressText(j.jobnum, output.toString()); |
164 |
|
} |
165 |
|
else |
166 |
|
{ |
167 |
0 |
if (j.submitted && j.subjobComplete) |
168 |
|
{ |
169 |
0 |
if (j.allowedServerExceptions == 0) |
170 |
|
{ |
171 |
0 |
serror++; |
172 |
|
} |
173 |
0 |
else if (!j.hasResults()) |
174 |
|
{ |
175 |
0 |
error++; |
176 |
|
} |
177 |
|
} |
178 |
|
} |
179 |
|
} |
180 |
|
} |