ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/CRAB/python/Resubmitter.py
Revision: 1.14
Committed: Wed Jun 10 11:40:52 2009 UTC (15 years, 10 months ago) by slacapra
Content type: text/x-python
Branch: MAIN
CVS Tags: CRAB_2_6_0_pre9, CRAB_2_6_0_pre8
Changes since 1.13: +18 -19 lines
Log Message:
mods to use new filed "state" to check if action is allowed

File Contents

# Content
1 from Submitter import Submitter
2 import common
3 from crab_util import *
4 from crab_exceptions import *
5
6 class Resubmitter(Submitter):
7 def __init__(self, cfg_params, jobs):
8 self.cfg_params = cfg_params
9
10 nj_list = []
11
12 nj_list = self.checkAllowedJob(jobs,nj_list)
13
14 common.logger.info('Jobs '+str(nj_list)+' will be resubmitted')
15 Submitter.__init__(self, cfg_params, nj_list, 'range')
16
17 return
18
19 def checkAllowedJob(self,jobs,nj_list):
20 listRunField=[]
21
22 task=common._db.getTask(jobs)
23 for job in task.jobs:
24 st = job.runningJob['state']
25 nj = int(job['jobId'])
26 if st in ['KillSuccess','SubFailed','Cleared','Aborted']:
27 #['K','A','SE','E','DA','NS']:
28 nj_list.append(nj)
29 elif st == 'Created':
30 common.logger.info('Job #'+`nj`+' last action was '+str(job.runningJob['state'])+' not yet submitted: use -submit')
31 elif st in ['Terminated']:
32 common.logger.info('Job #'+`nj`+' last action was '+str(job.runningJob['state'])+' must be retrieved (-get) before resubmission')
33 else:
34 common.logger.info('Job #'+`nj`+' last action was '+str(job.runningJob['state'])+' actual status is '\
35 +str(job.runningJob['statusScheduler'])+' must be killed (-kill) before resubmission')
36 if (job.runningJob['state']=='KillRequest'): common.logger.info('\t\tthe previous Kill request is being processed')
37
38
39 if len(nj_list) == 0 :
40 msg='No jobs to resubmit'
41 raise CrabException(msg)
42
43 # Get new running instances
44 common._db.newRunJobs(nj_list)
45
46 return nj_list