ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/CRAB/python/Resubmitter.py
Revision: 1.7
Committed: Sat May 10 13:41:40 2008 UTC (16 years, 11 months ago) by spiga
Content type: text/x-python
Branch: MAIN
CVS Tags: CRAB_2_2_2_pre5, CRAB_2_2_2_pre4, CRAB_2_2_2_pre3, CRAB_2_2_2_pre2, CRAB_2_2_2_pre1, CRAB_2_2_1, CRAB_2_2_1_pre6, CRAB_2_2_1_pre5, CRAB_2_2_1_pre4, 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, CRAB_2_2_0_pre19
Changes since 1.6: +3 -10 lines
Log Message:
now resubmission working... still an optimization is needed on the status print on screen

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.checkAlowedJob(jobs,nj_list)
13
14
15 common.logger.message('Jobs '+str(nj_list)+' will be resubmitted')
16 Submitter.__init__(self, cfg_params, nj_list, 'range')
17
18 return
19
20 def checkAlowedJob(self,jobs,nj_list):
21 listRunField=[]
22
23 task=common._db.getTask(jobs)
24 for job in task.jobs:
25 st = job.runningJob['status']
26 nj = job['jobId']
27 if st in ['K','A','SE','E']:
28 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
36 if len(nj_list) == 0 :
37 msg='No jobs to resubmit'
38 raise CrabException(msg)
39 self.manageNewRunJobs(nj_list)
40 return nj_list
41
42 def manageNewRunJobs(self,nj_list):
43 """
44 Get new running instances
45 """
46 common._db.newRunJobs(nj_list)
47 return