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

Comparing COMP/CRAB/python/PostMortem.py (file contents):
Revision 1.6 by gutsche, Fri Sep 22 14:49:44 2006 UTC vs.
Revision 1.18 by spiga, Tue Apr 15 09:37:47 2008 UTC

# Line 1 | Line 1
1   from Actor import *
2   from crab_util import *
3 < import EdgLoggingInfo
4 < import CondorGLoggingInfo
3 > #import EdgLoggingInfo
4 > #import CondorGLoggingInfo
5   import common
6   import string, os
7  
8   class PostMortem(Actor):
9 <    def __init__(self, cfg_params, nj_list, use_boss):
9 >    def __init__(self, cfg_params, nj_list):
10          self.cfg_params = cfg_params
11          self.nj_list = nj_list
12 <        self.flag_useboss = use_boss
12 >
13 >        self.fname_base = common.work_space.jobDir() + self.cfg_params['CRAB.jobtype'].upper() + '_'
14 >
15          return
16      
17      def run(self):
# Line 18 | Line 20 | class PostMortem(Actor):
20          """
21          common.logger.debug(5, "PostMortem::run() called")
22  
23 <        if len(self.nj_list)==0:
24 <            common.logger.debug(5, "No jobs to check")
23 <            return
24 <
25 <        # run a list-match on first job
26 <        for nj in self.nj_list:
27 <            #nj parte da 1 --> nj = internal_id di boss
28 <            id = common.scheduler.boss_SID(nj)
29 <            out = common.scheduler.loggingInfo(id)
30 <            # job_list inizia a contare da zero
31 <            job = common.job_list[nj-1]
32 <            #print "job.jdlFilename()", job.jdlFilename()
33 <            jdl_fname = string.replace(job.jdlFilename(),'jdl','loggingInfo')
34 <            #print "jdl_fname = ", jdl_fname
35 <            if os.path.exists(jdl_fname):
36 <                common.logger.message('Logging info for job '+str(nj)+' already present in '+jdl_fname+' Remove it for update')
37 <                continue
38 <            jdl = open(jdl_fname, 'w')
39 <            for line in out: jdl.write(line)
40 <            jdl.close()
41 <
42 <            reason = ''
43 <            if common.scheduler.boss_scheduler_name == "edg" :
44 <                loggingInfo = EdgLoggingInfo.EdgLoggingInfo()
45 <                reason = loggingInfo.decodeReason(out)
46 <            elif common.scheduler.boss_scheduler_name == "condor_g" :
47 <                loggingInfo = CondorGLoggingInfo.CondorGLoggingInfo()
48 <                reason = loggingInfo.decodeReason(out)
49 <            else :
50 <                reason = out
51 <
52 <            common.logger.message('Logging info for job '+str(nj)+': '+reason+'\n      written to '+jdl_fname)
53 <            
54 <            # ML reporting
55 <            jobId = ''
56 <            if common.scheduler.boss_scheduler_name == 'condor_g':
57 <                # create hash of cfg file
58 <                hash = makeCksum(common.work_space.cfgFileName())
59 <                jobId = str(nj) + '_' + hash + '_' + id
60 <            else:
61 <                jobId = str(nj) + '_' + id
62 <
63 <            params = {'taskId': self.cfg_params['taskId'], 'jobId':  jobId, \
64 <                      'sid': id,
65 <                      'PostMortemCategory': loggingInfo.getCategory(), \
66 <                      'PostMortemReason': loggingInfo.getReason()}
67 <            self.cfg_params['apmon'].sendToML(params)
68 <            pass
23 >        self.collectLogging()
24 >
25  
26 +    def collectLogging(self):
27 +        for id in self.nj_list:
28 +            fname = self.fname_base + str(id) + '.LoggingInfo'
29 +            if os.path.exists(fname):
30 +                common.logger.message('Logging info for job ' + str(id) + ' already present in '+fname+'\nRemove it for update')
31 +                continue
32 +            common.scheduler.loggingInfo(id,self.fname_base+str(id))
33 +            fl = open(fname, 'r')
34 +            out = "".join(fl.readlines())  
35 +            fl.close()
36 +            reason = self.decodeLogging(out)
37 +            common.logger.message('Logging info for job '+ str(id) +': '+str(reason)+'\n      written to '+str(fname) )
38          return
39 +        
40 +    def decodeLogging(self, out):
41 +        """
42 +        """
43 +        return  common.scheduler.decodeLogInfo(out)
44  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines