Skip to content
Snippets Groups Projects
Commit 6f121e07 authored by Benjamin Philip Kerridge's avatar Benjamin Philip Kerridge
Browse files

Merge branch 'condtest' into '22.0'

TrigP1Test: add ART test for stop/start conditions loading

See merge request !55689
parents a80b6fbe 20d3d96c
4 merge requests!69091Fix correlated smearing bug in JER in JetUncertainties in 22.0,!58791DataQualityConfigurations: Modify L1Calo config for web display,!55795Daily "22.0 to master" sweep: 10/08/22,!55689TrigP1Test: add ART test for stop/start conditions loading
#!/usr/bin/env python
#
# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
#
# Script to create an AthenaAttributeList with a single attribute "xint".
# Usage example: dmtest_condwriter.py --rs=1 --ls=1 'sqlite://;schema=test.db;dbname=OFLP200' AttrList_noTag 42
#
from __future__ import print_function
import sys,os
os.environ['CLING_STANDARD_PCH'] = 'none' #See bug ROOT-10789
from PyCool import cool
......@@ -19,22 +17,21 @@ class createTestDB(AtlCoolLib.coolTool):
# set values of non-optional parameters
self.tag=str(args[0])
self.xint=int(args[1])
self.folder=args[2] if len(args)>2 else '/DMTest/TestAttrList'
def usage(self):
""" Define the additional syntax for options """
self._usage1()
print ('TAG xint')
print ('TAG xint [Folder]')
self._usage2()
def execute(self):
folder='/DMTest/TestAttrList'
# do update - setup folder specification and create if needed
spec = cool.RecordSpecification()
spec.extend("xint", cool.StorageType.Int32)
print (">== Store object in folder",folder)
cfolder = AtlCoolLib.ensureFolder(self.db, folder, spec,
print (">== Store object in folder", self.folder)
cfolder = AtlCoolLib.ensureFolder(self.db, self.folder, spec,
AtlCoolLib.athenaDesc(self.runLumi, 'AthenaAttributeList'),
cool.FolderVersioning.MULTI_VERSION)
if (cfolder is None): sys.exit(1)
......@@ -56,6 +53,6 @@ class createTestDB(AtlCoolLib.coolTool):
# print full content
act = AtlCoolTool.AtlCoolTool(self.db)
print (act.more(folder))
print (act.more(self.folder))
mytool = createTestDB('dmtest_condwriter.py',False,3,3,[])
mytool = createTestDB('dmtest_condwriter.py',False,3,4,[])
x os.system("rm -f cond.db")
x os.system("dmtest_condwriter.py --rs 360026 'sqlite://;schema=cond.db;dbname=CONDBR2' HEAD 10 /DMTest/TestAttrList")
x os.system("dmtest_condwriter.py --ts 0 'sqlite://;schema=cond.db;dbname=CONDBR2' HEAD 100 /DMTest/TestAttrListTime")
f
f
f
b
x os.system("dmtest_condwriter.py --rs 360027 'sqlite://;schema=cond.db;dbname=CONDBR2' HEAD 20 /DMTest/TestAttrList")
x os.system("dmtest_condwriter.py --ts 2000000000 'sqlite://;schema=cond.db;dbname=CONDBR2' HEAD 200 /DMTest/TestAttrListTime")
x os.remove('raw.data'); os.symlink('cond._0001.data','raw.data')
f
b
b
b
e
# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
#
# Test stop/start for conditions that are updated during the run.
#
from AthenaCommon.AlgSequence import AlgSequence, AthSequencer
#--------------------------------------------------------------
# Conditions setup.
#--------------------------------------------------------------
from IOVDbSvc.CondDB import conddb
from AthenaCommon.GlobalFlags import globalflags
globalflags.DataSource = 'data'
globalflags.ConditionsTag = 'CONDBR2-HLTP-2018-01'
conddb.setGlobalTag(globalflags.ConditionsTag())
# These folders are filled in Testing/condStopStart.trans
conddb.addFolder ('cond.db', '/DMTest/TestAttrList <tag>HEAD</tag>',
className='AthenaAttributeList')
conddb.addFolder ('cond.db', '/DMTest/TestAttrListTime <tag>HEAD</tag>',
className='AthenaAttributeList')
#--------------------------------------------------------------
# Setup AlgSequence
#--------------------------------------------------------------
from DataModelTestDataCommon.DataModelTestDataCommonConf import (DMTest__CondReaderAlg,
DMTest__CondAlg1)
topSequence = AlgSequence()
condSeq = AthSequencer("AthCondSeq")
# Required by CondReaderAlg
topSequence.SGInputLoader.Load += [( 'xAOD::EventInfo' , 'StoreGateSvc+EventInfo' )]
# Reader for run-based and time-based folders
topSequence += DMTest__CondReaderAlg( "CondReaderAlg1",
AttrListKey = "/DMTest/TestAttrList",
S2Key = "")
topSequence += DMTest__CondReaderAlg( "CondReaderAlg2",
AttrListKey = "/DMTest/TestAttrListTime",
S2Key = "")
# A dummy CondAlg
condSeq += DMTest__CondAlg1()
CondReaderAlg1 1 0 INFO xint xint (int) : 10
CondReaderAlg2 1 0 INFO xint xint (int) : 100
CondReaderAlg1 2 0 INFO xint xint (int) : 10
CondReaderAlg2 2 0 INFO xint xint (int) : 100
CondReaderAlg1 3 0 INFO xint xint (int) : 10
CondReaderAlg2 3 0 INFO xint xint (int) : 100
CondReaderAlg1 4 0 INFO xint xint (int) : 10
CondReaderAlg2 4 0 INFO xint xint (int) : 100
CondReaderAlg1 5 0 INFO xint xint (int) : 10
CondReaderAlg2 5 0 INFO xint xint (int) : 100
CondReaderAlg1 1 0 INFO xint xint (int) : 20
CondReaderAlg2 1 0 INFO xint xint (int) : 200
CondReaderAlg1 2 0 INFO xint xint (int) : 20
CondReaderAlg2 2 0 INFO xint xint (int) : 200
CondReaderAlg1 3 0 INFO xint xint (int) : 20
CondReaderAlg2 3 0 INFO xint xint (int) : 200
CondReaderAlg1 4 0 INFO xint xint (int) : 20
CondReaderAlg2 4 0 INFO xint xint (int) : 200
CondReaderAlg1 5 0 INFO xint xint (int) : 20
CondReaderAlg2 5 0 INFO xint xint (int) : 200
#!/usr/bin/env python
# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
# art-description: test reloading of conditions during stop/start
# art-type: build
# art-include: master/Athena
# art-include: 22.0/Athena
# Skipping art-output which has no effect for build tests.
# If you create a grid version, check art-output in existing grid tests.
# This test simulates conditions changes between runs, i.e. between stop/start
# transitions like it would happen at P1. In order to be able to increment the run
# number we employ a rather nasty trick:
# 1) the first run is done on the regular input file symlinked to raw.data
# 2) after stop, we switch the symlink to a copy of the file with the
# run number and timestamp increased
#
# The files are prepared here, and the symlinking and writing of conditions
# happens in Testing/condStopStart.trans. The expected outcome is:
# 1st run: xint = 10 (Run/LB IOV) and 100 (Timebased IOV)
# 2nd run: xint = 20 (Run/LB IOV) and 200 (Timebased IOV)
#
from TrigValTools.TrigValSteering import Test, Step, ExecStep, CheckSteps
from TrigValTools.TrigValSteering.Input import get_input
import os
import eformat
# Create a symlink to the first input file
input_file = get_input('data').paths[0]
first_event = eformat.istream(input_file)[0]
run_no = first_event.run_no()
try:
os.remove('raw.data')
except Exception:
pass
os.symlink(input_file, 'raw.data')
# Delete any previous bytestream file
ex_rm = ExecStep.ExecStep('cleanup')
ex_rm.type = 'other'
ex_rm.input = ''
ex_rm.executable = 'rm'
ex_rm.args = '-f cond*.data'
ex_rm.auto_report_result = False # Do not set art-result for this step
ex_rm.output_stream = Step.Step.OutputStream.STDOUT_ONLY # Do not create a log file for this step
# Make a copy of input BS file with increased run number and timestamp
t_future = 2000000000 # in the future, needs to match condStopStart.trans
ex_bs = ExecStep.ExecStep('create_bs')
ex_bs.type = 'other'
ex_bs.input = ''
ex_bs.executable = 'trigbs_modifyEvent.py'
ex_bs.args = f'-r {run_no+1} -t {t_future} -n 5 -o cond {input_file}'
ex = ExecStep.ExecStep()
ex.type = 'athenaHLT'
ex.job_options = 'TrigP1Test/testHLT_condStopStart.py'
ex.input = ''
ex.max_events = 5
ex.args = '-f raw.data -i -M -ul'
ex.perfmon = False
# Pass the transitions file into athenaHLT -i
ex.cmd_suffix = ' < `find_data.py condStopStart.trans`'
test = Test.Test()
test.art_type = 'build'
test.exec_steps = [ex_rm, ex_bs, ex]
test.check_steps = CheckSteps.default_check_steps(test)
# Extra merging pattern for logs produced with -ul option
logmerge = test.get_step("LogMerge")
logmerge.extra_log_regex = 'athenaHLT-.*-.*(.out|.err)'
# Compare to reference
refcomp = CheckSteps.RegTestStep('RegTest')
refcomp.regex = 'CondReaderAlg.*xint'
refcomp.reference = 'TrigP1Test/test_trigP1_condStopStart.ref'
refcomp.required = True # Final exit code depends on this step
test.check_steps.insert(-1, refcomp) # Add before the last (zip) step
import sys
sys.exit(test.run())
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment