1 |
from Actor import *
|
2 |
import common
|
3 |
import string, os
|
4 |
|
5 |
class PostMortem(Actor):
|
6 |
def __init__(self, cfg_params, nj_list, use_boss):
|
7 |
self.cfg_params = cfg_params
|
8 |
self.nj_list = nj_list
|
9 |
self.flag_useboss = use_boss
|
10 |
return
|
11 |
|
12 |
def run(self):
|
13 |
"""
|
14 |
The main method of the class.
|
15 |
"""
|
16 |
common.logger.debug(5, "PostMortem::run() called")
|
17 |
|
18 |
if len(self.nj_list)==0:
|
19 |
common.logger.debug(5, "No jobs to check")
|
20 |
return
|
21 |
|
22 |
# run a list-match on first job
|
23 |
for nj in self.nj_list:
|
24 |
#nj parte da 1 --> nj = internal_id di boss
|
25 |
if self.flag_useboss == 1 :
|
26 |
id = common.scheduler.boss_SID(nj)
|
27 |
#print "id = ", id
|
28 |
#else:
|
29 |
# id = common.jobDB.jobId(nj)
|
30 |
out = common.scheduler.loggingInfo(id)
|
31 |
# job_list inizia a contare da zero
|
32 |
job = common.job_list[nj-1]
|
33 |
#print "job.jdlFilename()", job.jdlFilename()
|
34 |
jdl_fname = string.replace(job.jdlFilename(),'jdl','loggingInfo')
|
35 |
#print "jdl_fname = ", jdl_fname
|
36 |
if os.path.exists(jdl_fname):
|
37 |
common.logger.message('Logging info for job '+str(nj)+' already present in '+jdl_fname+' Remove it for update')
|
38 |
continue
|
39 |
jdl = open(jdl_fname, 'w')
|
40 |
for line in out: jdl.write(line)
|
41 |
jdl.close()
|
42 |
common.logger.message('Logging info for job '+str(nj)+' written to '+jdl_fname)
|
43 |
|
44 |
pass
|
45 |
|
46 |
return
|
47 |
|