24 |
|
""" |
25 |
|
common.logger.debug(5, "PostMortem::run() called") |
26 |
|
|
27 |
< |
if len(self.nj_list)==0: |
28 |
< |
common.logger.debug(5, "No jobs to check") |
29 |
< |
return |
30 |
< |
|
31 |
< |
# run a list-match on first job |
32 |
< |
for nj in self.nj_list: |
33 |
< |
id = common.scheduler.boss_SID(nj) |
34 |
< |
out = common.scheduler.loggingInfo(id) |
35 |
< |
job = common.job_list[nj-1] |
36 |
< |
jobnum_str = '%06d' % (int(nj)) |
27 |
> |
for c, v in self.nj_list.iteritems(): |
28 |
> |
id = int(c) |
29 |
> |
out = common.scheduler.loggingInfo(v) |
30 |
> |
job = common.job_list[id - 1] |
31 |
> |
jobnum_str = '%06d' % (id) |
32 |
|
fname = common.work_space.jobDir() + '/' + self.cfg_params['CRAB.jobtype'].upper() + '_' + jobnum_str + '.loggingInfo' |
33 |
|
if os.path.exists(fname): |
34 |
< |
common.logger.message('Logging info for job '+str(nj)+' already present in '+fname+' Remove it for update') |
34 |
> |
common.logger.message('Logging info for job ' + str(id) + ' already present in '+fname+'\nRemove it for update') |
35 |
|
continue |
36 |
|
jdl = open(fname, 'w') |
37 |
|
for line in out: jdl.write(line) |
38 |
|
jdl.close() |
39 |
|
|
40 |
|
reason = '' |
41 |
< |
if common.scheduler.boss_scheduler_name == "edg" or common.scheduler.boss_scheduler_name == "glite" : |
41 |
> |
## SL this if-elif is the negation of OO! Mus disappear ASAP |
42 |
> |
if common.scheduler.boss_scheduler_name == "edg" or common.scheduler.boss_scheduler_name == "glite" or common.scheduler.boss_scheduler_name == "glitecoll": |
43 |
|
loggingInfo = EdgLoggingInfo.EdgLoggingInfo() |
44 |
|
reason = loggingInfo.decodeReason(out) |
45 |
|
elif common.scheduler.boss_scheduler_name == "condor_g" : |
48 |
|
else : |
49 |
|
reason = out |
50 |
|
|
51 |
< |
common.logger.message('Logging info for job '+str(nj)+': '+reason+'\n written to '+fname) |
51 |
> |
common.logger.message('Logging info for job '+ str(id) +': '+reason+'\n written to '+fname) |
52 |
|
|
53 |
|
# ML reporting |
54 |
|
jobId = '' |
55 |
|
if common.scheduler.boss_scheduler_name == 'condor_g': |
56 |
< |
jobId = str(nj) + '_' + self.hash + '_' + id |
56 |
> |
jobId = str(id) + '_' + self.hash + '_' + v |
57 |
|
else: |
58 |
< |
jobId = str(nj) + '_' + id |
58 |
> |
jobId = str(id) + '_' + v |
59 |
|
|
60 |
|
params = {'taskId': self.cfg_params['taskId'], 'jobId': jobId, \ |
61 |
< |
'sid': id, |
61 |
> |
'sid': v, |
62 |
|
'PostMortemCategory': loggingInfo.getCategory(), \ |
63 |
|
'PostMortemReason': loggingInfo.getReason()} |
64 |
|
self.cfg_params['apmon'].sendToML(params) |