16 |
|
task = common._db.getTask(self.range) |
17 |
|
toBeKilled = [] |
18 |
|
for job in task.jobs: |
19 |
< |
if ( job.runningJob['status'] in ['SU','SS','R','S','SR','SW']): |
19 |
> |
if job.runningJob['state'] in ['SubSuccess','SubRequested']: |
20 |
|
toBeKilled.append(job['jobId']) |
21 |
|
else: |
22 |
< |
common.logger.info("Not possible to kill Job #"+str(job['jobId'])+" : Status is "+str(job.runningJob['statusScheduler'])) |
22 |
> |
common.logger.info("Not possible to kill Job #"+str(job['jobId'])+\ |
23 |
> |
" : Last action was: "+str(job.runningJob['state'])+\ |
24 |
> |
" Status is "+str(job.runningJob['statusScheduler'])) |
25 |
|
pass |
26 |
|
|
27 |
|
if len(toBeKilled)>0: |
28 |
|
common.scheduler.cancel(toBeKilled) |
29 |
+ |
common._db.updateRunJob_(toBeKilled, [{'state':'KillSuccess'}]*len(toBeKilled)) |
30 |
+ |
common._db.updateJob_(toBeKilled, [{'closed':'Y'}]*len(toBeKilled)) |
31 |
|
common.logger.info("Jobs killed "+str(toBeKilled)) |
32 |
+ |
|