ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/CRAB/python/Killer.py
Revision: 1.17
Committed: Wed Jun 10 11:40:52 2009 UTC (15 years, 10 months ago) by slacapra
Content type: text/x-python
Branch: MAIN
CVS Tags: CRAB_2_6_0_pre9, CRAB_2_6_0_pre8
Changes since 1.16: +4 -2 lines
Log Message:
mods to use new filed "state" to check if action is allowed

File Contents

# User Rev Content
1 slacapra 1.1 import os, common, string
2     from Actor import *
3     from crab_util import *
4    
5     class Killer(Actor):
6     def __init__(self, cfg_params, range):
7     self.cfg_params = cfg_params
8     self.range = range
9     return
10    
11     def run(self):
12     """
13     The main method of the class: kill a complete task
14     """
15 spiga 1.14 common.logger.debug( "Killer::run() called")
16 spiga 1.7 task = common._db.getTask(self.range)
17 slacapra 1.1 toBeKilled = []
18 spiga 1.7 for job in task.jobs:
19 slacapra 1.17 if job.runningJob['state'] in ['SubSuccess','SubRequest']:
20 spiga 1.7 toBeKilled.append(job['jobId'])
21     else:
22 slacapra 1.17 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 spiga 1.7 pass
26 slacapra 1.1
27 spiga 1.4 if len(toBeKilled)>0:
28     common.scheduler.cancel(toBeKilled)
29 slacapra 1.16 common._db.updateRunJob_(toBeKilled, [{'state':'KillSuccess'}]*len(toBeKilled))
30 spiga 1.14 common.logger.info("Jobs killed "+str(toBeKilled))
31 spiga 1.15