本文整理汇总了Python中WMCore.FwkJobReport.Report类的典型用法代码示例。如果您正苦于以下问题:Python Report类的具体用法?Python Report怎么用?Python Report使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Report类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: runHandler
def runHandler():
"""
_runHandler_
Sink to add run information to a file. Given the following XML:
<Runs>
<Run ID="122023">
<LumiSection ID="215"/>
<LumiSection ID="216"/>
</Run>
<Run ID="122024">
<LumiSection ID="1"/>
<LumiSection ID="2"/>
</Run>
</Runs>
Create a WMCore.DataStructs.Run object for each run and call the
addRunInfoToFile() function to add the run information to the file
section.
"""
while True:
fileSection, node = (yield)
for subnode in node.children:
if subnode.name == "Run":
runId = subnode.attrs.get("ID", None)
if runId == None:
continue
lumis = [int(lumi.attrs["ID"]) for lumi in subnode.children if lumi.attrs.has_key("ID")]
runInfo = Run(runNumber=runId)
runInfo.lumis.extend(lumis)
Report.addRunInfoToFile(fileSection, runInfo)
示例2: inputFileHandler
def inputFileHandler(targets):
"""
_inputFileHandler_
coroutine to create input files in the report and dispatch
sub data down the pipeline
"""
while True:
report, node = (yield)
moduleName = None
moduleNode = [ x for x in node.children if x.name == "ModuleLabel"][0]
moduleName = moduleNode.text
moduleRef = report.addInputSource(moduleName)
fileRef = report.addInputFile(moduleName)
fileAttrs = {}
for subnode in node.children:
if subnode.name == "Runs":
targets['Runs'].send( (fileRef, subnode) )
elif subnode.name == "Branches":
targets['Branches'].send( (fileRef, subnode) )
else:
fileAttrs[subnode.name] = subnode.text
Report.addAttributesToFile(fileRef, lfn = fileAttrs["LFN"],
pfn = fileAttrs["PFN"], catalog = fileAttrs["Catalog"],
module_label = fileAttrs["ModuleLabel"],
guid = fileAttrs["GUID"], input_type = fileAttrs["InputType"],
input_source_class = fileAttrs["InputSourceClass"],
events = int(fileAttrs["EventsRead"]))
[fileRef]
示例3: addInputFilesToReport
def addInputFilesToReport(self, report):
"""
_addInputFilesToReport_
Pull all of the input files out of the job and add them to the report.
"""
report.addInputSource("PoolSource")
for inputFile in self.job["input_files"]:
inputFileSection = report.addInputFile("PoolSource", lfn=inputFile["lfn"],
size=inputFile["size"],
events=inputFile["events"])
Report.addRunInfoToFile(inputFileSection, inputFile["runs"])
return
示例4: runHandler
def runHandler():
"""
_runHandler_
Sink to add run information to a file. Given the following XML:
<Runs>
<Run ID="122023">
<LumiSection NEvents="100" ID="215"/>
<LumiSection NEvents="100" ID="216"/>
</Run>
<Run ID="122024">
<LumiSection ID="1"/>
<LumiSection ID="2"/>
</Run>
</Runs>
Create a WMCore.DataStructs.Run object for each run and call the
addRunInfoToFile() function to add the run information to the file
section.
"""
while True:
fileSection, node = (yield)
for subnode in node.children:
if subnode.name == "Run":
runId = subnode.attrs.get("ID", None)
if runId is None:
continue
lumis = []
for lumi in subnode.children:
if "ID" in lumi.attrs:
lumiNumber = int(lumi.attrs['ID'])
nEvents = lumi.attrs.get("NEvents", None)
if nEvents is not None:
try:
nEvents = int(nEvents)
except ValueError:
nEvents = None
lumis.append((lumiNumber, nEvents))
runInfo = Run(runNumber=runId)
runInfo.extendLumis(lumis)
Report.addRunInfoToFile(fileSection, runInfo)
示例5: inputAssocHandler
def inputAssocHandler():
"""
_inputAssocHandler_
Sink to handle output:input association information. Given the following
XML:
<Input>
<LFN>/path/to/some/lfn.root</LFN>
<PFN>/some/pfn/info/path/to/some/lfn.root</PFN>
</Input>
Extract the LFN and call the addInputToFile() function to associate input to
output in the FWJR.
"""
while True:
fileSection, node = (yield)
for inputnode in node.children:
data = {}
[data.__setitem__(subnode.name, subnode.text) for subnode in inputnode.children]
Report.addInputToFile(fileSection, data["LFN"], data["PFN"])
示例6: fileHandler
def fileHandler(targets):
"""
_fileHandler_
coroutine to create files and handle sub data in the appropriate
dispatchers
"""
while True:
report, node = (yield)
moduleName = None
moduleNode = [x for x in node.children if x.name == "ModuleLabel"][0]
moduleName = moduleNode.text
moduleRef = report.addOutputModule(moduleName)
fileRef = report.addOutputFile(moduleName)
fileAttrs = {}
for subnode in node.children:
if subnode.name == "Inputs":
targets["Inputs"].send((fileRef, subnode))
elif subnode.name == "Runs":
targets["Runs"].send((fileRef, subnode))
elif subnode.name == "Branches":
targets["Branches"].send((fileRef, subnode))
else:
fileAttrs[subnode.name] = subnode.text
Report.addAttributesToFile(
fileRef,
lfn=fileAttrs["LFN"],
pfn=fileAttrs["PFN"],
catalog=fileAttrs["Catalog"],
module_label=fileAttrs["ModuleLabel"],
guid=fileAttrs["GUID"],
ouput_module_class=fileAttrs["OutputModuleClass"],
events=int(fileAttrs["TotalEvents"]),
branch_hash=fileAttrs["BranchHash"],
)
[fileRef]
示例7: addOutputFilesToReport
def addOutputFilesToReport(self, report):
"""
_addOutputFilesToReport_
Add output files to every output module in the step. Scale the size
and number of events in the output files appropriately.
"""
(outputSize, outputEvents) = self.determineOutputSize()
if not os.path.exists('ReportEmuTestFile.txt'):
f = open('ReportEmuTestFile.txt', 'w')
f.write('A Shubbery')
f.close()
for outputModuleName in self.step.listOutputModules():
outputModuleSection = self.step.getOutputModule(outputModuleName)
outputModuleSection.fixedLFN = False
outputModuleSection.disableGUID = False
outputLFN = "%s/%s.root" % (outputModuleSection.lfnBase,
str(makeUUID()))
outputFile = File(lfn = outputLFN, size = outputSize, events = outputEvents,
merged = False)
outputFile.setLocation(self.job["location"])
outputFile['pfn'] = "ReportEmuTestFile.txt"
outputFile['guid'] = "ThisIsGUID"
outputFile["checksums"] = {"adler32": "1234", "cksum": "5678"}
outputFile["dataset"] = {"primaryDataset": outputModuleSection.primaryDataset,
"processedDataset": outputModuleSection.processedDataset,
"dataTier": outputModuleSection.dataTier,
"applicationName": "cmsRun",
"applicationVersion": self.step.getCMSSWVersion()}
outputFile["module_label"] = outputModuleName
outputFileSection = report.addOutputFile(outputModuleName, outputFile)
for inputFile in self.job["input_files"]:
Report.addRunInfoToFile(outputFileSection, inputFile["runs"])
return
示例8: range
39, 40])
totalReports = 25
inputFilesPerReport = 50
inputFileCounter = 0
for i in range(totalReports):
loadTestReport = Report.Report("cmsRun1")
loadTestReport.addInputSource("PoolSource")
for j in range(inputFilesPerReport):
inputFile = loadTestReport.addInputFile("PoolSource", lfn = "input%i" % inputFileCounter,
events = 600000, size = 600000)
inputFileCounter += 1
Report.addRunInfoToFile(inputFile, runInfo)
for outputModule in outputModules:
loadTestReport.addOutputModule(outputModule)
datasetInfo = {"applicationName": "cmsRun", "applicationVersion": "CMSSW_3_3_5_patch3",
"primaryDataset": outputModule, "dataTier": "RAW",
"processedDataset": "LoadTest10"}
fileAttrs = {"lfn": makeUUID(), "location": "cmssrm.fnal.gov",
"checksums": {"adler32": "ff810ec3", "cksum": "2212831827"},
"events": random.randrange(500, 5000, 50),
"merged": True,
"size": random.randrange(1000, 2000, 100000000),
"module_label": outputModule, "dataset": datasetInfo}
outputFile = loadTestReport.addOutputFile(outputModule, fileAttrs)
Report.addRunInfoToFile(outputFile, runInfo)