本文整理汇总了Python中WMQuality.Emulators.WMSpecGenerator.WMSpecGenerator.WMSpecGenerator.getTask方法的典型用法代码示例。如果您正苦于以下问题:Python WMSpecGenerator.getTask方法的具体用法?Python WMSpecGenerator.getTask怎么用?Python WMSpecGenerator.getTask使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WMQuality.Emulators.WMSpecGenerator.WMSpecGenerator.WMSpecGenerator
的用法示例。
在下文中一共展示了WMSpecGenerator.getTask方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ReportEmuTest
# 需要导入模块: from WMQuality.Emulators.WMSpecGenerator.WMSpecGenerator import WMSpecGenerator [as 别名]
# 或者: from WMQuality.Emulators.WMSpecGenerator.WMSpecGenerator.WMSpecGenerator import getTask [as 别名]
class ReportEmuTest(unittest.TestCase):
"""
_ReportEmuTest_
"""
def setUp(self):
"""
_setUp_
Setup some reasonable defaults for the ReReco workflow.
"""
self.unmergedLFNBase = "/store/backfill/2/unmerged"
self.mergedLFNBase = "/store/backfill/2"
self.processingVersion = "v1"
self.cmsswVersion = "CMSSW_3_4_2_patch1"
self.acquisitionEra = "WMAgentCommissioining10"
self.primaryDataset = "MinimumBias"
self.workload = WMSpecGenerator().createReRecoSpec("Tier1ReReco")
print self.workload.data
return
def verifyOutputMetaData(self, outputFile, job):
"""
_verifyOutputMetaData_
Verify that metadata that in an emulated FWJR. Most of the meta data
should be the same as the input file.
"""
goldenRuns = []
for inputFile in job["input_files"]:
for run in inputFile["runs"]:
goldenRuns.append(Run(run.run, *run.lumis))
assert len(outputFile["runs"]) == len(goldenRuns), \
"Error: Wrong number of runs in output file."
for outputRun in outputFile["runs"]:
for goldenRun in goldenRuns:
if outputRun.run == goldenRun.run:
goldenRun.lumis.sort()
outputRun.lumis.sort()
if goldenRun.lumis == outputRun.lumis:
goldenRuns.remove(goldenRun)
break
assert len(goldenRuns) == 0, \
"Error: Run information wrong on output file."
assert len(outputFile["locations"]) == 1, \
"Error: Wrong number of locations."
assert list(outputFile["locations"])[0] == job["location"], \
"Error: Output file at the wrong location."
assert outputFile["merged"] == False, \
"Error: Output should be unmerged."
assert "adler32" in outputFile["checksums"].keys(), \
"Error: Adler32 checksum missing."
assert "cksum" in outputFile["checksums"].keys(), \
"Error: CKSum checksum missing."
return
def testProcessing(self):
"""
_testProcessing_
Setup a processing workflow and job and verify that the FWJR produced
by the emulator is reasonable.
"""
rerecoTask = self.workload.getTask("DataProcessing")
cmsRunStep = rerecoTask.getStep("cmsRun1")
inputFile = File(lfn = "/path/to/test/lfn", size = 1048576, events = 1000, merged = True)
inputFile.addRun(Run(1, *[1, 2, 3, 4, 5]))
inputFile.addRun(Run(2, *[1, 2, 3, 4, 5, 6]))
processingJob = Job(name = "ProcessingJob", files = [inputFile])
processingJob["task"] = "/Tier1ReReco/ReReco"
processingJob["mask"].setMaxAndSkipEvents(500, 0)
processingJob["id"] = 1
processingJob["location"] = "cmssrm.fnal.gov"
emu = ReportEmu(WMStep = cmsRunStep.getTypeHelper(), Job = processingJob)
report = emu()
reportInputFiles = report.getInputFilesFromStep("cmsRun1")
assert len(reportInputFiles) == 1, \
"Error: Wrong number of input files for the job."
assert reportInputFiles[0]["lfn"] == inputFile["lfn"], \
"Error: Input LFNs do not match: %s" % reportInputFiles[0]["lfn"]
assert reportInputFiles[0]["size"] == inputFile["size"], \
"Error: Input file sizes do not match."
assert reportInputFiles[0]["events"] == inputFile["events"], \
"Error: Input file events do not match."
#.........这里部分代码省略.........