ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/CRAB/python/Killer.py
Revision: 1.9
Committed: Thu May 29 23:24:04 2008 UTC (16 years, 11 months ago) by spiga
Content type: text/x-python
Branch: MAIN
CVS Tags: CRAB_2_2_2_pre1, CRAB_2_2_1, CRAB_2_2_1_pre6, CRAB_2_2_1_pre5, CRAB_2_2_1_pre4
Changes since 1.8: +1 -4 lines
Log Message:
jobs in status ready can be killed

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.9 if ( job.runningJob['status'] in ['SS','R','S','SR']):
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))