1 package fr.in2p3.jsaga.adaptor.job;
2
3 import fr.in2p3.jsaga.adaptor.job.monitor.JobStatus;
4 import org.globus.gram.internal.GRAMConstants;
5
6
7
8
9
10
11
12
13
14
15
16
17
18 public class GatekeeperJobStatus extends JobStatus {
19 public GatekeeperJobStatus(String jobId, Object stateCode, String stateString) {
20 super(jobId, stateCode, stateString);
21 }
22
23 public GatekeeperJobStatus(String jobId, Object stateCode, String stateString, int returnCode) {
24 super(jobId, stateCode, stateString, returnCode);
25 }
26
27 public String getModel() {
28 return "GLOBUS";
29 }
30
31 public SubState getSubState() {
32 if (m_nativeCause != null) {
33 return SubState.FAILED_ERROR;
34 }
35
36 switch(((Integer)m_nativeStateCode).intValue()) {
37 case GRAMConstants.STATUS_UNSUBMITTED:
38 return SubState.RUNNING_SUBMITTED;
39
40 case GRAMConstants.STATUS_PENDING:
41 case GRAMConstants.STATUS_STAGE_IN:
42 return SubState.RUNNING_QUEUED;
43
44 case GRAMConstants.STATUS_ACTIVE:
45 case GRAMConstants.STATUS_STAGE_OUT:
46 return SubState.RUNNING_ACTIVE;
47
48 case GRAMConstants.STATUS_SUSPENDED:
49 return SubState.SUSPENDED_QUEUED;
50
51 case GRAMConstants.STATUS_DONE:
52 return SubState.DONE;
53
54 case GRAMConstants.STATUS_FAILED:
55 return SubState.FAILED_ERROR;
56
57 default:
58 return null;
59 }
60 }
61 }