Exemplo n.º 1
0
 def setid(self, job):
    analysis = utils.isJob(job)      
    jtype = "A" if analysis else "P"
    id =  job.get('jobsetID') 
    if id != None:  jtype = "A"
    else:
       id = job.get('taskID')
       if id != None:  jtype = "P"
       else:
          id = job.get('JediTaskID')
          if id != None:  jtype = "J"
    return "%s:%s" % (jtype, id )
Exemplo n.º 2
0
   def fillJobsetId(self,job,merge=None):
      analysis = utils.isJob(job)
      username = job['username']
      # jid = "jobsetID=<a href='%s?job=*&jobsetID=%s&user=%s'>%s</a>" % ( utils.monURL, job['jobsetID'],username, job['jobsetID'] )
      jobsetid = self.setid(job)
      jsetid = '%s:%s' % ( username, jobsetid )
      ## added to fix sorting bug ## 
      # if have_tmpuser == bool(0):
         # if not str(utils.cleanUserID(job['prodUserID'])) == "":
             # tmpuser = '******' % username
             # have_tmpuser = bool(1)
      # if have_tmpuser == bool(1):
         # if not tmpuser == username:
             # oneuser = bool(0)
      # if not int(job['jobsetID']) in tmpjslist:
         # tmpjslist.append(int(job['jobsetID']))
      ##############################
      jsets = self.jobsets()
      if  not  jsets.has_key('jobsets') : jsets['jobsets'] = {}
      jobsets =  jsets['jobsets']
      creationtDict = self.creationtDict()
      jobid = job['PandaID']
      attempt  = job.get('attemptNr',0)
      if  attempt>0 and job['parentID']==None and job['jobsetID']!=None:  attempt = 0  # workaround issue #https://savannah.XXXXX.ch/bugs/index.php?91176#comment6
      status   = job.get('jobStatus')
      if jsetid != None and not jobsets.has_key(jsetid):
         jobsets[jsetid] = {} 
         jobsets[jsetid]['analysis'] = analysis
         jobsets[jsetid]['workingGroup'] = job['workingGroup']
         jobsets[jsetid]['user'] = username
         jobsets[jsetid]['created'] = creationtDict[jobsetid]
         jobsets[jsetid]['latest']  = job.get('modificationTime',creationtDict[jobsetid])

         jobsets[jsetid]['site'] = job['computingSite']
         jobsets[jsetid]['inDS'] = job['prodDBlock']
         jobsets[jsetid]['outDS'] = job['destinationDBlock']
         jobsets[jsetid]['mergingJobs'] = { } 
         jobsets[jsetid]['attempt'] = attempt
         jobsets[jsetid]['jobs'] = {jobid: self.cleanjob(job) }
         jobsets[jsetid]['retried'] = 1 if self.isRetried(job) else 0
      else:
         jbTime = job.get('modificationTime')
         if jbTime != None and jobsets[jsetid]['latest'] < jbTime:
            jobsets[jsetid]['latest'] = jbTime

         jobsets[jsetid]['jobs'][jobid] = self.cleanjob(job)
         if self.isRetried(job): jobsets[jsetid]['retried'] += 1
         if jobsets[jsetid]['site'] != job['computingSite']:
              jobsets[jsetid]['site'] = self.fgMultiSiteSetLabel;
         jobsets[jsetid]['attempt'] += attempt+1
      try:
         if job['transformation'].find('buildJob') > 0:
            jobsets[jsetid]['libDS'] = job['destinationDBlock']
            jobsets[jsetid]['build'] = jobid 
         elif job['transformation'].find('runJob') > 0 or job['transformation'].find('runAthena') > 0:
            # set color
            pass
      except:
         pass
      if job['prodSourceLabel'] == 'user' and job['processingType'] == 'usermerge':
         mj = jobsets[jsetid]['mergingJobs'] 
         mj['all']  = mj.get('all',0) + 1
         mj[status] = mj.get(status,0) + 1
      elif utils.isValid(merge):
         try:
            # check  whether there is merging status for the job 
            tbuffer = pmt.checkMergeStatus( job['prodUserID'] ,job['jobDefinitionID'])
            if tbuffer != None:
               mj = jobsets[jsetid]['mergingJobs'] 
               status = tbuffer['status']
               if status in ( 'generated' ):
                  mj = jobsets[jsetid]['mergingJobs'] 
                  mj['all']=mj.get('all',0) + 1
                  mj[status] = mj.get(status,0) + 1
               elif status in ('NA'):   
                  pass 
               else:
                   mj[status] = len(tbuffer.get('mergeIDs',[]))
         except:
            pass