5 """ Returns state of the jobs.
7 State returned as an int based on an enum in the PrunDriver.cxx :
8 `enum Enum { DONE=0, PENDING=1, FAIL=2 };`
9 Make sure these values are kept the same in both files.
10 Extra values are added to capture extra states, those start at 90.
13 from enum
import IntEnum
14 class Status(IntEnum):
24 from pandatools
import PandaToolsPkgInfo
26 print (
"prun needs additional setup, try:")
27 print (
" lsetup panda")
28 return Status.SCRIPT_FAIL
30 jediTaskID =
int(sample.meta().castDouble(
"nc_jediTaskID", 0))
33 print (
"Sample " + sample.name() +
" does not have a jediTaskID")
34 return Status.SCRIPT_FAIL
36 from pandatools
import Client
39 taskDict[
'jediTaskID'] = jediTaskID
40 detail = Client.getJediTaskDetails(taskDict,
False,
True)
42 print (
"Problem checking status of task %s with id %s" % (sample.name(), jediTaskID))
43 return Status.SCRIPT_FAIL
45 status = detail[1][
'status']
47 if status ==
"done":
return Status.DONE
48 elif status ==
"failed":
return Status.FAIL
51 elif status ==
"finished":
return Status.FAIL
52 elif status ==
"running":
return Status.RUNNING