CMS 3D CMS Logo

Functions
crabStatusFromReport Namespace Reference

Functions

def crabStatusFromReport (filename)
 
def printCrabStatusFromReport (filename)
 
def queryStatusXML (filename)
 

Function Documentation

def crabStatusFromReport.crabStatusFromReport (   filename)

Definition at line 94 of file crabStatusFromReport.py.

References queryStatusXML(), and harvestTrackValidationPlots.str.

94 def crabStatusFromReport(filename):
95  Jobs = queryStatusXML(filename)
96  #statusField = "statusScheduler"
97  #statusField = "state"
98  statusField = "status"
99  summary = {}
100  nJobs = 0
101  for j in Jobs:
102  jobStatus = str(j.attrs.get(statusField,None))
103  if jobStatus in summary: summary[jobStatus] += 1
104  else: summary[jobStatus] = 1
105  nJobs += 1
106 
107  for item in summary: summary[item] = 100.*summary[item]/nJobs
108 
109  return summary
110 
def crabStatusFromReport.printCrabStatusFromReport (   filename)

Definition at line 70 of file crabStatusFromReport.py.

References createfilelist.int, queryStatusXML(), and harvestTrackValidationPlots.str.

71  Jobs = queryStatusXML(filename)
72  print "Crab Id: StatusScheduler | Status | ProcessStatus | State | GridId |"
73  for j in Jobs:
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))
80 
81  # print crabId, processStatus, statusScheduler, status, state, gridId
82  print "%d : %s | %s | %s | %s | %s " % (crabId,statusScheduler,status,processStatus,state,gridId)
83 
84  """
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
90  bossId = crabId-1
91  print ("%d|%1s||%s|%d|") % (bossId, ost, gridId, crabId)
92  """
93 
def printCrabStatusFromReport(filename)
def crabStatusFromReport.queryStatusXML (   filename)

Definition at line 56 of file crabStatusFromReport.py.

References harvestTrackValidationPlots.str.

Referenced by crabStatusFromReport(), and printCrabStatusFromReport().

56 def queryStatusXML(filename):
57 
58  try:
59  report = loadIMProvFile(filename)
60  except Exception as ex:
61  msg = "Error reading CRAB Status Report: %s\n" % filename
62  msg += str(ex)
63  raise RuntimeError(msg)
64 
65  query = IMProvQuery("Task/TaskJobs/Job/RunningJob")
66  Jobs = query(report)
67 
68  return Jobs
69 
Definition: query.py:1