def legacyLumiInfo(self, improvNode, queryBase): """ _legacyLumiInfo_ handle legacy lumi section information """ # // # // Lumi Sections #// lumiQ = IMProvQuery("/%s/LumiSections/LumiSection" % queryBase) for lumiSect in lumiQ(improvNode): newLumi = {} [ newLumi.__setitem__(x.name, x.attrs['Value']) for x in lumiSect.children ] run = newLumi.get("RunNumber", None) lumi = newLumi.get("LumiSectionNumber", None) if run == None or lumi == None: continue run = int(run) lumi = int(lumi) if not self.runs.has_key(run): newRun = RunInfo() newRun.run = run self.runs[run] = newRun runInfo = self.runs.get(run) runInfo.append(lumi) return
def addRunAndLumi(self, runNumber, *lumis): """ _addLumiSection_ Associate this file with a Lumi section. If the run number is not in the list of runs, then add it """ if not self.runs.has_key(runNumber): self.runs[runNumber] = RunInfo() self.runs[runNumber].run = runNumber run = self.runs[runNumber] run.extend(lumis) return
def load(self, improvNode): """ _load_ Populate this object from the improvNode provided """ # // # // Input or Output? #// queryBase = improvNode.name if queryBase == "InputFile": self.isInput = True else: self.isInput = False # // # // Parameters #// paramQ = IMProvQuery("/%s/*" % queryBase) for paramNode in paramQ(improvNode): if paramNode.name not in self.keys(): continue self[paramNode.name] = paramNode.chardata # // # // State #// stateQ = IMProvQuery("/%s/State[attribute(\"Value\")]" % queryBase) self.state = stateQ(improvNode)[-1] # // # // Checksums #// cksumQ = IMProvQuery("/%s/Checksum" % queryBase) for cksum in cksumQ(improvNode): algo = cksum.attrs.get('Algorithm', None) if algo == None: continue self.addChecksum(str(algo), str(cksum.chardata)) # // # // Inputs #// inputFileQ = IMProvQuery("/%s/Inputs/Input" % queryBase) for inputFile in inputFileQ(improvNode): lfn = IMProvQuery("/Input/LFN[text()]")(inputFile)[-1] pfn = IMProvQuery("/Input/PFN[text()]")(inputFile)[-1] self.addInputFile(pfn, lfn) # // # // Datasets #// datasetQ = IMProvQuery("/%s/Datasets/DatasetInfo" % queryBase) for dataset in datasetQ(improvNode): newDataset = self.newDataset() newDataset.load(dataset) # // # // Branches #// branchQ = IMProvQuery("/%s/Branches/Branch[text()]" % queryBase) for branch in branchQ(improvNode): self.branches.append(str(branch)) runQ = IMProvQuery("/%s/Runs/Run" % queryBase) for run in runQ(improvNode): newRun = RunInfo() newRun.load(run) if newRun.run == None: continue self.runs[newRun.run] = newRun self["Runs"]=self.runs self.legacyLumiInfo(improvNode, queryBase) return
def load(self, improvNode): """ _load_ Populate this object from the improvNode provided """ # // # // Input or Output? #// queryBase = improvNode.name if queryBase == "InputFile": self.isInput = True else: self.isInput = False # // # // Parameters #// paramQ = IMProvQuery("/%s/*" % queryBase) for paramNode in paramQ(improvNode): if paramNode.name not in self.keys(): continue self[paramNode.name] = paramNode.chardata # // # // State #// stateQ = IMProvQuery("/%s/State[attribute(\"Value\")]" % queryBase) self.state = stateQ(improvNode)[-1] # // # // Checksums #// cksumQ = IMProvQuery("/%s/Checksum" % queryBase) for cksum in cksumQ(improvNode): algo = cksum.attrs.get('Algorithm', None) if algo == None: continue self.addChecksum(str(algo), str(cksum.chardata)) # // # // Inputs #// inputFileQ = IMProvQuery("/%s/Inputs/Input" % queryBase) for inputFile in inputFileQ(improvNode): lfn = IMProvQuery("/Input/LFN[text()]")(inputFile)[-1] pfn = IMProvQuery("/Input/PFN[text()]")(inputFile)[-1] self.addInputFile(pfn, lfn) # // # // Datasets #// datasetQ = IMProvQuery("/%s/Datasets/DatasetInfo" % queryBase) for dataset in datasetQ(improvNode): newDataset = self.newDataset() newDataset.load(dataset) # // # // Branches #// branchQ = IMProvQuery("/%s/Branches/Branch[text()]" % queryBase) for branch in branchQ(improvNode): self.branches.append(str(branch)) runQ = IMProvQuery("/%s/Runs/Run" % queryBase) for run in runQ(improvNode): newRun = RunInfo() newRun.load(run) if newRun.run == None: continue self.runs[newRun.run] = newRun self["Runs"] = self.runs self.legacyLumiInfo(improvNode, queryBase) return