def __init__(self, runDir, fileMode, hltMode = None):
self.runDir = runDir
self.runNumber = int(runDir.replace("Run", ""))
self.prettyName = "Run {0}".format(self.runNumber)
# Need to rework the qa container
#self.qaContainer = qa.qaFunctionContainer
self.mode = fileMode
self.subsystems = BTrees.OOBTree.BTree()
self.hltMode = hltMode
# Try to retrieve the HLT mode if it was not passed
runInfoFilePath = os.path.join(processingParameters["dirPrefix"], self.runDir, "runInfo.yaml")
if not hltMode:
try:
with open(runInfoFilePath, "rb") as f:
runInfo = yaml.load(f.read())
self.hltMode = runInfo["hltMode"]
except IOError as e:
# File does not exist
# HLT mode will have to be unknown
self.hltMode = "U"
# Run Information
# Since this is only information to save, only write it if the file doesn't exist
if not os.path.exists(runInfoFilePath):
runInfo = {}
# "U" for unknown
runInfo["hltMode"] = hltMode if hltMode else "U"
# Write information
if not os.path.exists(os.path.dirname(runInfoFilePath)):
os.makedirs(os.path.dirname(runInfoFilePath))
with open(runInfoFilePath, "wb") as f:
yaml.dump(runInfo, f)
评论列表
文章目录