6 Definitions of additional validation steps in Trigger ART tests relevant only for TrigP1Test.
7 The main common check steps are defined in the TrigValSteering.CheckSteps module.
10 from TrigValTools.TrigValSteering
import Step, CheckSteps
11 from TrigValTools.TrigValSteering.Common
import get_logger
19 Extra step based on grepping trigbs_dumpHLTContentInBS.py output
20 and comparing the line count to expected value
24 super(TrigBSDumpGrepStep, self).
__init__(name)
32 def run(self, dry_run=False):
34 self.log.
info(
'Skipping %s in dry run', self.name)
36 return self.
result,
'# (internal) {} -> skipped'.
format(self.name)
38 for ls_file
in os.listdir(
'.'):
42 self.log.
error(
'%s cannot find the BS output file', self.name)
46 return self.
result,
'# (internal) {} -> failed'.
format(self.name)
47 self.log.
debug(
'%s found BS file %s', self.name, file_name)
48 self.args +=
' ' + file_name
49 self.args +=
' | grep "{}" | wc -l'.
format(self.
regex)
53 ret, cmd = super(TrigBSDumpGrepStep, self).
run(dry_run)
57 self.log.
error(
'%s failed', self.name)
62 if not os.path.isfile(self.get_log_file_name()):
63 self.log.
error(
'%s failed, the file %s is missing',
64 self.name, self.get_log_file_name())
71 with open(self.get_log_file_name())
as log_file:
72 num = eval(log_file.read())
74 self.log.
error(
'%s failed the comparison', self.name)
81 compare_str =
''.
join(compare_str_list[1:])
82 compare_str = compare_str.strip()
83 self.log.
info(
'Comparison %s for num=%s gives True', compare_str, num)
92 Step which extracts the EXPERT directory from an online monitoring file
93 produced by OH server into an offline-like expert-monitoring.root
95 def __init__(self, name='ExtractExpertMonitoring'):
96 super(ExtractExpertMonitoring, self).
__init__(name)
105 super(ExtractExpertMonitoring, self).
configure(test)
109 '''Check a few important job options in the JSON file'''
113 with open(filename)
as f:
114 props = json.load(f)[
'properties']
116 def checkprop(comp, prop, regex):
117 value = props[comp][prop]
118 if re.match(regex, value)
is None:
119 log.error(
'Property "%s.%s" does not match "%s". Current value: "%s"', comp, prop, regex, value)
124 checkprop(
'IOVDbSvc',
'CacheAlign',
'0'),
125 checkprop(
'IOVDbSvc',
'CacheRun',
'0'),
126 checkprop(
'IOVDbSvc',
'CacheTime',
'0'),
127 checkprop(
'AtlasFieldMapCondAlg',
'LoadMapOnStart',
'True'),
128 checkprop(
'IOVDbSvc',
'Folders',
r'.*/TRIGGER/LUMI/HLTPrefLumi\s*<extensible/>.*'),
129 checkprop(
'IOVDbSvc',
'Folders',
r'.*/Indet/Onl/Beampos\s*<extensible/>.*'),
130 checkprop(
'IOVDbSvc',
'Folders',
r'.*/TRIGGER/HLT/PrescaleKey <tag>HEAD</tag>\s*<extensible/>.*'),
132 return 0
if all(checks)
else 1
139 hist_path_split = hist_path.split(
':')
140 if len(hist_path_split) > 1:
141 extract_hist.input_file = hist_path_split[0]
142 extract_hist.path_prefix = hist_path_split[1]
144 extract_hist.input_file = hist_path
145 steps.append(extract_hist)
147 steps.extend(CheckSteps.default_check_steps(test))
149 matches = [step
for step
in steps
if step.name ==
'HistMerge']
150 for hm_step
in matches:
151 steps.remove(hm_step)
155 '''Extract ByteStream data for a given stream from a file with multiple streams'''
156 from TrigValTools.TrigValSteering
import ExecStep
157 from TrigValTools.TrigValSteering.Common
import find_file
158 filterStep = ExecStep.ExecStep(
'FilterBS_'+stream_name)
159 filterStep.type =
'other'
160 filterStep.executable =
'trigbs_extractStream.py'
161 filterStep.input =
''
162 filterStep.args =
'-s ' + stream_name +
' ' +
find_file(
'*_HLTMPPy_output.*.data')
166 '''Deserialise HLT data from ByteStream and save to an ESD file'''
167 from TrigValTools.TrigValSteering
import ExecStep
168 from TrigValTools.TrigValSteering.Common
import find_file
169 decodeStep = ExecStep.ExecStep(
'DecodeBS_'+stream_name)
170 decodeStep.type =
'other'
171 decodeStep.executable =
'python'
172 decodeStep.input =
''
173 decodeStep.explicit_input =
True
174 decodeStep.args = f
'-m TrigP1Test.DecodeBS --moduleID={moduleID} --filesInput=' +
find_file(
'*'+stream_name+
'*._athenaHLT*.data')