ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/CRAB/python/PostMortem.py
Revision: 1.4
Committed: Fri Jun 16 01:42:09 2006 UTC (18 years, 10 months ago) by gutsche
Content type: text/x-python
Branch: MAIN
CVS Tags: HEAD_20092006, CRAB_1_2_1, CRAB_1_2_0, CRAB_1_2_0_pre9, CRAB_1_2_0_pre8, CRAB_1_2_0_pre7
Branch point for: CRAB_BOSS4_v1, CRAB_BOSS4
Changes since 1.3: +21 -1 lines
Log Message:
first version of instrumented postMortem including DashBoard report

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 if self.flag_useboss == 1 :
27 id = common.scheduler.boss_SID(nj)
28 #print "id = ", id
29 #else:
30 # id = common.jobDB.jobId(nj)
31 out = common.scheduler.loggingInfo(id)
32 # job_list inizia a contare da zero
33 job = common.job_list[nj-1]
34 #print "job.jdlFilename()", job.jdlFilename()
35 jdl_fname = string.replace(job.jdlFilename(),'jdl','loggingInfo')
36 #print "jdl_fname = ", jdl_fname
37 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')
39 continue
40 jdl = open(jdl_fname, 'w')
41 for line in out: jdl.write(line)
42 jdl.close()
43
44 loggingInfo = EdgLoggingInfo.EdgLoggingInfo()
45
46 reason = loggingInfo.decodeReason(out)
47
48 common.logger.message('Logging info for job '+str(nj)+': '+reason+'\n written to '+jdl_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