Commits

Anonymous committed f4236ad

See ChangeLog

  • Participants
  • Parent commits 380abb9

Comments (0)

Files changed (7)

       + Tags for PyJobTransformsCore are ordered in inverse chronological order.  
 ================================================================================ 
 
+2009-11-23 Alvin Tan <clat@hep.ph.bham.ac.uk>
+    * Force trf to return successful when Athena returns successful 
+      even when errors are detected. Previously, if a FATAL error exists, 
+      the Athena success is overruled.
+    * Use of LoggedMessageSvc triggered by --usenewmeta=True (temporary). 
+      Now creates different files for each transform step.
+    * Minor change to VTimer to use logger if it exists rather than print.
+    * Fixed bug that set usenewmeta to True by default. The default is now False.
+    * Tag PyJobTransformsCore-00-08-09
+
 2009-11-21 Alvin Tan <clat@hep.ph.bham.ac.uk>
     * Fixed checklog.py to use new (since 00-08-00) job report structure.
     * Use AthFile.cache where possible to provide GUID.

File python/AtlasErrorCodes.py

 
 __all__ = [ 'AtlasErrorCodeException', 'ErrorInfo', 'ErrorCategory' ]
 
+INFO='INFO'
 WARNING='WARNING'
 ERROR='ERROR'
 FATAL='FATAL'

File python/JobReport.py

                 #print "------->AT:  Exception raised in JobReport:exitCode"
                 pass
             else:
-                if athCode == '0' and exitError.severity != AtlasErrorCodes.FATAL:
+                # Return success if Athena returns success regardless of any errors detected
+                if athCode == '0': # and exitError.severity != AtlasErrorCodes.FATAL:
                     return 0
         err = self.errorCode( exitError )
         ex = (err % 10000) / 100

File python/runargs.py

     extrametadatadict = CommandLineOption( '', 'extrametadatadict', 'File containing extraMetadataDict, a dictionary of compiled patterns and/or strings for explicit inclusion', True )
 
     # temporary options for testing
-    usenewmeta = CommandLineOption( '', 'usenewmeta', 'Use new metadata format. Experimental', True, True, choices = [ True, False ] )
+    usenewmeta = CommandLineOption( '', 'usenewmeta', 'Use new metadata format. Experimental', True, False, choices = [ True, False ] )
 
     def __init__(self):
         JobConfig.__init__(self,'runOpts')

File python/trf.py

             AtlasErrorCodes.readIgnorePatterns( fname ) # add user file
 
     def useNewMeta( self, val ):
-        """Experimental. Switch to using functions that use the new metadata mechanism."""
+        """Experimental. Switch to using functions that use the new metadata mechanism.
+        Use LoggerMessageSvc instead of the default MessageSvc."""
         self._jobReport.useNewMetadataFormat = val
+        
 
     ## TransformLogger and athena MessagSvc logger level setter
     # @param self "Me, myself and Irene"
 
     def _makeMessageSvcJobOptions(self):
         joFile = open( self.messageSvcFilename(), 'w' )
