diff --git a/graphics/EventDisplaysOnline/python/EventDisplaysConfig.py b/graphics/EventDisplaysOnline/python/EventDisplaysConfig.py index ea384c35243c8c1bb98a01fad94f061de0d8ac1a..d88de7cd13443ec4502f0a18dd29dfa853442faa 100644 --- a/graphics/EventDisplaysOnline/python/EventDisplaysConfig.py +++ b/graphics/EventDisplaysOnline/python/EventDisplaysConfig.py @@ -1,5 +1,6 @@ -# Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +from __future__ import print_function def GetRunType(): """Get the run type by reading the run-type setting in the partition from IS """ @@ -25,7 +26,7 @@ def GetRunType(): runparams = ISObject(IPCPartition(partition), 'RunParams.RunParams','RunParams') runparams.checkout() runType = runparams.run_type - except UserWarning, err: + except UserWarning as err: mlog.error(err) #Set the default runtype runType="collisions" @@ -69,7 +70,7 @@ def GetBFields(): #And calculate the flags solenoidOn=((solenoidCurrent.value > 1000.) and (solenoidInvalid.value == 0)) toroidOn=((toroidCurrent.value > 1000.) and (toroidInvalid.value == 0)) - except UserWarning, err: + except UserWarning as err: mlog.error(err) #Should always be able to access initial parititon mlog.fatal("Failed to read magnetic field configuration from IS, aborting") @@ -85,6 +86,6 @@ def GetBFields(): if __name__ == "__main__": runType=GetRunType() - print "RunType: %s"%runType + print ("RunType: %s"%runType) bFields = GetBFields() - print "BFields (Sol,Tor):",bFields + print ("BFields (Sol,Tor):",bFields ) diff --git a/graphics/EventDisplaysOnline/python/EventUtils.py b/graphics/EventDisplaysOnline/python/EventUtils.py index 9ca59221a4ac7c91525599df877f9b7b63445d0c..d7e8796e3b1964b8d7f0adfc2b5c3b1e5609d722 100644 --- a/graphics/EventDisplaysOnline/python/EventUtils.py +++ b/graphics/EventDisplaysOnline/python/EventUtils.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration import os, re, time @@ -15,8 +15,8 @@ def getEventlist(msg, directory): # Event file, add tot the list if matches: - run = "%012d" % long(matches.group(1)) - event = "%012d" % long(matches.group(2)) + run = "%012d" % int(matches.group(1)) + event = "%012d" % int(matches.group(2)) fileentry = run, event, file filelist.append(fileentry) @@ -30,7 +30,7 @@ def getEventlist(msg, directory): msg.info("File '%s' does not belong in the output directory, removing it." % file) try: os.unlink("%s/%s" % (directory, file)) - except OSError, err: + except OSError as err: msg.warning("Could not remove '%s': %s" % (file, err)) except OSError: # File was probably a temp file from another thread that already disappeared @@ -50,7 +50,7 @@ def getEventlist(msg, directory): # msg.warning("One of the files is missing for run %s, event %s, removing the other as well." % (filelist[i][0], filelist[i][1])) # try: # os.unlink("%s/%s" % (directory, filelist[i][2])) - # except OSError, err: + # except OSError as err: # msg.warning("Could not remove '%s': %s" % (filelist[i][2], err)) # Do not include such files in the list for atlas-live.cern.ch @@ -76,7 +76,7 @@ def pruneEvents(msg, directory, maxevents, eventlist): try: os.unlink("%s/%s" % (directory, atlantis)) os.unlink("%s/%s" % (directory, vp1)) - except OSError, err: + except OSError as err: msg.warning("Could not remove files for run %s, event %s: %s" % (run, event, err)) else: @@ -90,13 +90,13 @@ def writeEventlist(msg, directory, eventlist): for run, event, atlantis, vp1 in eventlist: file.write("run:%s,event:%s,atlantis:%s,vp1:%s\n" % (run, event, atlantis, vp1)) file.close() - except IOError, err: + except IOError as err: msg.warning("Could not write event list: %s" % err) # Rename for an atomic overwrite operation try: os.rename("%s/event.%d" % (directory, pid), "%s/event.list" % directory) - except OSError, err: + except OSError as err: msg.warning("Could not rename event.%d to event.list: %s" % (pid, err)) # Perform all of these in one command diff --git a/graphics/EventDisplaysOnline/python/OnlineEventDisplaysSvc.py b/graphics/EventDisplaysOnline/python/OnlineEventDisplaysSvc.py index 234e74516701db84571262a08aa584bcbbeca1f8..b71b92204834b2bbc897a8de466142debe4c7407 100644 --- a/graphics/EventDisplaysOnline/python/OnlineEventDisplaysSvc.py +++ b/graphics/EventDisplaysOnline/python/OnlineEventDisplaysSvc.py @@ -1,4 +1,6 @@ -# Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + +from __future__ import print_function __doc__ = """This service runs in the online Athena event display threads. It manages the distribution of incoming events to the right event display streams. @@ -78,12 +80,12 @@ class OnlineEventDisplaysSvc( PyAthena.Svc ): self.TrigDecMaker = PyAthena.py_alg('TrigDecMaker') self.TrigDecTool = PyAthena.py_tool('Trig::TrigDecisionTool/TrigDecisionTool', iface='Trig::TrigDecisionTool') self.msg.info("TrigDecTool: %s" % self.TrigDecTool) - except Exception, err: + except Exception as err: self.msg.warning("Coult not retrieve TrigDecisionTool: %s" % err) try: eventInfo = PyEventTools.getEventInfo('') - except LookupError, err: + except LookupError as err: self.msg.error("Could not retrieve EventInfo: %s" % err) return StatusCode.Recoverable @@ -99,7 +101,7 @@ class OnlineEventDisplaysSvc( PyAthena.Svc ): streamTags = triggerInfo.streamTags() else: streamTags = [] - except Exception, err: + except Exception as err: self.msg.error("Exception occured while reading event/trigger info: %s" % err) return StatusCode.Recoverable @@ -129,7 +131,7 @@ class OnlineEventDisplaysSvc( PyAthena.Svc ): # streams += ['MinBias'] #if self.TrigDecTool.isPassed('L1_MU0') or self.TrigDecTool.isPassed('L1_MU6') or self.TrigDecTool.isPassed('L1_MU10'): # streams += ['Muons'] - except Exception, err: + except Exception as err: self.msg.error("Exception occured while using TrigDecTool: %s" % err) try: @@ -137,19 +139,19 @@ class OnlineEventDisplaysSvc( PyAthena.Svc ): if stream in self.public: ready4physics = ISInfoAny() self.dict.getValue('RunParams.Ready4Physics', ready4physics) - print "Ready for physics: %s " % ready4physics.get() + print ("Ready for physics: %s " % ready4physics.get()) runparams = ISObject(self.partition, 'RunParams.RunParams','RunParams') runparams.checkout() physicsReady = ISObject(self.partition, 'RunParams.Ready4Physics','Ready4PhysicsInfo') physicsReady.checkout() - print "Ready for physics: %r" % (physicsReady.ready4physics) + print ("Ready for physics: %r" % (physicsReady.ready4physics)) #if ready4physics.get() and physicsReady.ready4physics and runparams.T0_project_tag in self.projecttags: if physicsReady.ready4physics and runparams.T0_project_tag in self.projecttags: streams += ['Public'] else: self.msg.debug("RunParams.Ready4Physics is not set, run number is not set, or T0_project_tag is not set to any of %s" % ", ".join(self.projecttags)) break - except Exception, err: + except Exception as err: self.msg.error("Exception occured while reading RunParams.Ready4Physics: %s" % err) # Randomize list of streams @@ -177,7 +179,7 @@ class OnlineEventDisplaysSvc( PyAthena.Svc ): os.chown(self.directory, -1, self.DQMgid) self.msg.info("Created output directory \'%s\' for stream \'%s\'" % (self.directory, self.stream)) break - except OSError, err: + except OSError as err: self.msg.warning("Failed to create output directory \'%s\' for stream \'%s\': %s", (self.directory, self.stream, err.strerror)) self.directory = '' @@ -196,7 +198,7 @@ class OnlineEventDisplaysSvc( PyAthena.Svc ): # And also for the VP1 event producer algorithm self.VP1EventProducer.getProperty('DestinationDirectory').setValue(self.directory) - except Exception, err: + except Exception as err: self.msg.error("Exception occured while setting job options: %s" % err) return StatusCode.Failure diff --git a/graphics/EventDisplaysOnline/share/Atlantis_jobOptions.py b/graphics/EventDisplaysOnline/share/Atlantis_jobOptions.py index 29be2b16e03dac7f9b5ef73fec085349c8d32933..74403eea75dd53677a4fd09b6b192205a483618a 100644 --- a/graphics/EventDisplaysOnline/share/Atlantis_jobOptions.py +++ b/graphics/EventDisplaysOnline/share/Atlantis_jobOptions.py @@ -156,4 +156,4 @@ if rec.doHeavyIon: ### Finally, print setup if in debug mode if AtlantisMsgLvl <= DEBUG: - print "\n\n\t Atlantis setup\n",AlgoJiveXML,"\n\n" + printfunc ("\n\n\t Atlantis setup\n",AlgoJiveXML,"\n\n") diff --git a/graphics/EventDisplaysOnline/share/ByteStreamController_jobOptions.py b/graphics/EventDisplaysOnline/share/ByteStreamController_jobOptions.py index 13b8fbb78849d2842e709608098f83eb392007c4..a534d243aab5a925e8801da911cc2ab92663b2b1 100644 --- a/graphics/EventDisplaysOnline/share/ByteStreamController_jobOptions.py +++ b/graphics/EventDisplaysOnline/share/ByteStreamController_jobOptions.py @@ -38,6 +38,6 @@ ByteStreamEmonCtrlSvc.OutputLevel=BSEmonMsgLvl ISPropertySvc.OutputLevel=BSEmonMsgLvl if BSEmonMsgLvl <= DEBUG: - print "\n\n\t ISPropertySvc setup:\n",ISPropertySvc,"\n\n" - print "\n\n\t ByteStreamEmonControl setup:\n",ByteStreamEmonCtrlSvc,"\n\n" + printfunc ("\n\n\t ISPropertySvc setup:\n",ISPropertySvc,"\n\n") + printfunc ("\n\n\t ByteStreamEmonControl setup:\n",ByteStreamEmonCtrlSvc,"\n\n") diff --git a/graphics/EventDisplaysOnline/share/ByteStreamInput_jobOptions.py b/graphics/EventDisplaysOnline/share/ByteStreamInput_jobOptions.py index 30ecaea6f66618ddafe55a076f11bdefeedeae21..a69e349e0861495ed8c2ce3f37e7c877e69c6416 100644 --- a/graphics/EventDisplaysOnline/share/ByteStreamInput_jobOptions.py +++ b/graphics/EventDisplaysOnline/share/ByteStreamInput_jobOptions.py @@ -26,7 +26,7 @@ ByteStreamEmonInputSvc = svcMgr.ByteStreamInputSvc # ############################################################ if not 'Partition' in dir(): Partition = 'ATLAS' -print "ByteStreamEmonInputSvc: Setting partition to : %s" % (Partition) +printfunc ("ByteStreamEmonInputSvc: Setting partition to : %s" % (Partition)) ByteStreamEmonInputSvc.Partition = Partition # ######################################### @@ -160,4 +160,4 @@ if not 'BSEmonMsgLvl' in dir(): ByteStreamEmonInputSvc.OutputLevel=BSEmonMsgLvl if BSEmonMsgLvl <= DEBUG: - print "\n\n\t ByteStreamEmonInput setup:\n",ByteStreamEmonInputSvc,"\n\n" + printfunc ("\n\n\t ByteStreamEmonInput setup:\n",ByteStreamEmonInputSvc,"\n\n") diff --git a/graphics/EventDisplaysOnline/share/EventDisplay_jobOptions.py b/graphics/EventDisplaysOnline/share/EventDisplay_jobOptions.py index f91ad155fe28de040f3147475fb5d1116dc21b8e..00c0be945ba35713b67b075ab2b13dfa0e8e658b 100644 --- a/graphics/EventDisplaysOnline/share/EventDisplay_jobOptions.py +++ b/graphics/EventDisplaysOnline/share/EventDisplay_jobOptions.py @@ -111,7 +111,7 @@ if not len(jobId) == 5: jobId = ['Athena-EventProcessor', 'Athena-EventDisplays-Segment', 'EventDisplays-Rack', 'tmp', '%d' % randint(0, 999)] IPC_timeout = int(os.environ['TDAQ_IPC_TIMEOUT']) -print " IPC_timeout Envrionment Variable = %d" %IPC_timeout +printfunc (" IPC_timeout Envrionment Variable = %d" %IPC_timeout) ################################################################################# #from random import randrange diff --git a/graphics/EventDisplaysOnline/share/VP1_jobOptions.py b/graphics/EventDisplaysOnline/share/VP1_jobOptions.py index ed19e61a88547041056a30535abeba7bd6f4cbb1..67251667c26742050a6551a34fc5ec641d3c4640 100644 --- a/graphics/EventDisplaysOnline/share/VP1_jobOptions.py +++ b/graphics/EventDisplaysOnline/share/VP1_jobOptions.py @@ -16,8 +16,8 @@ svcMgr += outputStreamSequencerSvc from VP1AlgsEventProd.VP1AlgsEventProdConf import VP1EventProd VP1EventProducer = VP1EventProd(InputPoolFile = StreamESD.OutputFile) ## =================== Added 09/03/15 by sjiggins ================= -print "<<<<<<< VP1 Output File >>>>>>>" -print "OutputFile: %s" % StreamESD.OutputFile +printfunc ("<<<<<<< VP1 Output File >>>>>>>") +printfunc ("OutputFile: %s" % StreamESD.OutputFile) ## ================================================================ #Write out files in the directory given by the stream name @@ -37,4 +37,4 @@ topSequence += VP1EventProducer ### Finally print setup in debug mode if VP1MsgLvl <= DEBUG: - print "\n\n\t VP1 setup\n",VP1EventProducer,"\n\n" + printfunc ("\n\n\t VP1 setup\n",VP1EventProducer,"\n\n") diff --git a/graphics/EventDisplaysOnline/share/WaitForAtlas_jobOptions.py b/graphics/EventDisplaysOnline/share/WaitForAtlas_jobOptions.py index d507d394a2b1b5471c8de796c29012d86a344b28..c1e96dfaf6e82f23a0817f00487fcf0c07e940ba 100644 --- a/graphics/EventDisplaysOnline/share/WaitForAtlas_jobOptions.py +++ b/graphics/EventDisplaysOnline/share/WaitForAtlas_jobOptions.py @@ -9,7 +9,7 @@ while not partitionUp: runparams.checkout() partitionUp=True - except Exception, e: - print "%s partition is not up, sleeping for 30 seconds" % partitionName + except Exception as e: + printfunc ("%s partition is not up, sleeping for 30 seconds" % partitionName) time.sleep(30)