|
4 | 4 | import org.apache.logging.log4j.LogManager; |
5 | 5 | import org.apache.logging.log4j.Logger; |
6 | 6 | import org.jetbrains.annotations.NotNull; |
| 7 | +import org.jetbrains.annotations.Nullable; |
7 | 8 | import org.labkey.api.cluster.ClusterResourceAllocator; |
8 | 9 | import org.labkey.api.collections.CaseInsensitiveHashSet; |
9 | 10 | import org.labkey.api.data.Container; |
@@ -207,14 +208,15 @@ protected Pair<String, String> getStatusForJob(ClusterJob job, Container c) |
207 | 208 | } |
208 | 209 |
|
209 | 210 | String command = getConfig().getHistoryCommandExpr().eval(ctx); |
| 211 | + String info = null; |
210 | 212 | List<String> ret = execute(command); |
211 | 213 | if (ret != null) |
212 | 214 | { |
213 | 215 | //verify success |
214 | 216 | boolean headerFound = false; |
215 | 217 | boolean foundJobLine = false; |
216 | 218 | LinkedHashSet<String> statuses = new LinkedHashSet<>(); |
217 | | - List<String> header = null; |
| 219 | + List<String> header; |
218 | 220 | int jobIdx = -1; |
219 | 221 | int stateIdx = -1; |
220 | 222 | int hostnameIdx = -1; |
@@ -290,7 +292,7 @@ else if (headerFound) |
290 | 292 | _log.error("more than one status returned for job " + job.getClusterId() + ": " + StringUtils.join(statuses, ";") + ", using: " + status); |
291 | 293 | } |
292 | 294 |
|
293 | | - return translateSlurmStatusToTaskStatus(status); |
| 295 | + return translateSlurmStatusToTaskStatus(status, info); |
294 | 296 | } |
295 | 297 | } |
296 | 298 |
|
@@ -496,21 +498,26 @@ private File createSubmitScript(PipelineJob job) throws PipelineJobException |
496 | 498 | } |
497 | 499 |
|
498 | 500 | private Pair<String, String> translateSlurmStatusToTaskStatus(String status) |
| 501 | + { |
| 502 | + return translateSlurmStatusToTaskStatus(status, null); |
| 503 | + } |
| 504 | + |
| 505 | + private Pair<String, String> translateSlurmStatusToTaskStatus(String status, @Nullable String info) |
499 | 506 | { |
500 | 507 | if (status == null) |
501 | 508 | return null; |
502 | 509 |
|
503 | 510 | try |
504 | 511 | { |
505 | 512 | StatusType st = StatusType.parseValue(status); |
506 | | - return Pair.of(st.getLabkeyStatus().toUpperCase(), st.getInfo()); |
| 513 | + return Pair.of(st.getLabkeyStatus().toUpperCase(), st.getInfo(info)); |
507 | 514 | } |
508 | 515 | catch (IllegalArgumentException e) |
509 | 516 | { |
510 | 517 | _log.error("Unknown status type: [" + status + "]"); |
511 | 518 | } |
512 | 519 |
|
513 | | - return Pair.of(status, null); |
| 520 | + return Pair.of(status, info); |
514 | 521 | } |
515 | 522 |
|
516 | 523 | public static enum StatusType |
@@ -562,9 +569,9 @@ public String getLabkeyStatus() |
562 | 569 | return _taskStatus == null ? _labkeyStatus : _taskStatus.name(); |
563 | 570 | } |
564 | 571 |
|
565 | | - public String getInfo() |
| 572 | + public String getInfo(@Nullable String info) |
566 | 573 | { |
567 | | - return _info; |
| 574 | + return _info == null ? info : _info + (info == null ? "" : " / " + info); |
568 | 575 | } |
569 | 576 |
|
570 | 577 | public static StatusType parseValue(String value) |
|
0 commit comments