ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/CRAB/python/Resubmitter.py
(Generate patch)

Comparing COMP/CRAB/python/Resubmitter.py (file contents):
Revision 1.4 by spiga, Sat Apr 26 17:23:37 2008 UTC vs.
Revision 1.15 by spiga, Fri Jun 12 15:02:51 2009 UTC

# Line 8 | Line 8 | class Resubmitter(Submitter):
8          self.cfg_params = cfg_params
9  
10          nj_list = []
11 <      
12 <        nj_list = self.checkAlowedJob(jobs,nj_list)
13 <      
14 <        common.logger.message('Jobs '+str(nj_list)+' will be resubmitted')
11 >
12 >        nj_list = self.checkAllowedJob(jobs,nj_list)
13 >
14 >        common.logger.info('Jobs '+str(nj_list)+' will be resubmitted')
15          Submitter.__init__(self, cfg_params, nj_list, 'range')
16 <
16 >
17          return
18  
19 <    def checkAlowedJob(self,jobs,nj_list):
19 >    def checkAllowedJob(self,jobs,nj_list):
20          listRunField=[]
21        run_jobToSave = {'status' :'C', \
22                         'statusScheduler' : 'Created', \
23                         'closed' : 'N', \
24                         'applicationReturnCode' : '',\
25                         'wrapperReturnCode' : '' }
21  
22          task=common._db.getTask(jobs)
23          for job in task.jobs:
24 <            st = job.runningJob['status']
25 <            nj = job['id']
26 <            if st in ['K','A','SE','E']:
27 <                nj_list.append(int(nj))
28 <                listRunField.append(run_jobToSave)
29 <            elif st == 'C':
30 <                common.logger.message('Job #'+`int(nj)`+' has status '+str(job.runningJob['statusScheduler'])+' not yet submitted!!!')
31 <            elif st in ['SD','D']:
32 <                common.logger.message('Job #'+`int(nj)`+' has status '+str(job.runningJob['statusScheduler'])+' must be retrieved before resubmission')
24 >            st = job.runningJob['state']
25 >            nj = int(job['jobId'])
26 >            if st in ['KillSuccess','SubFailed','Cleared','Aborted']:
27 >                #['K','A','SE','E','DA','NS']:
28 >                nj_list.append(nj)
29 >            elif st == 'Created':
30 >                common.logger.info('Job #'+`nj`+' last action was '+str(job.runningJob['state'])+' not yet submitted: use -submit')
31 >            elif st in ['Terminated']:
32 >                common.logger.info('Job #'+`nj`+' last action was '+str(job.runningJob['state'])+' must be retrieved (-get) before resubmission')
33              else:
34 <                common.logger.message('Job #'+`nj`+' has status '+str(job.runningJob['statusScheduler'])+' must be "killed" before resubmission')
34 >                common.logger.info('Job #'+`nj`+' last action was '+str(job.runningJob['state'])+' actual status is '\
35 >                        +str(job.runningJob['statusScheduler'])+' must be killed (-kill) before resubmission')
36 >                if (job.runningJob['state']=='KillRequest'): common.logger.info('\t\tthe previous Kill request is being processed')
37 >
38  
39          if len(nj_list) == 0 :
40              msg='No jobs to resubmit'
41              raise CrabException(msg)
42 <        else:
43 <            common._db.updateRunJob_(nj_list, listRunField )
44 <            return nj_list
45 <        
46 <        if UseServer==1:  SubmitterServer.__init__(self, cfg_params, nj_list, 'range')
42 >
43 >        common._db.updateJob_(nj_list, [{'closed':'N'}]*len(nj_list))
44 >        # Get new running instances
45 >        common._db.newRunJobs(nj_list)
46 >
47 >        return nj_list

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines