ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/CRAB/python/Resubmitter.py
Revision: 1.5
Committed: Tue May 6 14:15:41 2008 UTC (16 years, 11 months ago) by spiga
Content type: text/x-python
Branch: MAIN
CVS Tags: CRAB_2_2_0_pre18
Changes since 1.4: +10 -4 lines
Log Message:
correct management of running instance during resubmit

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 manageNewRunJobs(nj_list)
15
16 common.logger.message('Jobs '+str(nj_list)+' will be resubmitted')
17 Submitter.__init__(self, cfg_params, nj_list, 'range')
18
19 return
20
21 def checkAlowedJob(self,jobs,nj_list):
22 listRunField=[]
23 run_jobToSave = {'status' :'C', \
24 'statusScheduler' : 'Created'}
25
26 task=common._db.getTask(jobs)
27 for job in task.jobs:
28 st = job.runningJob['status']
29 nj = job['id']
30 if st in ['K','A','SE','E']:
31 nj_list.append(int(nj))
32 listRunField.append(run_jobToSave)
33 elif st == 'C':
34 common.logger.message('Job #'+`int(nj)`+' has status '+str(job.runningJob['statusScheduler'])+' not yet submitted!!!')
35 elif st in ['SD','D']:
36 common.logger.message('Job #'+`int(nj)`+' has status '+str(job.runningJob['statusScheduler'])+' must be retrieved before resubmission')
37 else:
38 common.logger.message('Job #'+`nj`+' has status '+str(job.runningJob['statusScheduler'])+' must be "killed" before resubmission')
39
40 if len(nj_list) == 0 :
41 msg='No jobs to resubmit'
42 raise CrabException(msg)
43 else:
44 common._db.updateRunJob_(nj_list, listRunField )
45 return nj_list
46
47 if UseServer==1: SubmitterServer.__init__(self, cfg_params, nj_list, 'range')
48
49 def manageNewRunJobs(self,nj_list):
50 """
51 Get new running instances
52 """
53 common._db.newRunJobs(nj_list)
54 return