From fc07d1f4796d1627d236eb6f9b277fd14c02031d Mon Sep 17 00:00:00 2001 From: Tadej Novak <tadej.novak@cern.ch> Date: Tue, 5 Jan 2021 13:57:07 +0100 Subject: [PATCH] Fix EventBookkeeperTools tests in AthAnalysis --- Event/EventBookkeeperTools/CMakeLists.txt | 10 ++++++---- Event/EventBookkeeperTools/python/CutFlowHelpers.py | 8 ++++++-- .../EventBookkeeperTools/share/TestCutFlowSvcOutput.py | 7 +++++-- 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/Event/EventBookkeeperTools/CMakeLists.txt b/Event/EventBookkeeperTools/CMakeLists.txt index 1ce5b56d397..35d4ceee59b 100644 --- a/Event/EventBookkeeperTools/CMakeLists.txt +++ b/Event/EventBookkeeperTools/CMakeLists.txt @@ -75,8 +75,10 @@ if( NOT XAOD_STANDALONE ) 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 ) + if( NOT XAOD_ANALYSIS ) + atlas_add_test( CutFlowSvcOutputMP + SCRIPT athena EventBookkeeperTools/TestCutFlowSvcOutput.py --nprocs=2 + PROPERTIES TIMEOUT 300 + POST_EXEC_SCRIPT nopost.sh ) + endif() endif() diff --git a/Event/EventBookkeeperTools/python/CutFlowHelpers.py b/Event/EventBookkeeperTools/python/CutFlowHelpers.py index deda3827fb6..2e6b78f0277 100644 --- a/Event/EventBookkeeperTools/python/CutFlowHelpers.py +++ b/Event/EventBookkeeperTools/python/CutFlowHelpers.py @@ -15,8 +15,12 @@ def GetCurrentStreamName( msg ): msg.info("Couldn't get input stream name from the RecFlags... trying AthFile directly.") from PyUtils.MetaReader import read_metadata - from AthenaCommon.AppMgr import ServiceMgr as svcMgr - input_file = svcMgr.EventSelector.InputCollections[0] + from AthenaCommon.AppMgr import ServiceMgr as svcMgr + try: + input_file = svcMgr.EventSelector.InputCollections[0] + except AttributeError: + from AthenaCommon.AthenaCommonFlags import athenaCommonFlags + input_file = athenaCommonFlags.FilesInput()[0] metadata = read_metadata(input_file) metadata = metadata[input_file] # promote all keys one level up diff --git a/Event/EventBookkeeperTools/share/TestCutFlowSvcOutput.py b/Event/EventBookkeeperTools/share/TestCutFlowSvcOutput.py index adf6506b2c8..f595e41d00a 100644 --- a/Event/EventBookkeeperTools/share/TestCutFlowSvcOutput.py +++ b/Event/EventBookkeeperTools/share/TestCutFlowSvcOutput.py @@ -43,8 +43,11 @@ from AthenaCommon.AppMgr import theApp import AthenaPoolCnvSvc.ReadAthenaPool # noqa: F401 # setup some configuration -from RecExConfig.RecFlags import rec -rec.mergingStreamName = 'Stream1' +try: + from RecExConfig.RecFlags import rec + rec.mergingStreamName = 'Stream1' +except ModuleNotFoundError: + pass # setup the CutFlowSvc and corresponding tools from EventBookkeeperTools.CutFlowHelpers import CreateCutFlowSvc -- GitLab