ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/CRAB/python/Killer.py
Revision: 1.7
Committed: Sat May 10 13:56:23 2008 UTC (16 years, 11 months ago) by spiga
Content type: text/x-python
Branch: MAIN
CVS Tags: CRAB_2_2_0_pre19
Changes since 1.6: +10 -13 lines
Log Message:
killer more and more safe... not play with id, id+1...

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 spiga 1.7 task = common._db.getTask(self.range)
17 slacapra 1.1 toBeKilled = []
18 spiga 1.7 for job in task.jobs:
19     # if id not in common._db.nJobs("list"):
20     # common.logger.message("Warning: job # "+str(id)+" doesn't exists! Not possible to kill it.")
21     # else:
22     if ( job.runningJob['status'] in ['SS','R','S']):
23     toBeKilled.append(job['jobId'])
24     else:
25     common.logger.message("Not possible to kill Job #"+str(job['jobId'])+" : Status is "+str(job.runningJob['schedulerStatus']))
26     pass
27 slacapra 1.1
28 spiga 1.4 if len(toBeKilled)>0:
29     common.scheduler.cancel(toBeKilled)
30     common.logger.message("Jobs killed "+str(toBeKilled))