ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/CRAB/python/PostMortem.py
Revision: 1.8
Committed: Fri Oct 6 10:03:16 2006 UTC (18 years, 6 months ago) by slacapra
Content type: text/x-python
Branch: MAIN
CVS Tags: CRAB_1_4_0_pre1
Changes since 1.7: +1 -2 lines
Log Message:
remove use of unused flag "use_boss", now hardcoded to true

File Contents

# Content
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):
10 self.cfg_params = cfg_params
11 self.nj_list = nj_list
12 return
13
14 def run(self):
15 """
16 The main method of the class.
17 """
18 common.logger.debug(5, "PostMortem::run() called")
19
20 if len(self.nj_list)==0:
21 common.logger.debug(5, "No jobs to check")
22 return
23
24 # run a list-match on first job
25 for nj in self.nj_list:
26 id = common.scheduler.boss_SID(nj)
27 out = common.scheduler.loggingInfo(id)
28 job = common.job_list[nj-1]
29 jobnum_str = '%06d' % (int(nj))
30 fname = common.work_space.jobDir() + '/' + self.cfg_params['CRAB.jobtype'].upper() + '_' + jobnum_str + '.loggingInfo'
31 if os.path.exists(fname):
32 common.logger.message('Logging info for job '+str(nj)+' already present in '+fname+' Remove it for update')
33 continue
34 jdl = open(fname, 'w')
35 for line in out: jdl.write(line)
36 jdl.close()
37
38 reason = ''
39 if common.scheduler.boss_scheduler_name == "edg" :
40 loggingInfo = EdgLoggingInfo.EdgLoggingInfo()
41 reason = loggingInfo.decodeReason(out)
42 elif common.scheduler.boss_scheduler_name == "condor_g" :
43 loggingInfo = CondorGLoggingInfo.CondorGLoggingInfo()
44 reason = loggingInfo.decodeReason(out)
45 else :
46 reason = out
47
48 common.logger.message('Logging info for job '+str(nj)+': '+reason+'\n written to '+fname)
49
50 # ML reporting
51 jobId = ''
52 if common.scheduler.boss_scheduler_name == 'condor_g':
53 # create hash of cfg file
54 hash = makeCksum(common.work_space.cfgFileName())
55 jobId = str(nj) + '_' + hash + '_' + id
56 else:
57 jobId = str(nj) + '_' + id
58
59 params = {'taskId': self.cfg_params['taskId'], 'jobId': jobId, \
60 'sid': id,
61 'PostMortemCategory': loggingInfo.getCategory(), \
62 'PostMortemReason': loggingInfo.getReason()}
63 self.cfg_params['apmon'].sendToML(params)
64 pass
65
66 return
67