test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Functions | Variables
crabStatusFromReport Namespace Reference

Functions

def crabStatusFromReport
 
def printCrabStatusFromReport
 
def queryStatusXML
 

Variables

dictionary statusMap
 

Function Documentation

def crabStatusFromReport.crabStatusFromReport (   filename)

Definition at line 94 of file crabStatusFromReport.py.

References queryStatusXML().

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

Definition at line 70 of file crabStatusFromReport.py.

References queryStatusXML().

70 
71 def printCrabStatusFromReport(filename):
72  Jobs = queryStatusXML(filename)
73  print "Crab Id: StatusScheduler | Status | ProcessStatus | State | GridId |"
74  for j in Jobs:
75  crabId = int(j.attrs.get("jobId",None))
76  statusScheduler = str(j.attrs.get("statusScheduler",None))
77  status = str(j.attrs.get("status",None))
78  processStatus = str(j.attrs.get("processStatus",None))
79  state = str(j.attrs.get("state",None))
80  gridId = str(j.attrs.get("schedulerId",None))
81 
82  # print crabId, processStatus, statusScheduler, status, state, gridId
83  print "%d : %s | %s | %s | %s | %s " % (crabId,statusScheduler,status,processStatus,state,gridId)
84 
85  """
86  # remap into old status codes from BOSS for use in JobRobot
87  if state == 'SubRequested' : status = 'Submitting'
88  if state == 'Terminated' : status = 'Done'
89  ost = statusMap[statusScheduler]
90  # old bossId starts from 0
91  bossId = crabId-1
92  print ("%d|%1s||%s|%d|") % (bossId, ost, gridId, crabId)
93  """
def crabStatusFromReport.queryStatusXML (   filename)

Definition at line 56 of file crabStatusFromReport.py.

Referenced by crabStatusFromReport(), and printCrabStatusFromReport().

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

Variable Documentation

dictionary crabStatusFromReport.statusMap
Initial value:
1 = {
2  'Undefined':'U',
3  'Created':'C',
4  'Submitting':'B',
5  'Submitted':'B',
6  'Waiting':'S',
7  'Ready':'S',
8  'Scheduled':'S',
9  'Running':'R',
10  'Done':'D',
11  'Done (Failed)':'D',
12  'Cleared':'Y',
13  'Retrieved':'Y',
14  'Killing':'K',
15  'Killed':'K',
16  'CannotSubmit':'A',
17  'Aborted':'A',
18  'NotSubmitted':'A',
19  'Cancelled':'K',
20  'Cancelled by user':'K',
21  'Unknown':'U',
22  'Done(failed)':'D'
23  }

Definition at line 32 of file crabStatusFromReport.py.

Referenced by DTSegmentsTask.analyze(), DTTTrigCalibration.analyze(), DTSegmentAnalysisTask.analyze(), DTDigiTask.analyze(), DTNoiseCalibration.endJob(), DTSegmentSelector.operator()(), and EcalFenixStripFormatEE.setParameters().