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.4 by gutsche, Fri Jun 16 01:42:09 2006 UTC vs.
Revision 1.11 by slacapra, Tue Oct 10 17:22:29 2006 UTC

# Line 1 | Line 1
1   from Actor import *
2 + from crab_util import *
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 >        if common.scheduler.boss_scheduler_name == 'condor_g':
14 >            # create hash of cfg file
15 >            self.hash = makeCksum(common.work_space.cfgFileName())
16 >        else:
17 >            self.hash = ''
18 >        
19          return
20      
21      def run(self):
# Line 22 | Line 30 | class PostMortem(Actor):
30  
31          # run a list-match on first job
32          for nj in self.nj_list:
33 <            #nj parte da 1 --> nj = internal_id di boss
26 <            if self.flag_useboss == 1 :
27 <                id = common.scheduler.boss_SID(nj)
28 <                #print "id = ", id
29 <            #else:
30 <            #    id = common.jobDB.jobId(nj)
33 >            id = common.scheduler.boss_SID(nj)
34              out = common.scheduler.loggingInfo(id)
32            # job_list inizia a contare da zero
35              job = common.job_list[nj-1]
36 <            #print "job.jdlFilename()", job.jdlFilename()
37 <            jdl_fname = string.replace(job.jdlFilename(),'jdl','loggingInfo')
38 <            #print "jdl_fname = ", jdl_fname
39 <            if os.path.exists(jdl_fname):
38 <                common.logger.message('Logging info for job '+str(nj)+' already present in '+jdl_fname+' Remove it for update')
36 >            jobnum_str = '%06d' % (int(nj))
37 >            fname = common.work_space.jobDir() + '/' + self.cfg_params['CRAB.jobtype'].upper() + '_' + jobnum_str + '.loggingInfo'
38 >            if os.path.exists(fname):
39 >                common.logger.message('Logging info for job '+str(nj)+' already present in '+fname+'\nRemove it for update')
40                  continue
41 <            jdl = open(jdl_fname, 'w')
41 >            jdl = open(fname, 'w')
42              for line in out: jdl.write(line)
43              jdl.close()
44  
45 <            loggingInfo = EdgLoggingInfo.EdgLoggingInfo()
46 <
47 <            reason = loggingInfo.decodeReason(out)
45 >            reason = ''
46 >            ## SL this if-elif is the negation of OO! Mus disappear ASAP
47 >            if common.scheduler.boss_scheduler_name == "edg" or common.scheduler.boss_scheduler_name == "glite" or common.scheduler.boss_scheduler_name == "glitecoll":
48 >                loggingInfo = EdgLoggingInfo.EdgLoggingInfo()
49 >                reason = loggingInfo.decodeReason(out)
50 >            elif common.scheduler.boss_scheduler_name == "condor_g" :
51 >                loggingInfo = CondorGLoggingInfo.CondorGLoggingInfo()
52 >                reason = loggingInfo.decodeReason(out)
53 >            else :
54 >                reason = out
55  
56 <            common.logger.message('Logging info for job '+str(nj)+': '+reason+'\n      written to '+jdl_fname)
56 >            common.logger.message('Logging info for job '+str(nj)+': '+reason+'\n      written to '+fname)
57              
58              # ML reporting
59              jobId = ''
60              if common.scheduler.boss_scheduler_name == 'condor_g':
61 <                # create hash of cfg file
54 <                hash = makeCksum(common.work_space.cfgFileName())
55 <                jobId = str(nj) + '_' + hash + '_' + id
61 >                jobId = str(nj) + '_' + self.hash + '_' + id
62              else:
63                  jobId = str(nj) + '_' + id
64  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines