ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/CRAB/python/Resubmitter.py
Revision: 1.3
Committed: Sat Apr 26 14:42:12 2008 UTC (17 years ago) by spiga
Content type: text/x-python
Branch: MAIN
Changes since 1.2: +40 -38 lines
Log Message:
restored Resubmitter

File Contents

# User Rev Content
1 slacapra 1.1 from Submitter import Submitter
2     import common
3     from crab_util import *
4    
5     class Resubmitter(Submitter):
6 spiga 1.3 def __init__(self, cfg_params, jobs):
7     self.cfg_params = cfg_params
8    
9 slacapra 1.1 nj_list = []
10 spiga 1.3
11     nj_list = self.checkAlowedJob(jobs,nj_list)
12    
13     common.logger.message('Jobs '+str(nj_list)+' will be resubmitted')
14     Submitter.__init__(self, cfg_params, nj_list, 'range')
15    
16     return
17 slacapra 1.1
18 spiga 1.3 def checkAlowedJob(self,jobs,nj_list):
19     listRunField=[]
20     run_jobToSave = {'status' :'C', \
21     'statusScheduler' : 'Created', \
22     'closed' : 'N', \
23     'applicationReturnCode' : '',\
24     'wrapperReturnCode' : '' }
25 slacapra 1.1
26 spiga 1.3 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     try:
40     1/len(nj_list)
41     except Exception:
42     msg='No jobs to resubmit'
43     raise CrabException(msg)
44 slacapra 1.1
45 spiga 1.3 if len(nj_list)>0 :
46     common._db.updateRunJob_(nj_list, listRunField )
47     return nj_list
48    
49     if UseServer==1: SubmitterServer.__init__(self, cfg_params, nj_list, 'range')