def writeFJR(self): """ """ fwjr = FwkJobReport() fwjr.addError(self.wrapperExitCode, "WrapperExitCode") if self.exeExitCode != "": fwjr.addError(self.exeExitCode, "ExeExitCode") fwjr.write(self.reportFileName) return
def writeFJR(self): """ """ fwjr = FwkJobReport() fwjr.addError(self.wrapperExitCode, "WrapperExitCode") if (self.exeExitCode != ""): fwjr.addError(self.exeExitCode, "ExeExitCode") fwjr.write(self.reportFileName) return
def processCleanUpJobReport(self,statusCode): """ _processCleanUpJobReport_ Arguments: None Return: None """ # // # // Generate a report # // report = FwkJobReport() report.name = "cleanUp" report.status = "Failed" if statusCode == 0 : report.status = "Success" for lfnRemovedFile in self.success: report.addRemovedFile(lfnRemovedFile, self.seName) for lfnUnremovedFile in self.failed: report.addUnremovedFile(lfnUnremovedFile, self.seName) report.exitCode = statusCode report.jobSpecId = self.state.jobSpecNode.jobName report.jobType = self.state.jobSpecNode.jobType report.workflowSpecId = self.state.jobSpecNode.workflow report.write("./FrameworkJobReport.xml") # // # // Ensure this report gets added to the job-wide report #// toplevelReport = os.path.join(os.environ['PRODAGENT_JOB_DIR'],"FrameworkJobReport.xml") newReport = os.path.join(os.getcwd(), "FrameworkJobReport.xml") mergeReports(toplevelReport, newReport)
def writeFwkJobReport( self, jobSpecId, exitCode, reportfilename ): """ __writeFwkJobReport__ write a fake reportfilename based on the status reported """ # create job report logging.debug("Creating report %s" % reportfilename) fwjr = FwkJobReport() fwjr.jobSpecId = jobSpecId if exitCode == 0 : fwjr.status = "Success" fwjr.exitCode = 0 else : fwjr.exitCode = exitCode fwjr.status = "Failed" # store job report fwjr.write(reportfilename)
def processFrameworkJobReport(): """ Runtime tool for processing the Framework Job Report produced by CMsGen executables """ theJobReport = FwkJobReport() # # If everything worked well set the success status # else record a failure and error if jobFailed == 0: theJobReport.status = "Success" theJobReport.exitCode = 0 elif jobFailed == 1: theJobReport.status = "Failed" theJobReport.exitCode = 11111 errDetail = theJobReport.addError(11111, "CmsGenFailure") errDetail['Description'] = "Error retrieving grid file" elif jobFailed == 2: theJobReport.status = "Failed" theJobReport.exitCode = 11112 errDetail = theJobReport.addError(11112, "CmsGenFailure") errDetail['Description'] = "Error producing step 1 events" elif jobFailed == 3: theJobReport.status = "Failed" theJobReport.exitCode = 11113 errDetail = theJobReport.addError(11113, "CmsGenFailure") errDetail['Description'] = "Error producing step 2 events" elif jobFailed == 4: theJobReport.status = "Failed" theJobReport.exitCode = 11114 errDetail = theJobReport.addError(11114, "CmsGenFailure") errDetail[ 'Description'] = "Error computing the number of produced events" elif jobFailed == 5: theJobReport.status = "Failed" theJobReport.exitCode = 11115 errDetail = theJobReport.addError(11115, "CmsGenFailure") errDetail['Description'] = "Error making a link" elif jobFailed == 6: theJobReport.status = "Failed" theJobReport.exitCode = 11116 errDetail = theJobReport.addError(11116, "CmsGenFailure") errDetail['Description'] = "Error preparing the executation" else: theJobReport.status = "Failed" theJobReport.exitCode = 11117 errDetail = theJobReport.addError(11117, "CmsGenFailure") errDetail['Description'] = "General cmsGen Failure" if jobFailed == 0: file = open("nCmsGenEvents.txt", 'r') nEventsLine = file.readline() nEvents = nEventsLine.split('\n') file.close() totalEvents = nEvents[0] outputFileUnw = "" if generator == "alpgen": outputFileUnw = "%s.unw" % outputFile elif generator == "comphep": outputFileUnw = "%s" % outputFile elif generator == "madgraph": outputFileUnw = "%s" % outputFile if not os.path.exists(outputFileUnw): msg = "Output file Not Found: %s" % outputFileUnw raise RuntimeError, msg totalSize = os.stat(outputFileUnw)[6] else: totalEvents = 0 totalSize = 0 newFile = theJobReport.newFile() newFile["LFN"] = "None" if generator == "alpgen": #newFile["PFN"] = "%s/%s" % (os.getcwd(),outputFile) newFile["PFN"] = "%s" % outputFile elif generator == "comphep": newFile["PFN"] = "%s" % outputFile elif generator == "madgraph": newFile["PFN"] = "%s" % outputFile newFile["Size"] = totalSize newFile["TotalEvents"] = totalEvents newFile["ModuleLabel"] = "cmsGen" theJobReport.write(jobReport)
if not os.path.exists(cfgFile): msg = "Cfg File Not Found: %s" % cfgFile raise RuntimeError, msg if generator == "alpgen": jobFailed = alpGen() processFrameworkJobReport() elif generator == "comphep": jobFailed = compHep() processFrameworkJobReport() elif generator == "madgraph": jobFailed = madgraph() processFrameworkJobReport() elif generator == "sherpa": jobFailed = sherpa() # Create a dummy FwkJobReport theJobReport = FwkJobReport() if jobFailed == 0: theJobReport.status = "Success" theJobReport.exitCode = 0 theJobReport.write(jobReport) else: theJobReport.status = "Failed" theJobReport.exitCode = jobFailed errDetail = theJobReport.addError(jobFailed, "CmsGenFailure") errDetail['Description'] = "Failed to set up Sherpa Libs" else: msg = "Generator %s Not Found" % generator raise RuntimeError, msg
def processFrameworkJobReport(): """ Runtime tool for processing the Framework Job Report produced by CMsGen executables """ theJobReport = FwkJobReport() # # If everything worked well set the success status # else record a failure and error if jobFailed == 0: theJobReport.status = "Success" theJobReport.exitCode = 0 elif jobFailed == 1: theJobReport.status = "Failed" theJobReport.exitCode = 11111 errDetail = theJobReport.addError(11111, "CmsGenFailure") errDetail['Description'] = "Error retrieving grid file" elif jobFailed == 2: theJobReport.status = "Failed" theJobReport.exitCode = 11112 errDetail = theJobReport.addError(11112, "CmsGenFailure") errDetail['Description'] = "Error producing step 1 events" elif jobFailed == 3: theJobReport.status = "Failed" theJobReport.exitCode = 11113 errDetail = theJobReport.addError(11113, "CmsGenFailure") errDetail['Description'] = "Error producing step 2 events" elif jobFailed == 4: theJobReport.status = "Failed" theJobReport.exitCode = 11114 errDetail = theJobReport.addError(11114, "CmsGenFailure") errDetail['Description'] = "Error computing the number of produced events" elif jobFailed == 5: theJobReport.status = "Failed" theJobReport.exitCode = 11115 errDetail = theJobReport.addError(11115, "CmsGenFailure") errDetail['Description'] = "Error making a link" elif jobFailed == 6: theJobReport.status = "Failed" theJobReport.exitCode = 11116 errDetail = theJobReport.addError(11116, "CmsGenFailure") errDetail['Description'] = "Error preparing the executation" else: theJobReport.status = "Failed" theJobReport.exitCode = 11117 errDetail = theJobReport.addError(11117, "CmsGenFailure") errDetail['Description'] = "General cmsGen Failure" if jobFailed == 0: file = open("nCmsGenEvents.txt", 'r') nEventsLine = file.readline() nEvents = nEventsLine.split('\n') file.close() totalEvents = nEvents[0] outputFileUnw = "" if generator == "alpgen": outputFileUnw = "%s.unw" % outputFile elif generator == "comphep": outputFileUnw = "%s" % outputFile elif generator == "madgraph": outputFileUnw = "%s" % outputFile if not os.path.exists(outputFileUnw): msg = "Output file Not Found: %s" % outputFileUnw raise RuntimeError, msg totalSize = os.stat(outputFileUnw)[6] else: totalEvents = 0 totalSize = 0 newFile = theJobReport.newFile() newFile["LFN"] = "None" if generator == "alpgen": #newFile["PFN"] = "%s/%s" % (os.getcwd(),outputFile) newFile["PFN"] = "%s" % outputFile elif generator == "comphep": newFile["PFN"] = "%s" % outputFile elif generator == "madgraph": newFile["PFN"] = "%s" % outputFile newFile["Size"] = totalSize newFile["TotalEvents"] = totalEvents newFile["ModuleLabel"] = "cmsGen" theJobReport.write(jobReport)
if not os.path.exists(cfgFile): msg = "Cfg File Not Found: %s" % cfgFile raise RuntimeError, msg if generator == "alpgen": jobFailed = alpGen() processFrameworkJobReport() elif generator == "comphep": jobFailed = compHep() processFrameworkJobReport() elif generator == "madgraph": jobFailed = madgraph() processFrameworkJobReport() elif generator == "sherpa": jobFailed = sherpa() # Create a dummy FwkJobReport theJobReport = FwkJobReport() if jobFailed == 0: theJobReport.status = "Success" theJobReport.exitCode = 0 theJobReport.write(jobReport) else: theJobReport.status = "Failed" theJobReport.exitCode = jobFailed errDetail = theJobReport.addError(jobFailed, "CmsGenFailure") errDetail['Description'] = "Failed to set up Sherpa Libs" else: msg = "Generator %s Not Found" % generator raise RuntimeError, msg