1 from IMProv.IMProvQuery
import IMProvQuery
2 from IMProv.IMProvLoader
import loadIMProvFile
51 'Cancelled by user':
'K',
59 report = loadIMProvFile(filename)
60 except StandardError, ex:
61 msg =
"Error reading CRAB Status Report: %s\n" % filename
63 raise RuntimeError, msg
65 query = IMProvQuery(
"Task/TaskJobs/Job/RunningJob")
72 print "Crab Id: StatusScheduler | Status | ProcessStatus | State | GridId |"
74 crabId = int(j.attrs.get(
"jobId",
None))
75 statusScheduler = str(j.attrs.get(
"statusScheduler",
None))
76 status = str(j.attrs.get(
"status",
None))
77 processStatus = str(j.attrs.get(
"processStatus",
None))
78 state = str(j.attrs.get(
"state",
None))
79 gridId = str(j.attrs.get(
"schedulerId",
None))
82 print "%d : %s | %s | %s | %s | %s " % (crabId,statusScheduler,status,processStatus,state,gridId)
85 # remap into old status codes from BOSS for use in JobRobot
86 if state == 'SubRequested' : status = 'Submitting'
87 if state == 'Terminated' : status = 'Done'
88 ost = statusMap[statusScheduler]
89 # old bossId starts from 0
91 print ("%d|%1s||%s|%d|") % (bossId, ost, gridId, crabId)
98 statusField =
"status"
102 jobStatus = str(j.attrs.get(statusField,
None))
103 if summary.has_key(jobStatus): summary[jobStatus] += 1
104 else: summary[jobStatus] = 1
107 for item
in summary: summary[item] = 100.*summary[item]/nJobs
def printCrabStatusFromReport