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.3 by spiga, Sat Apr 26 14:42:12 2008 UTC vs.
Revision 1.11 by mcinquil, Mon Feb 9 14:51:38 2009 UTC

# Line 1 | Line 1
1   from Submitter import Submitter
2   import common
3   from crab_util import *
4 + from crab_exceptions import *
5  
6   class Resubmitter(Submitter):
7      def __init__(self, cfg_params, jobs):
8          self.cfg_params = cfg_params
9  
10          nj_list = []
11 <      
11 >
12          nj_list = self.checkAlowedJob(jobs,nj_list)
13 <      
13 >
14 >
15          common.logger.message('Jobs '+str(nj_list)+' will be resubmitted')
16          Submitter.__init__(self, cfg_params, nj_list, 'range')
17 <
17 >
18          return
19  
20      def checkAlowedJob(self,jobs,nj_list):
21          listRunField=[]
20        run_jobToSave = {'status' :'C', \
21                         'statusScheduler' : 'Created', \
22                         'closed' : 'N', \
23                         'applicationReturnCode' : '',\
24                         'wrapperReturnCode' : '' }
22  
23          task=common._db.getTask(jobs)
24          for job in task.jobs:
25              st = job.runningJob['status']
26 <            nj = job['id']
27 <            if st in ['K','A','SE','E']:
26 >            nj = job['jobId']
27 >            if st in ['K','A','SE','E','UE','DA','NS']:
28                  nj_list.append(int(nj))
32                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')
33              else:
34                  common.logger.message('Job #'+`nj`+' has status '+str(job.runningJob['statusScheduler'])+' must be "killed" before resubmission')
35 <        try:
36 <            1/len(nj_list)  
41 <        except Exception:
35 >
36 >        if len(nj_list) == 0 :
37              msg='No jobs to resubmit'
38              raise CrabException(msg)
39 +        self.manageNewRunJobs(nj_list)
40 +        return nj_list
41  
42 <        if len(nj_list)>0 :
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 >    def manageNewRunJobs(self,nj_list):
43 >        """
44 >        Get new running instances
45 >        """
46 >        common._db.newRunJobs(nj_list)
47 >        return

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines