CMS 3D CMS Logo

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.

00095                                   :
00096     Jobs = queryStatusXML(filename)
00097     #statusField = "statusScheduler"
00098     #statusField = "state"
00099     statusField = "status"
00100     summary = {}
00101     nJobs = 0
00102     for j in Jobs:
00103         jobStatus = str(j.attrs.get(statusField,None))
00104         if summary.has_key(jobStatus): summary[jobStatus] += 1
00105         else: summary[jobStatus] = 1
00106         nJobs += 1
00107 
00108     for item in summary: summary[item] = 100.*summary[item]/nJobs
00109 
00110     return summary
00111 
def crabStatusFromReport::printCrabStatusFromReport (   filename)

Definition at line 70 of file crabStatusFromReport.py.

00071                                        :
00072     Jobs = queryStatusXML(filename)
00073     print "Crab Id: StatusScheduler | Status | ProcessStatus | State | GridId |"
00074     for j in Jobs:
00075         crabId = int(j.attrs.get("jobId",None))
00076         statusScheduler = str(j.attrs.get("statusScheduler",None))
00077         status = str(j.attrs.get("status",None))
00078         processStatus = str(j.attrs.get("processStatus",None))
00079         state  = str(j.attrs.get("state",None))
00080         gridId = str(j.attrs.get("schedulerId",None))
00081 
00082         # print crabId, processStatus, statusScheduler, status, state, gridId
00083         print "%d : %s | %s | %s | %s | %s " % (crabId,statusScheduler,status,processStatus,state,gridId)
00084 
00085         """
00086         # remap into old status codes from BOSS for use in JobRobot
00087         if state == 'SubRequested' : status = 'Submitting'
00088         if state == 'Terminated' : status = 'Done'
00089         ost = statusMap[statusScheduler]
00090         # old bossId starts from 0
00091         bossId = crabId-1
00092         print ("%d|%1s||%s|%d|") % (bossId, ost, gridId, crabId)
00093         """

def crabStatusFromReport::queryStatusXML (   filename)

Definition at line 56 of file crabStatusFromReport.py.

00057                             :
00058 
00059     try:
00060         report = loadIMProvFile(filename)
00061     except StandardError, ex:
00062         msg = "Error reading CRAB Status Report: %s\n" % filename
00063         msg += str(ex)
00064         raise RuntimeError, msg
00065 
00066     query = IMProvQuery("Task/TaskJobs/Job/RunningJob")
00067     Jobs = query(report)
00068 
00069     return Jobs
  

Variable Documentation

Initial value:
00001 {
00002     'Undefined':'U',
00003     'Created':'C',
00004     'Submitting':'B',
00005     'Submitted':'B',
00006     'Waiting':'S',
00007     'Ready':'S',
00008     'Scheduled':'S',
00009     'Running':'R',
00010     'Done':'D',
00011     'Done (Failed)':'D',
00012     'Cleared':'Y',
00013     'Retrieved':'Y',
00014     'Killing':'K',
00015     'Killed':'K',
00016     'CannotSubmit':'A',
00017     'Aborted':'A',
00018     'NotSubmitted':'A',
00019     'Cancelled':'K',
00020     'Cancelled by user':'K',
00021     'Unknown':'U',
00022     'Done(failed)':'D'   
00023     }

Definition at line 32 of file crabStatusFromReport.py.

Referenced by DTAlbertoBenvenutiTask::analyze(), DTTTrigCalibration::analyze(), DTSegmentsTask::analyze(), DTSegmentAnalysisTask::analyze(), DTDigiTask::analyze(), DTNoiseCalibration::endJob(), DTNoiseTest::endLuminosityBlock(), and DTSegmentSelector::operator()().