ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/CRAB/python/Killer.py
Revision: 1.6
Committed: Tue May 6 21:32:02 2008 UTC (16 years, 11 months ago) by ewv
Content type: text/x-python
Branch: MAIN
Changes since 1.5: +1 -1 lines
Log Message:
Update allowed status for kill, fix bug in Resubmitter

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     common.logger.debug(5, "Killer::run() called")
16    
17     jStatus=common._db.queryRunJob('status','all')
18 spiga 1.4 human_status = common._db.queryRunJob('statusScheduler','all')
19 slacapra 1.1 toBeKilled = []
20     for id in self.range:
21     if id not in common._db.nJobs("list"):
22     common.logger.message("Warning: job # "+str(id)+" doesn't exists! Not possible to kill it.")
23     else:
24 ewv 1.6 if ( jStatus[id-1] in ['SS','R','S']):
25 slacapra 1.1 toBeKilled.append(id)
26     else:
27 spiga 1.5 common.logger.message("Not possible to kill Job #"+str(id)+" : Status is "+str(human_status[id-1]))
28 slacapra 1.1 pass
29     pass
30    
31 spiga 1.4 if len(toBeKilled)>0:
32     common.scheduler.cancel(toBeKilled)
33     common.logger.message("Jobs killed "+str(toBeKilled))