Commit ca470e52 authored by Adam Edward Barton's avatar Adam Edward Barton
Browse files

Merge branch 'trigval-improvements' into 'master'

Various small improvements in TriggerValidation

See merge request !30540
parents 09c0a961 77852524
......@@ -7,7 +7,7 @@ Definitions of additional validation steps in Trigger ART tests relevant only fo
The main common check steps are defined in the TrigValSteering.CheckSteps module.
'''
from TrigValTools.TrigValSteering import Step
from TrigValTools.TrigValSteering import Step, CheckSteps
import os
import inspect
......@@ -83,3 +83,41 @@ class TrigBSDumpGrepStep(Step.Step):
if self.auto_report_result:
self.report_result()
return self.result, cmd
class ExtractExpertMonitoring(CheckSteps.InputDependentStep):
'''
Step which extracts the EXPERT directory from an online monitoring file
produced by OH server into an offline-like expert-monitoring.root
'''
def __init__(self, name='ExtractExpertMonitoring'):
super(ExtractExpertMonitoring, self).__init__(name)
self.input_file = None
self.path_prefix = None
self.executable = 'rootcp'
self.args = '--recreate -r'
self.output_stream = Step.Step.OutputStream.STDOUT_ONLY
def configure(self, test):
self.args += ' {:s}:{:s}/HLT-Histogramming/*/EXPERT/* expert-monitoring.root'.format(self.input_file, self.path_prefix or '')
super(ExtractExpertMonitoring, self).configure(test)
def default_check_steps_OHMon(test, hist_path):
steps = []
# Extract expert-monitoring.root file from OH server output
extract_hist = ExtractExpertMonitoring()
hist_path_split = hist_path.split(':')
if len(hist_path_split) > 1:
extract_hist.input_file = hist_path_split[0]
extract_hist.path_prefix = hist_path_split[1]
else:
extract_hist.input_file = hist_path
steps.append(extract_hist)
# Default check steps
steps.extend(CheckSteps.default_check_steps(test))
# Remove histogram merging step
matches = [step for step in steps if step.name == 'HistMerge']
for hm_step in matches:
steps.remove(hm_step)
return steps
......@@ -4,7 +4,8 @@
# art-type: build
# art-include: master/Athena
from TrigValTools.TrigValSteering import Input, Test, Step, ExecStep, CheckSteps
from TrigValTools.TrigValSteering import Input, Test, Step, ExecStep
from TrigP1Test import TrigP1TestSteps
# Input file
f = Input.get_input('data').paths[0].encode('ascii', 'ignore')
......@@ -45,11 +46,7 @@ ex.perfmon = False # Cannot use PerfMon with -M
test = Test.Test()
test.art_type = 'build'
test.exec_steps = [ex_rm, ex_bs, ex]
test.check_steps = CheckSteps.default_check_steps(test)
# Overwrite default histogram file name for checks
for step in [test.get_step(name) for name in ['HistCount', 'RootComp', 'ChainDump']]:
step.input_file = 'r0000999999_athenaHLT_HLT-Histogramming.root'
test.check_steps = TrigP1TestSteps.default_check_steps_OHMon(test, 'r0000999999_athenaHLT_HLT-Histogramming.root:run_999999/lb_-1')
import sys
sys.exit(test.run())
......@@ -6,7 +6,8 @@
# Skipping art-output which has no effect for build tests.
# If you create a grid version, check art-output in existing grid tests.
from TrigValTools.TrigValSteering import Test, ExecStep, CheckSteps
from TrigValTools.TrigValSteering import Test, ExecStep
from TrigP1Test import TrigP1TestSteps
ex = ExecStep.ExecStep()
ex.type = 'athenaHLT'
......@@ -18,11 +19,7 @@ ex.perfmon = False # perfmon currently not fully supported with athenaHLT -M
test = Test.Test()
test.art_type = 'build'
test.exec_steps = [ex]
test.check_steps = CheckSteps.default_check_steps(test)
# Overwrite default histogram file name for checks
for step in [test.get_step(name) for name in ['HistCount', 'RootComp', 'ChainDump']]:
step.input_file = 'r0000327265_athenaHLT_HLT-Histogramming.root'
test.check_steps = TrigP1TestSteps.default_check_steps_OHMon(test, 'r0000360026_athenaHLT_HLT-Histogramming.root:run_360026/lb_-1')
import sys
sys.exit(test.run())
......@@ -6,7 +6,8 @@
# Skipping art-output which has no effect for build tests.
# If you create a grid version, check art-output in existing grid tests.
from TrigValTools.TrigValSteering import Test, ExecStep, CheckSteps
from TrigValTools.TrigValSteering import Test, ExecStep
from TrigP1Test import TrigP1TestSteps
ex = ExecStep.ExecStep()
ex.type = 'athenaHLT'
......@@ -21,7 +22,7 @@ ex.job_options += ' < `find_data.py run-stop-run-saveHist.trans`'
test = Test.Test()
test.art_type = 'build'
test.exec_steps = [ex]
test.check_steps = CheckSteps.default_check_steps(test)
test.check_steps = TrigP1TestSteps.default_check_steps_OHMon(test, 'run_2.root')
# Extra merging pattern for logs produced with -ul option
logmerge = test.get_step("LogMerge")
......
......@@ -4,7 +4,8 @@
# art-type: build
# art-include: master/Athena
from TrigValTools.TrigValSteering import Input, Test, Step, ExecStep, CheckSteps
from TrigValTools.TrigValSteering import Input, Test, Step, ExecStep
from TrigP1Test import TrigP1TestSteps
# Input file
f = Input.get_input('data').paths[0].encode('ascii', 'ignore')
......@@ -46,11 +47,7 @@ ex.perfmon = False # Cannot use PerfMon with -M
test = Test.Test()
test.art_type = 'build'
test.exec_steps = [ex_rm, ex_bs, ex]
test.check_steps = CheckSteps.default_check_steps(test)
# Overwrite default histogram file name for checks
for step in [test.get_step(name) for name in ['HistCount', 'RootComp', 'ChainDump']]:
step.input_file = 'r0000999999_athenaHLT_HLT-Histogramming.root'
test.check_steps = TrigP1TestSteps.default_check_steps_OHMon(test, 'r0000999999_athenaHLT_HLT-Histogramming.root:run_999999/lb_-1')
import sys
sys.exit(test.run())
......@@ -6,7 +6,8 @@
# Skipping art-output which has no effect for build tests.
# If you create a grid version, check art-output in existing grid tests.
from TrigValTools.TrigValSteering import Test, ExecStep, CheckSteps
from TrigValTools.TrigValSteering import Test, ExecStep
from TrigP1Test import TrigP1TestSteps
ex = ExecStep.ExecStep()
ex.type = 'athenaHLT'
......@@ -21,7 +22,7 @@ ex.job_options += ' < `find_data.py run-stop-run-saveHist.trans`'
test = Test.Test()
test.art_type = 'build'
test.exec_steps = [ex]
test.check_steps = CheckSteps.default_check_steps(test)
test.check_steps = TrigP1TestSteps.default_check_steps_OHMon(test, 'run_2.root')
# Extra merging pattern for logs produced with -ul option
logmerge = test.get_step("LogMerge")
......
......@@ -110,7 +110,7 @@ fi
if [ -f ${REGTESTREF} ]; then
echo $(date "+%FT%H:%M %Z")" Running regtest using reference file ${REGTESTREF}"
timeout 5m regtest.pl --inputfile ${REGTESTREF_BASENAME} --reffile ${REGTESTREF} --linematch ".*" 2>&1 | tee regtest.log
timeout 5m regtest.py --inputfile ${REGTESTREF_BASENAME} --reffile ${REGTESTREF} --linematch ".*" 2>&1 | tee regtest.log
echo "art-result: ${PIPESTATUS[0]} RegTest"
else
echo $(date "+%FT%H:%M %Z")" The reference file does not exist: ${REGTESTREF}"
......
......@@ -12,6 +12,7 @@ import re
import subprocess
import json
import six
import glob
from TrigValTools.TrigValSteering.Step import Step
from TrigValTools.TrigValSteering.Common import art_input_eos, art_input_cvmfs
......@@ -183,6 +184,12 @@ class RootMergeStep(Step):
old_name = os.path.splitext(self.merged_file)
new_name = old_name[0] + self.rename_suffix + old_name[1]
self.executable = 'mv {} {}; {}'.format(self.merged_file, new_name, self.executable)
file_list = self.input_file.split()
for file_name in file_list:
if len(glob.glob(file_name)) < 1:
self.log.warning('%s: file %s requested to be merged but does not exist', self.name, file_name)
self.result = 1
return self.result, '# (internal) {} in={} out={} -> failed'.format(self.name, self.input_file, self.merged_file)
return super(RootMergeStep, self).run(dry_run)
......@@ -251,7 +258,7 @@ class RegTestStep(RefComparisonStep):
def __init__(self, name='RegTest'):
super(RegTestStep, self).__init__(name)
self.regex = 'REGTEST'
self.executable = 'regtest.pl'
self.executable = 'regtest.py'
self.input_base_name = 'athena'
self.args += ' --linematch ".*"'
self.auto_report_result = True
......@@ -486,6 +493,7 @@ class ZeroCountsStep(Step):
super(ZeroCountsStep, self).__init__(name)
self.input_file = 'HLTChain.txt,HLTTE.txt,L1AV.txt'
self.auto_report_result = True
self.required = True
self.__input_files__ = None
def configure(self, test=None):
......@@ -605,6 +613,15 @@ class MessageCountStep(Step):
return self.result, cmd
def produces_log(step):
'''
Helper function checking whether a Step output_stream value
indicates that it will produce a log file
'''
return step.output_stream == Step.OutputStream.FILE_ONLY or \
step.output_stream == Step.OutputStream.FILE_AND_STDOUT
def default_check_steps(test):
'''
Create the default list of check steps for a test. The configuration
......@@ -617,7 +634,7 @@ def default_check_steps(test):
# Log merging
if len(test.exec_steps) == 1:
exec_step = test.exec_steps[0]
if exec_step.type == 'athenaHLT':
if exec_step.type == 'athenaHLT' and produces_log(exec_step):
logmerge = LogMergeStep()
logmerge.merged_name = 'athena.log'
logmerge.log_files = ['athenaHLT.log']
......@@ -631,6 +648,8 @@ def default_check_steps(test):
logmerge.merged_name = 'athena.log'
logmerge.log_files = []
for exec_step in test.exec_steps:
if not produces_log(exec_step):
continue
logmerge.log_files.append(exec_step.get_log_file_name())
if exec_step.type == 'athenaHLT':
logmerge.extra_log_regex = 'athenaHLT:.*(.out|.err)'
......@@ -647,7 +666,7 @@ def default_check_steps(test):
reco_tf_logmerge = LogMergeStep('LogMerge_Reco_tf')
reco_tf_logmerge.warn_if_missing = False
tf_names = ['HITtoRDO', 'RDOtoRDOTrigger', 'RAWtoESD', 'ESDtoAOD',
'PhysicsValidation', 'RAWtoALL', 'BSFTKCreator']
'PhysicsValidation', 'RAWtoALL']
reco_tf_logmerge.log_files = ['log.'+tf_name for tf_name in tf_names]
reco_tf_logmerge.merged_name = 'athena.merged.log'
log_to_zip = reco_tf_logmerge.merged_name
......@@ -689,7 +708,7 @@ def default_check_steps(test):
if log_to_check is not None:
regtest.input_base_name = os.path.splitext(log_to_check)[0]
if 'athenaHLT' in step_types:
regtest.regex = r'(?:HltEventLoopMgr(?!.*athenaHLT-)|REGTEST)'
regtest.regex = r'(?:HltEventLoopMgr(?!.*athenaHLT-)(?!.*DF_Pid)|REGTEST)'
check_steps.append(regtest)
# Tail (probably not so useful these days)
......
......@@ -71,7 +71,7 @@ grep REGTEST athena.log > athena.regtest
if [ -f ${REF_FOLDER}/athena.regtest ]; then
echo $(date "+%FT%H:%M %Z")" Running regtest"
timeout 5m regtest.pl --inputfile athena.regtest --reffile ${REF_FOLDER}/athena.regtest 2>&1 | tee regtest.log
timeout 5m regtest.py --inputfile athena.regtest --reffile ${REF_FOLDER}/athena.regtest 2>&1 | tee regtest.log
echo "art-result: ${PIPESTATUS[0]} RegTest"
else
echo $(date "+%FT%H:%M %Z")" No reference athena.regtest found in ${REF_FOLDER}"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment