Loading [MathJax]/extensions/tex2jax.js
 |
ATLAS Offline Software
|
Go to the documentation of this file.
6 Definitions of exec steps (main job) in Trigger ART tests
12 from TrigValTools.TrigValSteering.Step
import Step
13 from TrigValTools.TrigValSteering.Input
import is_input_defined, get_input
18 Step executing the main job of a Trigger ART test. This can be either
19 athena or athenaHLT or a transform. There can be several ExecSteps in
64 self.log.
debug(
'Configuring step %s', self.
name)
75 self.log.
debug(
'Configuring type for step %s', self.
name)
78 self.misconfig_abort(
'Cannot configure a step without specified type or executable')
81 known_types = [
'athena',
'athenaHLT',
'Reco_tf',
'Trig_reco_tf',
'Derivation_tf']
82 if self.
type in known_types:
84 self.log.warning(
'type=%s was specified, so executable=%s '
85 'will be ignored and deduced automatically '
88 elif self.
type ==
'other' or self.
type is None:
91 self.misconfig_abort(
'Cannot determine type of this step')
95 if varname
in os.environ:
96 del os.environ[varname]
99 os.environ[
'TRF_NOECHO'] =
'1'
104 del_env(
'ATHENA_NPROC_NUM')
105 del_env(
'ATHENA_CORE_NUMBER')
108 self.log.
debug(
'Configuring input for step %s', self.
name)
109 if self.
input is None:
110 self.misconfig_abort(
111 'Input not provided for this step. To configure'
112 'a step without input, use an empty string')
115 if len(self.
input) == 0:
122 self.misconfig_abort(
'Failed to load input with keyword %s', self.
input)
127 for path
in input_paths:
128 if not os.path.isfile(path):
129 self.misconfig_abort(
'The provided input does not exist: %s', self.
input)
130 self.log.
debug(
'Using explicit input: %s', self.
input)
133 '''Check job options configuration'''
134 self.log.
debug(
'Configuring job options for step %s', self.
name)
135 if self.
type ==
'other':
136 self.log.
debug(
'Skipping job options check for step.type=other')
139 self.log.
debug(
'Skipping job options check for step running from a pickle file')
142 if self.
type.endswith(
'_tf'):
146 self.misconfig_abort(
'Transform %s does not accept job options', self.
type)
148 self.misconfig_abort(
'Job options not provided for this step')
151 '''Add preExec to transform command'''
153 if self.
type in [
'Reco_tf',
'Trig_reco_tf',
'Derivation_tf']:
154 if 'inputBS_RDOFile' in self.
args:
155 precommand =
'BSRDOtoRAW:' + precommand
156 elif 'outputRDO_TRIGFile' in self.
args or 'doRDO_TRIG' in self.
args:
157 precommand =
'RDOtoRDOTrigger:' + precommand
159 self.log.
debug(
'Skip adding precommand %s to step %s because it is a transform which '
160 'does not run Trigger', precommand, self.
name)
164 m = re.search(
r'--preExec\s*=?\s*', self.
args)
166 self.
args += f
' --preExec "{precommand}" '
170 self.
args = self.
args[:m.span()[0]] + f
' --preExec "{precommand}" ' + self.
args[m.span()[1]:]
173 self.log.
debug(
'Configuring args for step %s', self.
name)
174 if self.
args is None:
179 if self.
type ==
'Reco_tf' or self.
type ==
'Derivation_tf':
184 self.log.
debug(
'Disabling perfmon because forks=%d > 1', self.
forks)
189 self.log.
debug(
'Disabling perfmon for the transform step type %s', self.
type)
193 if self.
type !=
'other':
195 athenaopts +=
' --imf'
197 if self.
type ==
'athenaHLT':
198 athenaopts +=
' --perfmon'
199 elif self.
type ==
'athena':
200 athenaopts +=
' --perfmon=fastmonmt'
202 athenaopts +=
" --stdcmalloc "
205 if self.
type !=
'other':
207 self.
flags.
append(
'Trigger.CostMonitoring.monitorAllEvents=True')
214 if self.
type ==
'athenaHLT' or (self.
type ==
"other" and self.
executable ==
"athenaHLT.py") :
215 athenaopts +=
' --dump-config-exit'
217 elif self.
type ==
'athena' or self.
type ==
'Reco_tf' or self.
type ==
'Derivation_tf' or (self.
type ==
"other" and self.
executable ==
"athena.py") :
218 athenaopts +=
' --config-only=' + self.
name +
'.pkl'
223 self.misconfig_abort(
'Cannot determine what config-only option is needed. Consider adding the appropriate flag to "args" instead.')
226 if test.package_name ==
'TrigP1Test' and self.
type ==
'athenaHLT':
231 if self.
forks is None:
238 athenaopts +=
' --concurrent-events={}'.
format(
240 if self.
forks is not None:
244 athenaopts = athenaopts.strip()
245 if self.
type.endswith(
'_tf'):
246 self.
args +=
' --athenaopts="{}"'.
format(athenaopts)
248 self.
args +=
' '+athenaopts
252 if test.art_type ==
'build':
253 if test.package_name ==
'TrigP1Test':
268 if self.
type ==
'athena':
270 elif self.
type ==
'athenaHLT':
272 elif self.
type.endswith(
'_tf'):
275 if self.
type ==
'athena':
277 elif self.
type ==
'athenaHLT':
279 elif self.
type.endswith(
'_tf'):
283 if len(self.
input) > 0:
285 if self.
type ==
'athenaHLT':
290 input_str = self.
input
291 if self.
type ==
'athena':
292 self.
args +=
' --filesInput={}'.
format(input_str)
293 elif self.
type ==
'athenaHLT':
294 self.
args +=
''.
join([f
" --file={inputFile}" for inputFile
in input_str.split(
',')])
295 elif self.
type.endswith(
'_tf'):
297 self.misconfig_abort(
298 'Cannot build inputXYZFile string for transform '
299 ' from explicit input path. Use input=\'\' and '
300 'specify the input explicitly in args')
301 if self.
type ==
'Trig_reco_tf' and '--prodSysBSRDO True' in self.
args:
302 self.
args +=
' --inputBS_RDOFile={}'.
format(input_str)
314 if not isinstance(self.
flags, (list, tuple)):
315 self.misconfig_abort(
'Wrong type for flags. Expected list or tuple.')
317 if self.
type.endswith(
'_tf'):
318 if self.
type ==
'Trig_reco_tf':
Input get_input(const nlohmann::json &v)
def get_log_file_name(self)
def configure_job_options(self)
def __init__(self, name=None)
def configure(self, test)
std::string join(const std::vector< std::string > &v, const char c=',')
def add_trf_precommand(self, precommand)
def configure_input(self)
def configure_args(self, test)