Merge several log files into one for post-processing
Definition at line 121 of file CheckSteps.py.
◆ __init__()
def python.TrigValSteering.CheckSteps.LogMergeStep.__init__ |
( |
|
self, |
|
|
|
name = 'LogMerge' |
|
) |
| |
Definition at line 124 of file CheckSteps.py.
124 def __init__(self, name='LogMerge'):
125 super(LogMergeStep, self).
__init__(name)
126 self.log_files =
None
127 self.extra_log_regex =
None
128 self.merged_name =
'athena.merged.log'
129 self.warn_if_missing =
True
◆ configure()
def python.TrigValSteering.CheckSteps.LogMergeStep.configure |
( |
|
self, |
|
|
|
test |
|
) |
| |
Definition at line 131 of file CheckSteps.py.
132 if self.log_files
is None:
134 for step
in test.exec_steps:
135 self.log_files.
append(step.name)
137 if self.merged_name
in self.log_files:
138 self.misconfig_abort(
139 'output log name %s is same as one of the input log names.'
140 ' This will lead to infinite loop, aborting.', self.merged_name)
141 super(LogMergeStep, self).
configure(test)
◆ merge_logs()
def python.TrigValSteering.CheckSteps.LogMergeStep.merge_logs |
( |
|
self | ) |
|
Definition at line 151 of file CheckSteps.py.
151 def merge_logs(self):
153 with open(self.merged_name,
'w', encoding=
'utf-8')
as merged_file:
154 for log_name
in self.log_files:
155 if not os.path.isfile(log_name):
156 if self.warn_if_missing:
157 self.log.warning(
'Cannot open %s', log_name)
159 '### WARNING Missing {} ###\n'.
format(log_name))
161 with open(log_name, encoding=
'utf-8')
as log_file:
162 merged_file.write(
'### {} ###\n'.
format(log_name))
165 if log_name ==
'log.Derivation' or log_name ==
'log.AODtoDAOD':
166 for line
in log_file:
167 merged_file.write(line.replace(
'Selected dynamic Aux',
'Selected Dynamic Aux'))
169 for line
in log_file:
170 merged_file.write(line)
173 self.log.
error(
'%s merging failed due to OSError: %s',
174 self.name, e.strerror)
◆ process_extra_regex()
def python.TrigValSteering.CheckSteps.LogMergeStep.process_extra_regex |
( |
|
self | ) |
|
Definition at line 143 of file CheckSteps.py.
143 def process_extra_regex(self):
144 if self.extra_log_regex:
145 files = os.listdir(
'.')
146 r = re.compile(self.extra_log_regex)
147 match_files =
filter(r.match, files)
148 for f
in match_files:
◆ run()
def python.TrigValSteering.CheckSteps.LogMergeStep.run |
( |
|
self, |
|
|
|
dry_run = False |
|
) |
| |
Definition at line 177 of file CheckSteps.py.
177 def run(self, dry_run=False):
178 self.process_extra_regex()
180 self.log_files.sort(key=
lambda f : os.path.getmtime(f)
if os.path.isfile(f)
else 0)
181 self.log.
info(
'Running %s merging logs %s into %s',
182 self.name, self.log_files, self.merged_name)
186 self.result = self.merge_logs()
187 return self.result,
'# (internal) {} in={} out={}'.
format(self.name, self.log_files, self.merged_name)
◆ extra_log_regex
python.TrigValSteering.CheckSteps.LogMergeStep.extra_log_regex |
◆ log_files
python.TrigValSteering.CheckSteps.LogMergeStep.log_files |
◆ merged_name
python.TrigValSteering.CheckSteps.LogMergeStep.merged_name |
◆ result
python.TrigValSteering.CheckSteps.LogMergeStep.result |
◆ warn_if_missing
python.TrigValSteering.CheckSteps.LogMergeStep.warn_if_missing |
The documentation for this class was generated from the following file:
bool configure(asg::AnaToolHandle< ITrigGlobalEfficiencyCorrectionTool > &tool, ToolHandleArray< IAsgElectronEfficiencyCorrectionTool > &electronEffToolsHandles, ToolHandleArray< IAsgElectronEfficiencyCorrectionTool > &electronSFToolsHandles, ToolHandleArray< CP::IMuonTriggerScaleFactors > &muonToolsHandles, ToolHandleArray< IAsgPhotonEfficiencyCorrectionTool > &photonEffToolsHandles, ToolHandleArray< IAsgPhotonEfficiencyCorrectionTool > &photonSFToolsHandles, const std::string &triggers, const std::map< std::string, std::string > &legsPerTool, unsigned long nToys, bool debug)