-        jo = [ CommentLine("Replacing MessageSvc with LoggedMessageSvc").bigComment() ,
-                "from AthenaCommon.AppMgr import ServiceMgr, theApp",
-                "theApp.CreateSvc += ['AthenaSummarySvc']",
-                "import AthenaCommon.ConfigurableDb as ConfDb",
-                "from AthenaServices.AthenaServicesConf import AthenaSummarySvc",
-                "from AthenaCommon.OldStyleConfig import Service",
-                "AthenaSummarySvc = Service('AthenaSummarySvc')",
-                "ServiceMgr += AthenaSummarySvc",
-                "theApp.MessageSvcType = 'LoggedMessageSvc'",
+        jo = [  CommentLine("Replacing MessageSvc with LoggedMessageSvc").bigComment() ,
                 "try:",
-                "   oldMsgSvcName = ServiceMgr.MessageSvc.name()",
-                "except AttributeError:",
-                "   oldMsgSvcName = 'MessageSvc'",
-                "   oldMsgSvcItems = []",
+                "   from AthenaServices import SummarySvc",
+                "except:",
+                "   print '--->AT: Could not import AthenaServices.SummarySvc'",
+                "   try:",
+                "      from AthenaCommon.AppMgr import ServiceMgr, theApp",
+                "      import AthenaCommon.ConfigurableDb as ConfDb",
+                "      from AthenaServices.AthenaServicesConf import AthenaSummarySvc",
+                "      from AthenaCommon.OldStyleConfig import Service",
+                "   except:",
+                "      print '--->AT: Could not import required modules to enable use of LoggedMessageSvc.'",
+                "   else:",
+                "      print '--->AT: Using AthenaServices...'",
+                "      from AthenaServices.AthenaServicesConf import AthenaSummarySvc",
+                "      AthenaSummarySvc.SummaryFile = 'AthenaSummary_%s.txt'" % self.name(),
+                "      theApp.CreateSvc += ['AthenaSummarySvc']",
+                "      AthenaSummarySvc = Service('AthenaSummarySvc')",
+                "      ServiceMgr += AthenaSummarySvc",
+                "      theApp.MessageSvcType = 'LoggedMessageSvc'",
+                "      try:",
+                "         oldMsgSvcName = ServiceMgr.MessageSvc.name()",
+                "      except AttributeError:",
+                "         oldMsgSvcName = 'MessageSvc'",
+                "         oldMsgSvcItems = []",
+                "      else:",
+                "         oldMsgSvcItems = ServiceMgr.MessageSvc.getValuedProperties().items()",
+                "         del ServiceMgr.MessageSvc",
+                "      try:",
+                "         del ServiceMgr.allConfigurables[ oldMsgSvcName ]",
+                "      except KeyError:",
+                "         pass",
+                "      newMsgSvc = ConfDb.getConfigurable( theApp.MessageSvcType )( oldMsgSvcName )",
+                "      for name, value in oldMsgSvcItems:",
+                "         setattr( newMsgSvc, name, value )",
+                "      ServiceMgr += newMsgSvc",
+                "      MessageSvc = ServiceMgr.MessageSvc",
                 "else:",
-                "   oldMsgSvcItems = ServiceMgr.MessageSvc.getValuedProperties().items()",
-                "   del ServiceMgr.MessageSvc",
-                "try:",
-                "   del ServiceMgr.allConfigurables[ oldMsgSvcName ]",
-                "except KeyError:",
-                "    pass",
-                "newMsgSvc = ConfDb.getConfigurable( theApp.MessageSvcType )( oldMsgSvcName )",
-                "for name, value in oldMsgSvcItems:",
-                "    setattr( newMsgSvc, name, value )",
-                "ServiceMgr += newMsgSvc",
-                "MessageSvc = ServiceMgr.MessageSvc",
-                "print 'LoggedMessageSvc has replaced standard MessageSvc.'" ]
+                "   print '--->AT: Using AthenaServices.SummarySvc...'",
+                "   from AthenaServices.AthenaServicesConf import AthenaSummarySvc",
+                "   AthenaSummarySvc.SummaryFile = 'AthenaSummary_%s.txt'" % self.name(),
+                "   SummarySvc.useAthenaSummarySvc()" ]
         joFile.write( os.linesep.join(jo) + os.linesep )
         joFile.close()
 
             fn = jo.filename()
             if fn: topOptions.append( fn )
         # XXX_messageSvc_jobOptions.py not used anymore.
-        # Testing out new message service instead so re-instating for now.
-        #
-        self._makeMessageSvcJobOptions()
-        topOptions.append( self.messageSvcFilename() )
+        # Testing out new message service instead so re-instating when
+        # --usenewmeta=True.
+        if self._jobReport.useNewMetadataFormat:
+            self._makeMessageSvcJobOptions()
+            topOptions.append( self.messageSvcFilename() )
         #
         # add the contents of the top joboptions to the logfile
         line = CommentLine('Start of top joboptions').bigComment('=')
         # Check the logfile for errors
         #
         checker = AthenaLogChecker(self._atlasrelease)
+        vTimer.logger = self.logger()
+        vTimer.start()
         checker.checkLogFile(self._logFilename,athenaReport,self.logger() )
+        vTimer.stop()
+        vTimer.report()
+        vTimer.reset()
         # Alter behaviour of athenaReport depending on the following flags.
         athenaReport.setIgnoreUnknown( self._ignoreUnknown )
         athenaReport.setIgnoreAll( self._ignoreAll )

File python/trferr.py

 from AthenaCommon.Include import IncludeError
 from PyJobTransformsCore.JobReport import *
 
-
 # some constants for shared library loading problems
 systemLibs = [ 'libc.so', 'libg2c.so', 'libstdc++.so', 'libshift.so',
                'libpthread.so', 'libm.so', 'libgcc_s.so',

File python/trfutil.py

 
 
 class VTimer( object ):
-    def __init__( self ):
+    def __init__( self, logger = None ):
         self.reset()
+        self.logger = logger
+
+    def _print( self, x, severity = 'info' ):
+        try:
+            getattr( self.logger, severity )( x )
+        except:
+            print x
 
     def toHMS( self, seconds = 0 ):
         seconds = int( seconds )
 
     def start( self ):
         if self.started:
-            print 'VTimer has already started. Resetting.'
+            self._print( 'VTimer has already started. Resetting.' )
             self.reset()
         self.started = True
         self.wallTime_Start = time.time()
         self.cpuTime_Start, self.vmem_Start, self.rss_Start = pymon()
-        print 'VTimer started. [wall time: %s], [vmem: %s], [rss: %s]' % ( time.asctime( time.gmtime( self.wallTime_Start ) ), self.vmem_Start, self.rss_Start )
+        self._print( 'VTimer started. [wall time: %s], [vmem: %s], [rss: %s]' % ( time.asctime( time.gmtime( self.wallTime_Start ) ), self.vmem_Start, self.rss_Start ) )
     
     def stop( self ):
         if not self.started:
-            print 'VTimer not started.'
+            self._print( 'VTimer not started.', 'warning' )
             return
         self.started = False
         self.cpuTime_Stop, self.vmem_Stop, self.rss_Stop = pymon()
         self.wallTime_Stop = time.time()
-        print 'VTimer stopped. [wall time: %s], [vmem: %s], [rss: %s]' % ( time.asctime( time.gmtime( self.wallTime_Stop ) ), self.vmem_Stop, self.rss_Stop )
+        self._print( 'VTimer stopped. [wall time: %s], [vmem: %s], [rss: %s]' % ( time.asctime( time.gmtime( self.wallTime_Stop ) ), self.vmem_Stop, self.rss_Stop ) )
 
     def report( self ):
         if self.wallTime_Start is None:
-            print 'VTimer not started.'
+            self._print( 'VTimer not started.', 'warning' )
             return
         if self.started:
             _cpuTime, _vmem, _rss = pymon()
             _wallTime = time.time()
-            print 'VTimer report: (still running) [wall time taken: %s], [cpu time taken: %s], [vmem: %s], [rss: %s]' % ( self.toHMS( _wallTime - self.wallTime_Start ), self.toHMS( _cpuTime - self.cpuTime_Start ), _vmem, _rss )
+            self._print( 'VTimer report: (still running) [wall time taken: %s], [cpu time taken: %s], [vmem: %s], [rss: %s]' % ( self.toHMS( _wallTime - self.wallTime_Start ), self.toHMS( _cpuTime - self.cpuTime_Start ), _vmem, _rss ) )
         else: # VTimer stopped
-            print 'VTimer report. [wall time taken: %s], [cpu time taken: %s], [vmem: %s], [rss: %s]' % ( self.toHMS( self.wallTime_Stop - self.wallTime_Start ), self.toHMS( self.cpuTime_Stop - self.cpuTime_Start ), self.vmem_Stop, self.rss_Stop )
+            self._print( 'VTimer report. [wall time taken: %s], [cpu time taken: %s], [vmem: %s], [rss: %s]' % ( self.toHMS( self.wallTime_Stop - self.wallTime_Start ), self.toHMS( self.cpuTime_Stop - self.cpuTime_Start ), self.vmem_Stop, self.rss_Stop ) )
 
 vTimer = VTimer()