ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/CRAB/python/PostMortemServer.py
(Generate patch)

Comparing COMP/CRAB/python/PostMortemServer.py (file contents):
Revision 1.5 by mcinquil, Fri Jun 6 13:04:15 2008 UTC vs.
Revision 1.11 by mcinquil, Wed Sep 23 20:26:49 2009 UTC

# Line 1 | Line 1
1   from PostMortem import PostMortem
2 from StatusServer import StatusServer
2  
3   from crab_util import *
4   import common
# Line 8 | Line 7 | import string, os
7   from ProdCommon.Storage.SEAPI.SElement import SElement
8   from ProdCommon.Storage.SEAPI.SBinterface import SBinterface
9  
10 < class PostMortemServer(PostMortem, StatusServer):
10 > class PostMortemServer(PostMortem):
11      def __init__(self, cfg_params, nj_list):
12              
13          PostMortem.__init__(self, cfg_params, nj_list)
# Line 22 | Line 21 | class PostMortemServer(PostMortem, Statu
21          return
22      
23      def collectLogging(self):
24 <        # get updated status from server #inherited from StatusServer
25 <        self.resynchClientSide()
24 >        # get updated status from server
25 >        try:
26 >            from StatusServer import StatusServer
27 >            stat = StatusServer(self.cfg_params)
28 >            stat.resynchClientSide()
29 >        except:
30 >            pass
31  
32          #create once storage interaction object
33          seEl = None
# Line 31 | Line 35 | class PostMortemServer(PostMortem, Statu
35          try:  
36              seEl = SElement(self.storage_name, self.storage_proto, self.storage_port)
37          except Exception, ex:
38 <            common.logger.debug(1, str(ex))
38 >            common.logger.debug( str(ex))
39              msg = "ERROR: Unable to create SE source interface \n"
40              raise CrabException(msg)
41          try:
42              loc = SElement("localhost", "local")
43          except Exception, ex:
44 <            common.logger.debug(1, str(ex))
44 >            common.logger.debug( str(ex))
45              msg = "ERROR: Unable to create destination interface \n"
46              raise CrabException(msg)
47  
# Line 50 | Line 54 | class PostMortemServer(PostMortem, Statu
54          ## iter over each asked job and print warning if not in skimmed list
55          for id in self.nj_list:
56              if id not in self.all_jobs:
57 <                common.logger.message('Warning: job # ' + str(id) + ' does not exist! Not possible to ask for postMortem ')
57 >                common.logger.info('Warning: job # ' + str(id) + ' does not exist! Not possible to ask for postMortem ')
58                  continue
59              elif id in logginable:  
60                  fname = self.fname_base + str(id) + '.LoggingInfo'
61                  if os.path.exists(fname):
62 <                    common.logger.message('Logging info for job ' + str(id) + ' already present in '+fname+'\nRemove it for update')
62 >                    common.logger.info('Logging info for job ' + str(id) + ' already present in '+fname+'\nRemove it for update')
63                      continue
64                  ## retrieving & processing logging info
65                  if self.retrieveFile( sbi, id, fname):
# Line 64 | Line 68 | class PostMortemServer(PostMortem, Statu
68                      out = "".join(fl.readlines())  
69                      fl.close()
70                      reason = self.decodeLogging(out)
71 <                    common.logger.message('Logging info for job '+ str(id) +': '+str(reason)+'\n      written to '+str(fname)+' \n' )
71 >                    common.logger.info('Logging info for job '+ str(id) +': '+str(reason)+'\n      written to '+str(fname)+' \n' )
72                  else:
73 <                    common.logger.message('Logging info for job '+ str(id) +' not retrieved')
73 >                    common.logger.info('Logging info for job '+ str(id) +' not retrieved. Tring to get loggingInfo manually')
74 >                    PostMortem.collectOneLogging(self,id)
75              else:
76 <                common.logger.message('Warning: job # ' + str(id) + ' not killed or aborted! Not possible to ask for postMortem ')
76 >                common.logger.info('Warning: job # ' + str(id) + ' not killed or aborted! Will get loggingInfo manually ')
77 >                PostMortem.collectOneLogging(self,id)
78          return
79  
80  
# Line 91 | Line 97 | class PostMortemServer(PostMortem, Statu
97          retrieves logging.info file from the server storage area
98          """
99          self.taskuuid = str(common._db.queryTask('name'))
100 <        common.logger.debug(3, "Task name: " + self.taskuuid)
100 >        common.logger.debug( "Task name: " + self.taskuuid)
101  
102          # full remote dir
103          remotedir = os.path.join(self.storage_path, self.taskuuid)
104          remotelog = remotedir + '/loggingInfo_'+str(jobid)+'.log'
105  
106 <        common.logger.message("Starting retrieving logging-info from server " \
106 >        common.logger.info("Starting retrieving logging-info from server " \
107                                 + str(self.storage_name) + " for job " \
108                                 + str(jobid) + "...")
109  
110          # retrieve logging info from storage
111 <        common.logger.debug(1, "retrieving "+ str(remotelog) +" to "+ str(destlog) )
111 >        common.logger.debug( "retrieving "+ str(remotelog) +" to "+ str(destlog) )
112          try:
113              sbi.copy( remotelog, destlog)
114          except Exception, ex:
115              msg = "WARNING: Unable to retrieve logging-info file %s \n"%remotelog
116              msg += str(ex)
117 <            common.logger.debug(1,msg)
117 >            common.logger.debug(msg)
118              return False
119          # cleaning remote logging info file
120          try:
121 <            common.logger.debug(5, "Cleaning remote file [%s] " + str(remotelog) )
121 >            common.logger.debug( "Cleaning remote file [%s] " %( str(remotelog) ) )
122              sbi.delete(remotelog)
123          except Exception, ex:
124              msg = "WARNING: Unable to clean remote logging-info file %s \n"%remotelog
125              msg += str(ex)
126 <            common.logger.debug(5,msg)
126 >            common.logger.debug(msg)
127          return True

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines