198 |
|
tmp_task = self.getTask() |
199 |
|
return common.bossSession.serialize(tmp_task) |
200 |
|
|
201 |
< |
def queryID(self,server_mode=0): |
201 |
> |
def queryID(self,server_mode=0, jid=False): |
202 |
|
''' |
203 |
|
Return the taskId if serevr_mode =1 |
204 |
|
Return the joblistId if serevr_mode =0 |
207 |
|
lines=[] |
208 |
|
task = self.getTask() |
209 |
|
if server_mode == 1: |
210 |
< |
header= "Task Id = %-40s " %(task['name']) |
211 |
< |
else: |
210 |
> |
headerTask= "Task Id = %-40s " %(task['name']) |
211 |
> |
displayReport(self,headerTask,lines) |
212 |
> |
if (jid ) or (server_mode == 0): |
213 |
|
for job in task.jobs: |
214 |
|
toPrint='' |
215 |
|
common.bossSession.getRunningInstance(job) |
216 |
|
toPrint = "%-5s %-50s " % (job['jobId'],job.runningJob['schedulerId']) |
217 |
|
lines.append(toPrint) |
218 |
|
header+= "%-5s %-50s " % ('Job:','ID' ) |
219 |
< |
displayReport(self,header,lines) |
219 |
> |
displayReport(self,header,lines) |
220 |
|
return |
221 |
|
|
222 |
|
def queryTask(self,attr): |
334 |
|
rForJ = r |
335 |
|
break |
336 |
|
## Check the submission number and create new running jobs on the client side |
337 |
< |
if int(job.runningJob['submission']) < int(rForJ.getAttribute('resubmit')) + 1: |
338 |
< |
nj_list.append(id) |
339 |
< |
self.newRunJobs(nj_list) |
337 |
> |
if rForJ.getAttribute('resubmit') != 'None' : |
338 |
> |
if int(job.runningJob['submission']) < int(rForJ.getAttribute('resubmit')) + 1: |
339 |
> |
nj_list.append(id) |
340 |
> |
self.newRunJobs(nj_list) |
341 |
|
|
342 |
|
task_new = self.getTask() |
343 |
|
|
349 |
|
if r.getAttribute('id') in [ id, 'all']: |
350 |
|
rForJ = r |
351 |
|
break |
352 |
< |
|
352 |
> |
|
353 |
|
# Data alignment |
354 |
|
if rForJ.getAttribute('status') not in ['Created', 'Unknown'] and not\ |
355 |
|
(job.runningJob['statusScheduler'] == 'Killing' and rForJ.getAttribute('status')!='Killed') \ |
358 |
|
common.logger.debug(3,"Updating DB status for job: " + str(id) + " @: " \ |
359 |
|
+ str(rForJ.getAttribute('status')) ) |
360 |
|
job.runningJob['statusScheduler'] = str( rForJ.getAttribute('status') ) |
361 |
< |
if rForJ.getAttribute('status') == 'Done' and rForJ.getAttribute('sched_status') == 'E' : |
361 |
> |
if (rForJ.getAttribute('status') == 'Done' or rForJ.getAttribute('status') == 'Done (Failed)')\ |
362 |
> |
and rForJ.getAttribute('sched_status') == 'E' : |
363 |
|
job.runningJob['status'] = 'SD' |
364 |
|
else: |
365 |
|
job.runningJob['status'] = str( rForJ.getAttribute('sched_status') ) |
366 |
|
|
367 |
+ |
job.runningJob['schedulerId'] = str( rForJ.getAttribute('sched_id') ) |
368 |
+ |
|
369 |
|
job.runningJob['destination'] = str( rForJ.getAttribute('site') ) |
370 |
|
dest = str(job.runningJob['destination']).split(':')[0] |
371 |
|
|