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

Comparing COMP/CRAB/python/DBinterface.py (file contents):
Revision 1.67 by farinafa, Fri Feb 19 15:13:37 2010 UTC vs.
Revision 1.72 by lolass, Mon Jan 21 11:22:46 2013 UTC

# Line 80 | Line 80 | class DBinterface:
80          """
81          opt={}
82          if optsToSave.get('server_mode',0) == 1: opt['serverName']=optsToSave['server_name']
83 +        if common.scheduler.name().upper() not in ['LSF', 'CAF', 'SGE', 'PBS']:
84 +            checkNewSiteDB()
85          opt['name']= getUserName()+ '_' + string.split(common.work_space.topDir(),'/')[-2]+'_'+common.work_space.task_uuid()
86 <        task = Task( opt )
86 >        task = Task( opt )
87          try:
88              common.bossSession.saveTask( task )
89          except Exception, e :
# Line 350 | Line 352 | class DBinterface:
352                  if r.getAttribute('id') in [ id, 'all']:
353                      rForJ = r
354                      break
355 +
356 +            # check if rForJ is None
357 +            if rForJ is None:
358 +                common.logger.debug( "Missing XML element for job %s, skip update status"%str(id) )
359 +                continue
360 +            
361              ## Check the submission number and create new running jobs on the client side
362              if rForJ.getAttribute('resubmit') != 'None' and (rForJ.getAttribute('status') not in ['Cleared','Killed','Done','Done (Failed)','Not Submitted', 'Cancelled by user']) :
363                  if int(job.runningJob['submission']) < int(rForJ.getAttribute('resubmit')) + 1:
# Line 394 | Line 402 | class DBinterface:
402  
403                  job.runningJob['state'] = str( rForJ.getAttribute('action') )
404            
405 <                # Needed for unique naming of the output    
406 <                job.runningJob['submission'] =  int(rForJ.getAttribute('submission'))
405 >                # Needed for unique naming of the output.
406 >                job['arguments'] = "%d %s"%(job.runningJob['jobId'], str(rForJ.getAttribute('submission')).strip() )
407            
408          common.bossSession.updateDB( task_new )
409          return
# Line 407 | Line 415 | class DBinterface:
415                  return False
416          return True
417  
418 <    # Method to update arguments w.r.t. resubmission number in order to grant unique output
418 >    # Method to update arguments w.r.t. resubmission number in order to grant unique output
419      def updateResubAttribs(self, jobsL):
420          task = self.getTask(jobsL)
421          for j in task.jobs:
422              common.bossSession.getRunningInstance(j)
423 <            newArgs = "%d %d"%(j.runningJob['jobId'], j.runningJob['submission'])
423 >            try:
424 >                resubNum = int(str(j['arguments']).split(' ')[1]) + 1
425 >            except Exception, e:
426 >                resubNum = j.runningJob['submission']
427 >            newArgs = "%d %d"%(j.runningJob['jobId'], resubNum)
428              j['arguments'] = newArgs
417            
418        common.bossSession.updateDB(task)
419        return
429  
430 +        common.bossSession.updateDB(task)
431 +        return
432  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines