ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/CRAB/python/Killer.py
Revision: 1.5
Committed: Sun Apr 20 16:06:34 2008 UTC (17 years ago) by spiga
Content type: text/x-python
Branch: MAIN
CVS Tags: CRAB_2_2_0_pre18, CRAB_2_2_0_pre17, CRAB_2_2_0_pre16, CRAB_2_2_0_pre15, CRAB_2_2_0_pre13, CRAB_2_2_0_pre12, CRAB_2_2_0_pre11, CRAB_2_2_0_pre10
Changes since 1.4: +1 -1 lines
Log Message:
minor bug fix

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 spiga 1.2 if ( jStatus[id-1] in ['SS','R']):
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))