ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/CRAB/python/Killer.py
Revision: 1.8
Committed: Mon May 12 15:53:35 2008 UTC (16 years, 11 months ago) by spiga
Content type: text/x-python
Branch: MAIN
CVS Tags: PRODCOMMON_0_10_7_testCS2, CRAB_2_2_1_pre3, CRAB_2_2_1_pre2, CRAB_2_2_1_pre1, CRAB_2_2_0, CRAB_2_2_0_pre21
Changes since 1.7: +1 -1 lines
Log Message:
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 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 spiga 1.8 common.logger.message("Not possible to kill Job #"+str(job['jobId'])+" : Status is "+str(job.runningJob['statusScheduler']))
26 spiga 1.7 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))