ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/CRAB/python/Resubmitter.py
Revision: 1.10
Committed: Wed Jan 7 11:30:14 2009 UTC (16 years, 3 months ago) by spiga
Content type: text/x-python
Branch: MAIN
CVS Tags: CRAB_2_5_0_pre2, CRAB_2_5_0_pre1, CRAB_2_4_4, CRAB_2_4_4_pre6, CRAB_2_4_4_pre5, CRAB_2_4_4_pre4, CRAB_2_4_4_pre3, CRAB_2_4_4_pre2, CRAB_2_4_4_pre1
Changes since 1.9: +1 -1 lines
Log Message:
allow to resubmit Done (Failed) jobs. It should be a temporary status..BTW can be considered exactely as the Aborted

File Contents

# User Rev Content
1 slacapra 1.1 from Submitter import Submitter
2     import common
3     from crab_util import *
4 spiga 1.4 from crab_exceptions import *
5 slacapra 1.1
6     class Resubmitter(Submitter):
7 spiga 1.3 def __init__(self, cfg_params, jobs):
8     self.cfg_params = cfg_params
9    
10 slacapra 1.1 nj_list = []
11 ewv 1.6
12 spiga 1.3 nj_list = self.checkAlowedJob(jobs,nj_list)
13 ewv 1.6
14    
15 spiga 1.3 common.logger.message('Jobs '+str(nj_list)+' will be resubmitted')
16     Submitter.__init__(self, cfg_params, nj_list, 'range')
17 ewv 1.6
18 spiga 1.3 return
19 slacapra 1.1
20 spiga 1.3 def checkAlowedJob(self,jobs,nj_list):
21     listRunField=[]
22 slacapra 1.1
23 spiga 1.3 task=common._db.getTask(jobs)
24     for job in task.jobs:
25     st = job.runningJob['status']
26 spiga 1.7 nj = job['jobId']
27 spiga 1.10 if st in ['K','A','SE','E','UE','DA']:
28 spiga 1.3 nj_list.append(int(nj))
29     elif st == 'C':
30     common.logger.message('Job #'+`int(nj)`+' has status '+str(job.runningJob['statusScheduler'])+' not yet submitted!!!')
31     elif st in ['SD','D']:
32     common.logger.message('Job #'+`int(nj)`+' has status '+str(job.runningJob['statusScheduler'])+' must be retrieved before resubmission')
33     else:
34     common.logger.message('Job #'+`nj`+' has status '+str(job.runningJob['statusScheduler'])+' must be "killed" before resubmission')
35 spiga 1.4
36     if len(nj_list) == 0 :
37 spiga 1.3 msg='No jobs to resubmit'
38     raise CrabException(msg)
39 spiga 1.7 self.manageNewRunJobs(nj_list)
40     return nj_list
41 spiga 1.5
42     def manageNewRunJobs(self,nj_list):
43     """
44     Get new running instances
45     """
46     common._db.newRunJobs(nj_list)
47     return