From 3e89ef1a0d6e8fc7be718bdd63c63dcf477db7a1 Mon Sep 17 00:00:00 2001 From: Tadej Novak <tadej.novak@cern.ch> Date: Fri, 6 Nov 2020 14:52:00 +0100 Subject: [PATCH] Cleanup of CutFlowSvc tests --- Event/EventBookkeeperTools/CMakeLists.txt | 10 ++++++++++ .../share/TestCutFlowSvcDummyAlg.py | 8 ++++++-- .../EventBookkeeperTools/share/TestCutFlowSvcOutput.py | 9 +++++---- .../test/test_BookkeeperDumperTool.py | 4 ++-- Event/EventBookkeeperTools/test/test_CutFlowSvc.py | 9 +++++++-- 5 files changed, 30 insertions(+), 10 deletions(-) diff --git a/Event/EventBookkeeperTools/CMakeLists.txt b/Event/EventBookkeeperTools/CMakeLists.txt index 499dae3bd4a3..1ce5b56d3970 100644 --- a/Event/EventBookkeeperTools/CMakeLists.txt +++ b/Event/EventBookkeeperTools/CMakeLists.txt @@ -69,4 +69,14 @@ if( NOT XAOD_STANDALONE ) SCRIPT athena EventBookkeeperTools/TestCutFlowSvcOutput.py PROPERTIES TIMEOUT 300 POST_EXEC_SCRIPT nopost.sh ) + + atlas_add_test( CutFlowSvcOutputMT + SCRIPT athena EventBookkeeperTools/TestCutFlowSvcOutput.py --threads=2 + PROPERTIES TIMEOUT 300 + POST_EXEC_SCRIPT nopost.sh ) + + atlas_add_test( CutFlowSvcOutputMP + SCRIPT athena EventBookkeeperTools/TestCutFlowSvcOutput.py --nprocs=2 + PROPERTIES TIMEOUT 300 + POST_EXEC_SCRIPT nopost.sh ) endif() diff --git a/Event/EventBookkeeperTools/share/TestCutFlowSvcDummyAlg.py b/Event/EventBookkeeperTools/share/TestCutFlowSvcDummyAlg.py index 311c938002af..e6f2f6c99b2f 100644 --- a/Event/EventBookkeeperTools/share/TestCutFlowSvcDummyAlg.py +++ b/Event/EventBookkeeperTools/share/TestCutFlowSvcDummyAlg.py @@ -1,20 +1,24 @@ -# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration # setup the input from AthenaCommon.AthenaCommonFlags import athenaCommonFlags if 'inputFiles' in dir(): - athenaCommonFlags.FilesInput = inputFiles.split(',') + athenaCommonFlags.FilesInput = inputFiles.split(',') # noqa: F821 del inputFiles else: athenaCommonFlags.FilesInput = [ '/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/CommonInputs/mc16_13TeV.410501.PowhegPythia8EvtGen_A14_ttbar_hdamp258p75_nonallhad.merge.AOD.e5458_s3126_r9364_r9315/AOD.11182705._000001.pool.root.1' ] +# get a handle to the ApplicationManager +from AthenaCommon.AppMgr import theApp theApp.EvtMax = 10 +# setup basic sequencing from AthenaCommon.AlgSequence import AlgSequence topSequence = AlgSequence() +# setup old EventInfo conversion from xAODEventInfoCnv.xAODEventInfoCnvConf import xAODMaker__EventInfoCnvAlg topSequence += xAODMaker__EventInfoCnvAlg() diff --git a/Event/EventBookkeeperTools/share/TestCutFlowSvcOutput.py b/Event/EventBookkeeperTools/share/TestCutFlowSvcOutput.py index a4cce5c7e905..adf6506b2c8e 100644 --- a/Event/EventBookkeeperTools/share/TestCutFlowSvcOutput.py +++ b/Event/EventBookkeeperTools/share/TestCutFlowSvcOutput.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration ############################################################### # # Minimal athena options to execute the CutFlowSvc with algorithms @@ -12,16 +12,17 @@ #============================================================== # debug logging +from AthenaCommon.Constants import DEBUG from AthenaCommon.Logging import logging logging.getLogger('CreateCutFlowSvc').setLevel(DEBUG) # basic job configuration -import AthenaCommon.AtlasUnixStandardJob +import AthenaCommon.AtlasUnixStandardJob # noqa: F401 # setup the input from AthenaCommon.AthenaCommonFlags import athenaCommonFlags if 'inputFiles' in dir(): - athenaCommonFlags.FilesInput = inputFiles.split(',') + athenaCommonFlags.FilesInput = inputFiles.split(',') # noqa: F821 del inputFiles else: athenaCommonFlags.FilesInput = [ @@ -39,7 +40,7 @@ from AthenaCommon.AppMgr import ServiceMgr, ToolSvc from AthenaCommon.AppMgr import theApp # load POOL support -import AthenaPoolCnvSvc.ReadAthenaPool +import AthenaPoolCnvSvc.ReadAthenaPool # noqa: F401 # setup some configuration from RecExConfig.RecFlags import rec diff --git a/Event/EventBookkeeperTools/test/test_BookkeeperDumperTool.py b/Event/EventBookkeeperTools/test/test_BookkeeperDumperTool.py index e1b5f6b6ee21..824a05546f23 100755 --- a/Event/EventBookkeeperTools/test/test_BookkeeperDumperTool.py +++ b/Event/EventBookkeeperTools/test/test_BookkeeperDumperTool.py @@ -15,8 +15,8 @@ from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg from EventBookkeeperTools.EventBookkeeperToolsConfig import BookkeeperDumperToolCfg # Argument parsing -parser = ArgumentParser(prog='dump-cbk') -parser.add_argument('input', metavar='input', type=str, nargs='?', +parser = ArgumentParser(prog='test_BookkeeperDumpertool') +parser.add_argument('input', type=str, nargs='?', help='Specify the input file') args = parser.parse_args() diff --git a/Event/EventBookkeeperTools/test/test_CutFlowSvc.py b/Event/EventBookkeeperTools/test/test_CutFlowSvc.py index 26403c15b12d..9f54cc7e543b 100755 --- a/Event/EventBookkeeperTools/test/test_CutFlowSvc.py +++ b/Event/EventBookkeeperTools/test/test_CutFlowSvc.py @@ -17,8 +17,8 @@ from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg from EventBookkeeperTools.EventBookkeeperToolsConfig import CutFlowSvcCfg, CutFlowOutputList # Argument parsing -parser = ArgumentParser(prog='dump-cbk') -parser.add_argument('input', metavar='input', type=str, nargs='?', +parser = ArgumentParser(prog='test_CutFlowSvc') +parser.add_argument('input', type=str, nargs='?', help='Specify the input file') args = parser.parse_args() @@ -44,6 +44,11 @@ ConfigFlags.lock() # Setup service acc = MainServicesCfg(ConfigFlags) acc.merge(PoolReadCfg(ConfigFlags)) + +if 'EventInfo' not in ConfigFlags.Input.Collections: + from xAODEventInfoCnv.xAODEventInfoCnvConfig import EventInfoCnvAlgCfg + acc.merge(EventInfoCnvAlgCfg(ConfigFlags, disableBeamSpot=True)) + acc.merge(CutFlowSvcCfg(ConfigFlags)) acc.addEventAlgo(CompFactory.TestFilterReentrantAlg("TestReentrant1", FilterKey="TestReentrant1", Modulo=2)) acc.addEventAlgo(CompFactory.TestFilterReentrantAlg("TestReentrant2", FilterKey="TestReentrant2", Modulo=4)) -- GitLab