diff --git a/Control/AthenaExamples/AthExJobOptions/python/CustomToolUsingTool.py b/Control/AthenaExamples/AthExJobOptions/python/CustomToolUsingTool.py index 4efd723bf46f507920faeb7518f38facb2d16895..cd43112a3d92d9043dce353b41077f2b331676cc 100755 --- a/Control/AthenaExamples/AthExJobOptions/python/CustomToolUsingTool.py +++ b/Control/AthenaExamples/AthExJobOptions/python/CustomToolUsingTool.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration # File: AthExJobOptions/CustomToolUsingTool.py # Author: Wim Lavrijsen (WLavrijsen@lbl.gov) @@ -9,9 +9,7 @@ __author__ = 'Wim Lavrijsen (WLavrijsen@lbl.gov)' __all__ = [ 'CustomToolUsingTool' ] -# Get our base class (was generated by genConf; note that the package name is -# not necessary if both classes reside in the same directory) -from AthExJobOptionsConf import ToolUsingTool +from .AthExJobOptionsConf import ToolUsingTool # Customized class, enable through derivation @@ -30,5 +28,5 @@ class CustomToolUsingTool( ToolUsingTool ): handle.Factor = 42. # best, is considered default if not hasattr( handle, 'TheToolTool' ): - from AthExJobOptionsConf import ConcreteTool + from .AthExJobOptionsConf import ConcreteTool handle.TheToolTool = ConcreteTool( 'ToolTool' ) diff --git a/Control/AthenaExamples/AthExJobOptions/python/CustomToolUsingTool2.py b/Control/AthenaExamples/AthExJobOptions/python/CustomToolUsingTool2.py index ec6130ccba3d30c1cc505ceff457eac342b5b854..3b4e3579fb2c6e7002fed26ff8263613274771c4 100755 --- a/Control/AthenaExamples/AthExJobOptions/python/CustomToolUsingTool2.py +++ b/Control/AthenaExamples/AthExJobOptions/python/CustomToolUsingTool2.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration # File: AthExJobOptions/CustomToolUsingTool2.py # Author: Wim Lavrijsen (WLavrijsen@lbl.gov) @@ -13,14 +13,14 @@ __all__ = [ 'CustomToolUsingTool2' ] class CustomToolUsingTool2( object ): def __new__( cls, name = 'CustomToolUsingTool2' ): # first, look for already fully customized instance - from AthExJobOptionsConf import ToolUsingTool + from .AthExJobOptionsConf import ToolUsingTool try: return ToolUsingTool.configurables[ name ] except KeyError: pass # else, request a new instance, and add customization - from AthExJobOptionsConf import ConcreteTool + from .AthExJobOptionsConf import ConcreteTool tool = ToolUsingTool( name ) tool.Factor = 42. diff --git a/Control/AthenaExamples/AthExJobOptions/python/CustomTopAlgorithm.py b/Control/AthenaExamples/AthExJobOptions/python/CustomTopAlgorithm.py index 6b10b29f36a06fb68e0fd272d89a32ca692ab495..959f5214ccd02cb3858121709728b46b6d0a1723 100755 --- a/Control/AthenaExamples/AthExJobOptions/python/CustomTopAlgorithm.py +++ b/Control/AthenaExamples/AthExJobOptions/python/CustomTopAlgorithm.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration ## @file CustomTopAlgorithm.py @@ -11,9 +11,7 @@ __author__ = 'Wim Lavrijsen (WLavrijsen@lbl.gov)' __all__ = [ 'CustomTopAlgorithm' ] -# Get our base class (was generated by genConf; note that the package name is -# not necessary if both classes reside in the same directory) -from AthExJobOptionsConf import TopAlgorithm +from .AthExJobOptionsConf import TopAlgorithm ## @class CustomTopAlgorithm # @brief Customizer class for TopAlgorithm, enabled through derivation @@ -36,5 +34,5 @@ class CustomTopAlgorithm( TopAlgorithm ): # make sure one tool is always selected if not hasattr( handle, 'TheTool' ): - from AthExJobOptionsConf import ConcreteTool + from .AthExJobOptionsConf import ConcreteTool handle.TheTool = ConcreteTool() diff --git a/Control/AthenaExamples/AthExJobOptions/share/AthExJobOptions_BasicJobOptions.py b/Control/AthenaExamples/AthExJobOptions/share/AthExJobOptions_BasicJobOptions.py index 3d681b48812ad91386fe578fa36fa15fe498c327..b085fb4978b9b3e241da30784cb048fbc16df7b0 100755 --- a/Control/AthenaExamples/AthExJobOptions/share/AthExJobOptions_BasicJobOptions.py +++ b/Control/AthenaExamples/AthExJobOptions/share/AthExJobOptions_BasicJobOptions.py @@ -116,6 +116,6 @@ for alg in job: setdebug(alg) # Print the final job for reference purposes -print job +printfunc (job) # End of AthExJobOptions_BasicJobOptions.py diff --git a/Control/AthenaExamples/AthExJobOptions/share/AthExJobOptions_CustomToolJobOptions.py b/Control/AthenaExamples/AthExJobOptions/share/AthExJobOptions_CustomToolJobOptions.py index bc55ed09d8c438814424c45e9849022ada72f6dd..a002e64380518728db6e490daf02713973cb77b0 100755 --- a/Control/AthenaExamples/AthExJobOptions/share/AthExJobOptions_CustomToolJobOptions.py +++ b/Control/AthenaExamples/AthExJobOptions/share/AthExJobOptions_CustomToolJobOptions.py @@ -22,7 +22,7 @@ job.MyTopAlg.TheTool.Factor = 14. # Another custom configured tool to use from AthExJobOptions.CustomToolUsingTool2 import CustomToolUsingTool2 job += TopAlgorithm( 'YourTopAlg' ) -print job.YourTopAlg.properties() +printfunc (job.YourTopAlg.properties()) job.YourTopAlg.OutputKey = 'YourKey' job.YourTopAlg.TheTool = CustomToolUsingTool2( 'CustomTool2' ) job.YourTopAlg.TheTool.Factor = 18. @@ -36,6 +36,6 @@ job.YourTopAlg.TheTool.Factor = 18. theApp.EvtMax = 2 # Print the final job for reference purposes -print job +printfunc (job) # End of AthExJobOptions_CustomTopAlgorithmJobOptions.py diff --git a/Control/AthenaExamples/AthExJobOptions/share/AthExJobOptions_CustomTopAlgorithmJobOptions.py b/Control/AthenaExamples/AthExJobOptions/share/AthExJobOptions_CustomTopAlgorithmJobOptions.py index c8bc6a8e96e347ccf6379d4a8eb7fb6a10cc6343..73d7d388760e37c06fec897d362ab3ed274101f1 100755 --- a/Control/AthenaExamples/AthExJobOptions/share/AthExJobOptions_CustomTopAlgorithmJobOptions.py +++ b/Control/AthenaExamples/AthExJobOptions/share/AthExJobOptions_CustomTopAlgorithmJobOptions.py @@ -26,6 +26,6 @@ assert( job.MyCustomAlg.RndmFactor == 33. ) theApp.EvtMax = 2 # Print the final job for reference purposes -print job +printfunc (job) # End of AthExJobOptions_CustomTopAlgorithmJobOptions.py diff --git a/Control/StoreGateTests/python/Lib.py b/Control/StoreGateTests/python/Lib.py index df21e2598b8afce0b996ac48f33a2a1da4a03e7c..c3e5b830ecf532854c68aab1d6ecae21be4b2147 100644 --- a/Control/StoreGateTests/python/Lib.py +++ b/Control/StoreGateTests/python/Lib.py @@ -175,6 +175,9 @@ class PyClidsTestWriter(PyAthena.Alg): if not allGood: return StatusCode.Failure self.sg.dump() + import sys + sys.stdout.flush() + sys.stderr.flush() return self.testReadBack() diff --git a/Control/StoreGateTests/share/tests/atn_test_sgProducerConsumerDataPool_jobOptions.py b/Control/StoreGateTests/share/tests/atn_test_sgProducerConsumerDataPool_jobOptions.py index 2eac1a7bf6cd018e115e406b687de4dd45c9ae89..7c2428080a152a7e8464a8be96c0afcc6e6f58f6 100644 --- a/Control/StoreGateTests/share/tests/atn_test_sgProducerConsumerDataPool_jobOptions.py +++ b/Control/StoreGateTests/share/tests/atn_test_sgProducerConsumerDataPool_jobOptions.py @@ -1,11 +1,15 @@ #!/usr/bin/env python -import user +from __future__ import print_function + import os import sys -import commands from AthenaCommon import ChapPy +from future import standard_library +standard_library.install_aliases() +import subprocess + ###----------------------------------------------------- ## For compatibility with ATN tests from TestTools.iobench import workDir @@ -15,10 +19,10 @@ from TestTools.iobench import workDir from TestTools.iobench import ScOutput from TestTools.iobench import BenchSequence -print "#"*80 -print "## StoreGate test... [producer/consumer-DataPool-bench]" -print "#"*80 -print "::: No DataPool ", +print ("#"*80) +print ("## StoreGate test... [producer/consumer-DataPool-bench]") +print ("#"*80) +print ("::: No DataPool ", end='') athena = ChapPy.Athena( jobOptions = [ ChapPy.JobOptionsCmd( "SGDATAPOOL=False" ), @@ -29,10 +33,10 @@ athena = ChapPy.Athena( athena.EvtMax = 100 sc = athena.run() if sc != 0: - print "ERROR" + print ("ERROR") sys.exit(sc) -print "::: With DataPool ", +print ("::: With DataPool ", end='') athena = ChapPy.Athena( jobOptions = [ ChapPy.JobOptionsCmd( "SGDATAPOOL=True" ), @@ -43,19 +47,19 @@ athena = ChapPy.Athena( athena.EvtMax = 100 sc = athena.run() if sc != 0: - print "ERROR" + print ("ERROR") sys.exit(sc) -sc,out = commands.getstatusoutput( +sc,out = subprocess.getstatusoutput( "perfmon.py %s %s -o %s -l dp,nodp -s \"m.name!=''\"" % ( "withdatapool.pmon.gz", "nodatapool.pmon.gz", "datapool.root" ) ) -print "All tests SUCCESSFULLY completed" +print ("All tests SUCCESSFULLY completed") -print "" -print "#"*80 -print "## Bye." -print "#"*80 +print ("") +print ("#"*80) +print ("## Bye.") +print ("#"*80) diff --git a/Control/StoreGateTests/share/tests/atn_test_sgProducerConsumer_jobOptions.py b/Control/StoreGateTests/share/tests/atn_test_sgProducerConsumer_jobOptions.py index 4ecfc886b0aed8bd9de4369fe56e2ea526e883d4..816c8b03b0db0da0a14ec37d37906fc75a5c3a08 100755 --- a/Control/StoreGateTests/share/tests/atn_test_sgProducerConsumer_jobOptions.py +++ b/Control/StoreGateTests/share/tests/atn_test_sgProducerConsumer_jobOptions.py @@ -1,11 +1,15 @@ #!/usr/bin/env python -import user +from __future__ import print_function + import os import sys -import commands from AthenaCommon import ChapPy +from future import standard_library +standard_library.install_aliases() +import subprocess + ###----------------------------------------------------- ## For compatibility with ATN tests from TestTools.iobench import workDir @@ -15,22 +19,22 @@ from TestTools.iobench import workDir from TestTools.iobench import ScOutput from TestTools.iobench import BenchSequence -print "#"*80 -print "## StoreGate test... [producer/consumer-bench]" -print "#"*80 +print ("#"*80) +print ("## StoreGate test... [producer/consumer-bench]") +print ("#"*80) athena = ChapPy.Athena( jobOptions = [ ChapPy.JobOptions( "StoreGateTests/test_sgProducerConsumer_jobOptions.py" ) ] ) athena.EvtMax = 100 sc = athena.run() -if sc != 0: print "ERROR" +if sc != 0: print ("ERROR") else: - commands.getstatusoutput( + subprocess.getstatusoutput( "perfmon.py %s -o %s" % ( "perfmon.pmon.gz", "out.sg.perfmon.root" ) ) - print "All tests SUCCESSFULLY completed" + print ("All tests SUCCESSFULLY completed") -print "" -print "#"*80 -print "## Bye." -print "#"*80 +print ("") +print ("#"*80) +print ("## Bye.") +print ("#"*80)