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 |
10 |
– |
self.flag_useboss = use_boss |
12 |
|
return |
13 |
|
|
14 |
|
def run(self): |
23 |
|
|
24 |
|
# run a list-match on first job |
25 |
|
for nj in self.nj_list: |
26 |
< |
#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) |
26 |
> |
id = common.scheduler.boss_SID(nj) |
27 |
|
out = common.scheduler.loggingInfo(id) |
32 |
– |
# job_list inizia a contare da zero |
28 |
|
job = common.job_list[nj-1] |
29 |
< |
#print "job.jdlFilename()", job.jdlFilename() |
30 |
< |
jdl_fname = string.replace(job.jdlFilename(),'jdl','loggingInfo') |
31 |
< |
#print "jdl_fname = ", jdl_fname |
32 |
< |
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') |
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(jdl_fname, 'w') |
34 |
> |
jdl = open(fname, 'w') |
35 |
|
for line in out: jdl.write(line) |
36 |
|
jdl.close() |
37 |
|
|
38 |
< |
loggingInfo = EdgLoggingInfo.EdgLoggingInfo() |
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 |
< |
reason = loggingInfo.decodeReason(out) |
47 |
< |
|
48 |
< |
common.logger.message('Logging info for job '+str(nj)+': '+reason+'\n written to '+jdl_fname) |
48 |
> |
common.logger.message('Logging info for job '+str(nj)+': '+reason+'\n written to '+fname) |
49 |
|
|
50 |
|
# ML reporting |
51 |
|
jobId = '' |