ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/CRAB/python/Killer.py
Revision: 1.3
Committed: Mon Apr 14 16:41:56 2008 UTC (17 years ago) by spiga
Content type: text/x-python
Branch: MAIN
Changes since 1.2: +0 -1 lines
Log Message:
removed print

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    
19     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     common.logger.message("Not possible to kill Job #"+str(id)+" : Status is "+jStatus[id-1])
28     pass
29     pass
30    
31     common.scheduler.cancel(toBeKilled)
32     common.logger.message("Jobs killed "+str(toBeKilled))