ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/CRAB/python/Resubmitter.py
Revision: 1.16.2.2
Committed: Tue Oct 13 13:58:53 2009 UTC (15 years, 6 months ago) by spiga
Content type: text/x-python
Branch: CRAB_2_6_X_br
CVS Tags: CRAB_2_6_6_pre6, CRAB_2_6_6_pre5, CRAB_2_6_6_pre4, CRAB_2_6_6_pre3, CRAB_2_6_6_pre2, CRAB_2_6_6_check, CRAB_2_6_6, CRAB_2_6_6_pre1, CRAB_2_6_5, CRAB_2_6_5_pre1, CRAB_2_6_4, CRAB_2_6_4_pre1, CRAB_2_6_3_patch_2
Changes since 1.16.2.1: +1 -1 lines
Log Message:
minor fixes

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 spiga 1.16.2.1 from PhEDExDatasvcInfo import PhEDExDatasvcInfo
6    
7 slacapra 1.1
8     class Resubmitter(Submitter):
9 spiga 1.3 def __init__(self, cfg_params, jobs):
10     self.cfg_params = cfg_params
11    
12 slacapra 1.1 nj_list = []
13 ewv 1.6
14 spiga 1.16.2.1 self.copy_data = int(cfg_params.get('USER.copy_data',0))
15     self.check_RemoteDir = int(cfg_params.get('USER.check_user_remote_dir',0))
16 slacapra 1.14 nj_list = self.checkAllowedJob(jobs,nj_list)
17 spiga 1.12 common.logger.info('Jobs '+str(nj_list)+' will be resubmitted')
18 spiga 1.3 Submitter.__init__(self, cfg_params, nj_list, 'range')
19 ewv 1.6
20 spiga 1.3 return
21 slacapra 1.1
22 spiga 1.16.2.1 def checkRemoteDir(self,task):
23    
24     if self.copy_data==1:
25     stageout = PhEDExDatasvcInfo(self.cfg_params)
26     endpoint, lfn, SE, SE_PATH, user = stageout.getEndpoint()
27     common.scheduler.checkRemoteDir(endpoint,eval(task['outfileBasename']))
28    
29    
30 slacapra 1.14 def checkAllowedJob(self,jobs,nj_list):
31 spiga 1.3 listRunField=[]
32     task=common._db.getTask(jobs)
33 spiga 1.16.2.2 # if self.check_RemoteDir == 1 : self.checkRemoteDir(task)
34 spiga 1.3 for job in task.jobs:
35 slacapra 1.14 st = job.runningJob['state']
36     nj = int(job['jobId'])
37     if st in ['KillSuccess','SubFailed','Cleared','Aborted']:
38     #['K','A','SE','E','DA','NS']:
39     nj_list.append(nj)
40     elif st == 'Created':
41     common.logger.info('Job #'+`nj`+' last action was '+str(job.runningJob['state'])+' not yet submitted: use -submit')
42     elif st in ['Terminated']:
43     common.logger.info('Job #'+`nj`+' last action was '+str(job.runningJob['state'])+' must be retrieved (-get) before resubmission')
44 spiga 1.3 else:
45 slacapra 1.14 common.logger.info('Job #'+`nj`+' last action was '+str(job.runningJob['state'])+' actual status is '\
46     +str(job.runningJob['statusScheduler'])+' must be killed (-kill) before resubmission')
47 spiga 1.16 if (job.runningJob['state']=='KillRequested'): common.logger.info('\t\tthe previous Kill request is being processed')
48 slacapra 1.14
49 spiga 1.4
50     if len(nj_list) == 0 :
51 spiga 1.3 msg='No jobs to resubmit'
52     raise CrabException(msg)
53 spiga 1.5
54 spiga 1.15 common._db.updateJob_(nj_list, [{'closed':'N'}]*len(nj_list))
55 slacapra 1.14 # Get new running instances
56 spiga 1.5 common._db.newRunJobs(nj_list)
57 slacapra 1.14
58     return nj_list