Skip to content
Snippets Groups Projects
Commit 0b7a459f authored by Marco Clemencic's avatar Marco Clemencic
Browse files

Merge branch 'GAUDI-1093' into 'master'

avoid (deprecated) Python module `commands`

fixes GAUDI-1093

See merge request !38
parents 558d9330 9e321aa3
Branches
Tags
No related merge requests found
...@@ -162,7 +162,7 @@ class gaudimain(object) : ...@@ -162,7 +162,7 @@ class gaudimain(object) :
datetime = datetime.replace(' ', '_') datetime = datetime.replace(' ', '_')
outfile = open( 'gaudirun-%s.log'%(datetime), 'w' ) outfile = open( 'gaudirun-%s.log'%(datetime), 'w' )
# two handlers, one for a log file, one for terminal # two handlers, one for a log file, one for terminal
streamhandler = logging.StreamHandler(strm=outfile) streamhandler = logging.StreamHandler(stream=outfile)
console = logging.StreamHandler() console = logging.StreamHandler()
# create formatter : the params in parentheses are variable names available via logging # create formatter : the params in parentheses are variable names available via logging
formatter = logging.Formatter( "%(asctime)s - %(name)s - %(levelname)s - %(message)s" ) formatter = logging.Formatter( "%(asctime)s - %(name)s - %(levelname)s - %(message)s" )
...@@ -427,23 +427,19 @@ class gaudimain(object) : ...@@ -427,23 +427,19 @@ class gaudimain(object) :
import GaudiMP.GMPBase as gpp import GaudiMP.GMPBase as gpp
c = Configurable.allConfigurables c = Configurable.allConfigurables
self.log.info('-'*80) self.log.info('-'*80)
self.log.info('%s: Parallel Mode : %i '%(__name__, ncpus)) self.log.info('%s: Parallel Mode : %i ', __name__, ncpus)
from commands import getstatusoutput as gso for name, value in [('platrofm', ' '.join(os.uname())),
metadataCommands = [ 'uname -a', ('config', os.environ.get('BINARY_TAG') or
'echo $CMTCONFIG', os.environ.get('CMTCONFIG')),
'echo $GAUDIAPPNAME', ('app. name', os.environ.get('GAUDIAPPNAME')),
'echo $GAUDIAPPVERSION'] ('app. version', os.environ.get('GAUDIAPPVERSION')),
for comm in metadataCommands : ]:
s, o = gso( comm ) self.log.info('%s: %30s : %s ', __name__, name, value or 'Undefined')
if s :
o = "Undetermined"
string = '%s: %30s : %s '%(__name__, comm, o)
self.log.info( string )
try : try :
events = str(c['ApplicationMgr'].EvtMax) events = str(c['ApplicationMgr'].EvtMax)
except : except :
events = "Undetermined" events = "Undetermined"
self.log.info('%s: Events Specified : %s '%(__name__,events)) self.log.info('%s: Events Specified : %s ', __name__, events)
self.log.info('-'*80) self.log.info('-'*80)
# Parall = gpp.Coordinator(ncpus, shared, c, self.log) # Parall = gpp.Coordinator(ncpus, shared, c, self.log)
Parall = gpp.Coord( ncpus, c, self.log ) Parall = gpp.Coord( ncpus, c, self.log )
......
from Gaudi.Configuration import * from Gaudi.Configuration import *
from Configurables import EvtCounter
from GaudiPython import AppMgr, gbl, setOwnership, PyAlgorithm, SUCCESS,FAILURE, InterfaceCast from GaudiPython import AppMgr, gbl, setOwnership, PyAlgorithm, SUCCESS,FAILURE, InterfaceCast
from ROOT import TBufferFile, TBuffer from ROOT import TBufferFile, TBuffer
import multiprocessing import multiprocessing
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment