Revision: | 1.17 |
Committed: | Tue Oct 13 08:22:39 2009 UTC (15 years, 6 months ago) by spiga |
Content type: | text/x-python |
Branch: | MAIN |
CVS Tags: | CRAB_2_8_4_patch3, CRAB_2_8_5_pre2, CRAB_2_8_4_patch2, CRAB_2_8_5_pre1, CRAB_2_8_4_patch1, CRAB_2_8_4, CRAB_2_8_4_pre5, CRAB_2_8_4_pre4, CRAB_2_8_4_pre3, CRAB_2_8_4_pre2, CRAB_2_8_4_pre1, CRAB_2_8_3, CRAB_2_8_3_pre4, CRAB_2_8_3_pre3, CRAB_2_8_3_pre2, CRAB_2_8_3_pre1, CRAB_2_8_2_patch1, CRAB_2_8_2, CRAB_2_8_2_pre5, CRAB_2_8_2_pre4, CRAB_2_8_2_pre3, CRAB_2_8_2_pre2, CRAB_2_8_2_pre1, CRAB_2_8_1, CRAB_2_8_0, CRAB_2_8_0_pre1, CRAB_2_7_10_pre3, CRAB_2_7_9_patch2_pre1, CRAB_2_7_10_pre2, CRAB_2_7_10_pre1, CRAB_2_7_9_patch1, CRAB_2_7_9, CRAB_2_7_9_pre5, CRAB_2_7_9_pre4, CRAB_2_7_9_pre3, CRAB_2_7_9_pre2, CRAB_2_7_8_patch2, CRAB_2_7_9_pre1, CRAB_2_7_8_patch2_pre1, CRAB_2_7_8_patch1, CRAB_2_7_8_patch1_pre1, CRAB_2_7_8, CRAB_2_7_8_pre3, CRAB_2_7_8_pre2, CRAB_2_7_8_dash3, CRAB_2_7_8_dash2, CRAB_2_7_8_dash, CRAB_2_7_7_patch1, CRAB_2_7_7_patch1_pre1, CRAB_2_7_8_pre1, CRAB_2_7_7, CRAB_2_7_7_pre2, CRAB_2_7_7_pre1, CRAB_2_7_6_patch1, CRAB_2_7_6, CRAB_2_7_6_pre1, CRAB_2_7_5_patch1, CRAB_2_7_5, CRAB_2_7_5_pre3, CRAB_2_7_5_pre2, CRAB_2_7_5_pre1, CRAB_2_7_4_patch1, CRAB_2_7_4, CRAB_2_7_4_pre6, CRAB_2_7_4_pre5, CRAB_2_7_4_pre4, CRAB_2_7_4_pre3, CRAB_2_7_4_pre2, CRAB_2_7_4_pre1, CRAB_2_7_3, CRAB_2_7_3_pre3, CRAB_2_7_3_pre3_beta, CRAB_2_7_3_pre2, CRAB_2_7_3_pre2_beta, CRAB_2_7_3_pre1, CRAB_2_7_3_beta3, CRAB_2_7_3_beta2, CRAB_2_7_3_beta1, CRAB_2_7_3_beta, CRAB_2_7_2_p1, CRAB_2_7_1_branch_firstMERGE, CRAB_2_7_2, CRAB_2_7_2_pre4, CRAB_2_7_2_pre3, CRAB_2_7_2_pre2, CRAB_2_7_2_pre1, CRAB_2_7_1, fede_170310, CRAB_2_7_1_pre12, CRAB_2_7_1_pre11, CRAB_2_7_1_pre10, CRAB_2_7_1_pre9, CRAB_LumiMask, CRAB_2_7_lumi, from_LimiMask, CRAB_2_7_1_pre8, CRAB_2_7_1_pre6, CRAB_2_7_1_pre5, CRAB_2_7_1_wmbs_pre4, CRAB_2_7_1_pre4, CRAB_2_7_1_pre3, CRAB_2_7_1_pre2, CRAB_2_7_1_pre1, CRAB_2_7_0, CRAB_2_7_0_pre8, CRAB_2_7_0_pre7, CRAB_2_7_0_pre6, CRAB_2_7_0_pre5 |
Branch point for: | CRAB_multiout, CRAB_2_7_1_branch, Lumi2_8 |
Changes since 1.16: | +13 -2 lines |
Log Message: | check remote dir before resubmission |
# | Content |
---|---|
1 | from Submitter import Submitter |
2 | import common |
3 | from crab_util import * |
4 | from crab_exceptions import * |
5 | from PhEDExDatasvcInfo import PhEDExDatasvcInfo |
6 | |
7 | |
8 | class Resubmitter(Submitter): |
9 | def __init__(self, cfg_params, jobs): |
10 | self.cfg_params = cfg_params |
11 | |
12 | nj_list = [] |
13 | |
14 | 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 | nj_list = self.checkAllowedJob(jobs,nj_list) |
17 | common.logger.info('Jobs '+str(nj_list)+' will be resubmitted') |
18 | Submitter.__init__(self, cfg_params, nj_list, 'range') |
19 | |
20 | return |
21 | |
22 | 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 | def checkAllowedJob(self,jobs,nj_list): |
31 | listRunField=[] |
32 | task=common._db.getTask(jobs) |
33 | if self.check_RemoteDir == 1 : self.checkRemoteDir(task) |
34 | for job in task.jobs: |
35 | 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 | else: |
45 | 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 | if (job.runningJob['state']=='KillRequested'): common.logger.info('\t\tthe previous Kill request is being processed') |
48 | |
49 | |
50 | if len(nj_list) == 0 : |
51 | msg='No jobs to resubmit' |
52 | raise CrabException(msg) |
53 | |
54 | common._db.updateJob_(nj_list, [{'closed':'N'}]*len(nj_list)) |
55 | # Get new running instances |
56 | common._db.newRunJobs(nj_list) |
57 | |
58 | return nj_list |