ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/CRAB/python/Resubmitter.py
Revision: 1.4
Committed: Sat Apr 26 17:23:37 2008 UTC (17 years ago) by spiga
Content type: text/x-python
Branch: MAIN
CVS Tags: CRAB_2_2_0_pre17, CRAB_2_2_0_pre16, CRAB_2_2_0_pre15, CRAB_2_2_0_pre13
Changes since 1.3: +4 -5 lines
Log Message:
minor improvment

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