ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/CRAB/python/Killer.py
Revision: 1.10
Committed: Mon Jun 2 16:24:48 2008 UTC (16 years, 10 months ago) by spiga
Content type: text/x-python
Branch: MAIN
CVS Tags: CRAB_2_3_2_pre2, CRAB_2_3_2_pre1, CRAB_2_4_0_test, CRAB_2_3_1, CRAB_2_3_1_pre6, CRAB_2_3_1_pre5, CRAB_2_3_1_pre4, CRAB_2_3_1_pre3, CRAB_2_3_1_pre2, CRAB_2_3_1_pre1, CRAB_2_3_0, CRAB_2_3_0_pre6, CRAB_2_3_0_pre1, CRAB_2_2_2_pre5, CRAB_2_2_2_pre4, CRAB_2_2_2_pre3, CRAB_2_2_2_pre2
Branch point for: AnaDataSet, CRAB_2_3_0_br
Changes since 1.9: +1 -1 lines
Log Message:
waiting jobs are killable

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 spiga 1.10 if ( job.runningJob['status'] in ['SS','R','S','SR','SW']):
20 spiga 1.7 toBeKilled.append(job['jobId'])
21     else:
22 spiga 1.8 common.logger.message("Not possible to kill Job #"+str(job['jobId'])+" : Status is "+str(job.runningJob['statusScheduler']))
23 spiga 1.7 pass
24 slacapra 1.1
25 spiga 1.4 if len(toBeKilled)>0:
26     common.scheduler.cancel(toBeKilled)
27     common.logger.message("Jobs killed "+str(toBeKilled))