ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/CRAB/python/PostMortem.py
Revision: 1.5
Committed: Wed Sep 20 17:29:52 2006 UTC (18 years, 7 months ago) by slacapra
Content type: text/x-python
Branch: MAIN
CVS Tags: CRAB_1_3_0_pre3
Changes since 1.4: +1 -5 lines
Log Message:
BOSS4 + sub-file splitting + taskDB

File Contents

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