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.9 by spiga, Fri Jul 4 14:12:10 2008 UTC vs.
Revision 1.15 by spiga, Fri Jun 12 15:02:51 2009 UTC

# Line 9 | Line 9 | class Resubmitter(Submitter):
9  
10          nj_list = []
11  
12 <        nj_list = self.checkAlowedJob(jobs,nj_list)
12 >        nj_list = self.checkAllowedJob(jobs,nj_list)
13  
14 <
15 <        common.logger.message('Jobs '+str(nj_list)+' will be resubmitted')
14 >        common.logger.info('Jobs '+str(nj_list)+' will be resubmitted')
15          Submitter.__init__(self, cfg_params, nj_list, 'range')
16  
17          return
18  
19 <    def checkAlowedJob(self,jobs,nj_list):
19 >    def checkAllowedJob(self,jobs,nj_list):
20          listRunField=[]
21  
22          task=common._db.getTask(jobs)
23          for job in task.jobs:
24 <            st = job.runningJob['status']
25 <            nj = job['jobId']
26 <            if st in ['K','A','SE','E','UE']:
27 <                nj_list.append(int(nj))
28 <            elif st == 'C':
29 <                common.logger.message('Job #'+`int(nj)`+' has status '+str(job.runningJob['statusScheduler'])+' not yet submitted!!!')
30 <            elif st in ['SD','D']:
31 <                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)
39        self.manageNewRunJobs(nj_list)
40        return nj_list
42  
43 <    def manageNewRunJobs(self,nj_list):
44 <        """
44 <        Get new running instances
45 <        """
43 >        common._db.updateJob_(nj_list, [{'closed':'N'}]*len(nj_list))
44 >        # Get new running instances
45          common._db.newRunJobs(nj_list)
46 <        return
46 >
47 >        return nj_list

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines