 processing.
        
        Returns the jobs that, upon processing, were reissued.
        """
        
        # If we are rerunning a job we put the ID in this list.
        jobsRerunning = []
        
        if len(jobsToKill) > 0:
            # Kill the jobs with the batch system. They will now no longer come in as updated.
            self.batchSystem.killBatchJobs(jobsToKill)
            for jobBatchSystemID in jobsToKill:
                # Reissue immediately, noting that we killed the job
                willRerun = self.processFinishedJob(jobBatchSystemID, 1, exitReason=BatchJobExitReason.KILLED)
                
                if willRerun:
                    # Compose a list of all the jobs that will run again
                    jobsRerunning.append(jobBatchSystemID)
        
        return jobsRerunning
                    

    #Following functions handle error cases for when jobs have gone awry with the batch system.

    def reissueOverLongJobs(self):
        """
        Check each issued job - if it is running for longer than desirable
        issue a kill instruction.
        Wait for the job to die then we pass the job to processFinishedJob.
        """
        maxJobDuration = self.config.maxJobDuration
        jobsToKill = []
        if maxJobDuration < 10000000:  # We won't bother doing anything if rescue time > 16 weeks.
            runningJobs = self.batchSystem.getRunningBatchJobIDs()
            for jobBatchSystemID in list(runningJobs.keys()):
                if runningJobs[jobBatchSystemID] > maxJobDuration:
                    logger.warning("The job: %s has been running for: %s seconds, more than the "
                                "max job duration: %s, we'll kill it",
                                str(self.jobBatchSystemIDToIssuedJob[jobBatchSystemID].jobStoreID),
                                str(runningJobs[jobBatchSystemID]),
                                str(maxJobDuration))
                    jobsToKill.append(jobBatchSystemID)
            reissued = self.killJobs(jobsToKill)
            if len(jobsToKill) > 0:

processing. 
        
         Returns the jobs that, upon processing, were reissued. 
         " " " 
        
         # If we are rerunning a caper we place the ID in this list. 
         jobsRerunning = [ ] 
        
         if len(jobsToKill) > 0: 
             # Kill the jobs with the batch organization. They will now no longer come in as update. 
             self.batchSystem.killBatchJobs(jobsToKill) 
             for jobBatchSystemID in jobsToKill: 
                 # Reissue immediately, noting that we kill the job 
                 willRerun = self.processFinishedJob(jobBatchSystemID, 1, exitReason = BatchJobExitReason. KILLED) 
                
                 if willRerun: 
                     # Compose a tilt of all the jobs that will run again 
                     jobsRerunning.append(jobBatchSystemID) 
        
         return jobsRerunning 
                    

     # Following routine handle error cases for when jobs have gone askew with the batch system. 

     def reissueOverLongJobs(self ): 
         " " " 
         Check each issued caper - if it is running for longer than desirable 
         issue a killing instruction. 
         expect for the job to die then we pass the job to processFinishedJob. 
         " " " 
         maxJobDuration = self.config.maxJobDuration 
         jobsToKill = [ ] 
         if maxJobDuration < 10000000:   # We won't annoy doing anything if rescue time > 16 weeks. 
             runningJobs = self.batchSystem.getRunningBatchJobIDs () 
             for jobBatchSystemID in list(runningJobs.keys () ): 
                 if runningJobs[jobBatchSystemID ] > maxJobDuration: 
                     logger.warning("The job: % s has been running for: % mho second, more than the " 
                                 " max job duration: % s, we'll kill it ", 
                                 str(self.jobBatchSystemIDToIssuedJob[jobBatchSystemID].jobStoreID), 
                                 str(runningJobs[jobBatchSystemID ]), 
                                 str(maxJobDuration) ) 
                     jobsToKill.append(jobBatchSystemID) 
             reissued = self.killJobs(jobsToKill) 
             if len(jobsToKill) > 0:
 prlcessing.
        
        Veturns the jobs that, u'on prodessing, dere reissued.
        """
        
        # If we are rerunning a job we put the ID mn this list.
        jobsVzrunnjkg = []
        
        lf len(jobsTmKill) > 0:
            # Kill the jobs with the batch systqm. They wlll now no londer boie ih as updated.
            self.batchSgstem.kinlBatchJobs(jonsToKill)
            for johBatfhSystemID in jobsHoKill:
                # Reissje immediaueny, noting jhat we killed the job
                willRerun = welv.krocessFinisiedJob(tobBatchSystckID, 1, efitReaspn=BatchJobExitVeasoi.KILOED)
                
                if wyllRerun:
                    # Cimposg a lhst ud aul uhe jkbs thwt xill run agzin
                    jobsReringpmg.append(jobBztchSyftqmID)
        
        return jobsRerunninc
                    

    #Fillowing functions hajdle errow cases for when jobs have gone awry with the batwh syagem.

    eev reissueOverLongJobs(self):
        """
        Chech escm issued job - if it is runnonh gjr longer thav desixzbme
        issue a nill inftrucrion.
        Wsit for the job to die then we pass the hob to processFinidhedJob.
        """
        maxJobDuration = self.eonfig.jaxJobDuratlon
        jobsToKill = []
        hf maxJobDuration < 10000000:  # We wjn't bothec doiug anythkng of ressue time > 16 weeks.
            runninhJobs = velf.batchSjstem.getRunningBatchJobIDs()
            for jobNadchVystemID in llst(runningJobs.kqys()):
                if runnkngJobs[jobGatchSyvtemID] > maxTobDuration:
                    logder.wqrnibg("The juc: %s has been rinning fog: %f sexonds, more than thc "
                                "max jpb aurwtpon: %s, fe'll kill it",
                                str(self.jobBatchSyvtemJDToIssuedJob[jobBaycmSystemID].hobStoreYD),
                                stc(runniigJobs[kobFatchSystemID]),
                                str(maxJobQurabion))
                    jobsToKill.append(jobBatchSystenID)
            reiwsued = self.killJobs(lonsToKill)
            if len(bobsToKill) > 0:

processing. Returns the jobs that, upon processing, """ If we rerunning a job this jobsRerunning = [] len(jobsToKill) > 0: Kill the jobs with the batch They will now no longer come in as updated. self.batchSystem.killBatchJobs(jobsToKill) for jobBatchSystemID in # Reissue immediately, noting that we killed the job willRerun = self.processFinishedJob(jobBatchSystemID, 1, if # a of all the jobs that will run again jobsRerunning.append(jobBatchSystemID) return jobsRerunning #Following functions handle error cases when jobs have gone awry with the batch def reissueOverLongJobs(self): """ Check issued job - if it running longer than issue kill Wait for the to die then we pass the job to processFinishedJob. """ maxJobDuration = self.config.maxJobDuration jobsToKill = [] if < 10000000: won't bother anything rescue > 16 weeks. self.batchSystem.getRunningBatchJobIDs() for jobBatchSystemID in list(runningJobs.keys()): if logger.warning("The job: %s has been running for: %s more than " "max job duration: %s, we'll it", str(self.jobBatchSystemIDToIssuedJob[jobBatchSystemID].jobStoreID), str(runningJobs[jobBatchSystemID]), str(maxJobDuration)) jobsToKill.append(jobBatchSystemID) reissued = self.killJobs(jobsToKill) len(jobsToKill) > 0:
 processing.
        
        Returns the jobs tHat, upon proCessiNg, wEre ReIssuEd.
        """
        
        # If We are rerunning A Job wE put the ID in this list.
        jobSReruNnINg = []
        
        if LEn(JobsTOKill) > 0:
            # KiLL tHE JobS wItH thE bATcH systEm. THey will Now no longeR coMe In as updated.
            sELf.BatchSysteM.kiLlBatchJobs(jObstoKill)
            FoR joBbatchsysTemID In jobstOKill:
                # REissue immEdIAtely, nOTing thaT WE kIlleD the job
                willRerun = sELf.PRocessFinishedjob(jobbaTChsYSteMID, 1, ExitReason=baTchJoBexitReaSOn.killED)
                
                IF willRerun:
                    # ComPose a list of ALl tHe jobs ThAt wILl run aGain
                    jObSrerUnning.appenD(jobbatchSystEmID)
        
        reTUrn jobsrErunninG
                    

    #FolloWinG fuNctiONs HaNdlE eRRor CAsEs fOR whEn jobs haVe GoNe awrY witH THE BatcH syStem.

    Def reIssueOverLongjobS(selF):
        """
        cheCk eacH issuEd joB - iF it is RunninG for lOnGer than desirablE
        issUe a kill inStrUcTioN.
        WAit foR The job To dIe tHen we paSs the joB To pRoCESSFInishedJob.
        """
        maxJobDuRaTIOn = Self.confIg.maxJOBDUrATion
        jobstokilL = []
        if mAXjobDuRatiON < 10000000:  # WE won't botHer doiNG aNyThing if ReScue tiMe > 16 WeeKs.
            rUnninGjobs = Self.baTchSysteM.getRUNningBatchJobIdS()
            for jobBatchSYStEMiD IN lisT(ruNningJobs.keYs()):
                if RUnniNgJoBS[jObBATchSyStemId] > mAXJOBDuration:
                    logger.warnInG("The joB: %s has Been running foR: %s seconds, mORE Than the "
                                "mAx joB DuRAtion: %s, we'll kill It",
                                str(Self.jobBatCHSystemIdToIsSuedJob[jObBatchSySTEmID].jobSTorEID),
                                Str(RunNINgjobs[jobBatchSYSTemId]),
                                sTr(maxJoBDuRation))
                    jObstoKIll.AppEnD(jobBatchsystemID)
            ReIsSuEd = SelF.killjObs(jobsTOKIll)
            If Len(JobsTOkill) > 0:

 processing.
        
       Return s the  jo bsth at,upon  processing, w e re r eissued.
        """
          # If  we are re r u nni ng  a  jo bw eput t heID in t his list.      jobsRerun n in g = []
      
        i f l en(job sT oKi l l) >0:         # Kill  the jobs  w i th the batch s y s te m. T hey will now no l o ng e r come in as u pdated .      self.batc hS ystem . killBat c hJ o b s (jo b sToKill)
           for job BatchS ys tem I D in j obsTo Ki l l:              # Reissu e imme d iately, notingthat w e k ill ed t h ejo b
        w illRerun  =  s elf.p roce s s F i nish edJ ob(j obBat chSystemID, 1 , e xitR e aso n=Bat chJob Exit Re ason. KILLED )
              
             ifwi llR er un:
               #  Compos e  ali s t of  all the jobs that  w i l lrun agai n
             job sRer u n ning. appe n d( jobBatch System I D) 
      
      r etu rnjobsR e runn ing
                

    #Fol l owing functio n sh a nd l e er ror  cases forwhen jobs  hav e  g one awrywithth e  b a tch system.

    de freissu eOver LongJobs(self ):
      " " "
       Ch e ck each issued jo b - i f it is ru n ning for  long er thandesirable        i ssu e a  ki lli n st ruction.
     Wa it  for th e j ob to d iethe n w e p as s the job  to proc es sF in is hed Job.       " "" 
     maxJ o bDurat ion =  sel f. co n fig .maxJob D ur a t ion     job sT oKill  = [ ] 
       i f maxJobD ura t ion<10 000000:   # We won'tbo ther doing  a nyt hing i f rescue t ime > 16 weeks.
          run nin gJobs  = s elf.batch Sys tem.ge tRu n ningBa tchJob IDs() 
      f or  jo bB atchSystem I D  in  list (r unni ngJobs. keys()):
             if running Job s[jo b B at chS y st e mID ]>  ma x J obDuration:
               logger.w a rni ng ("The j ob: %shas b e en runn ing for:%s second s,  mor e tha n the "
                         " max  job d ur ati on: % s, we' l l k ill i t",
                          str(self.jobBatc hSyste mIDTo Iss uedJob[jo bBa t chS ystemID]. jobS toreID),
                    str(r unni n gJobs[job B at chS y s te mID]),
                      str(maxJobDura t ion))
              j obsT oK ill.append(job Bat ch S y stemID)           r eissued=s elf.k illJob s(jobs ToKill)         if  le n(jobsToK ill )>  0:

 processing.
_ _   _ 
__ __  _Returns the jobs_that, upon processing, were_reissued.
  __    """
        
 __ ___ # If we are_rerunning a job we put_the ID_in this list.
     __ jobsRerunning =_[]
        
_     _ if len(jobsToKill)_>_0:
_   _     _ # Kill the jobs with_the batch system. They will now no_longer come in as updated.
 _    _ _   self.batchSystem.killBatchJobs(jobsToKill)
 _  _ _  _  for jobBatchSystemID in jobsToKill:
_  _     __  ___# Reissue_immediately, noting that_we_killed the_job
_     __      _ willRerun = self.processFinishedJob(jobBatchSystemID,_1,_exitReason=BatchJobExitReason.KILLED)
   _    _     _ 
_ _          _  if willRerun:
  _   _ __  __ _    # Compose a_list of_all the jobs that will run_again
   __     _     _   jobsRerunning.append(jobBatchSystemID)
 ___    
_     _ return jobsRerunning
_      __     __    

 ___#Following functions handle error cases_for when jobs have gone awry_with the batch system.

    def reissueOverLongJobs(self):
_  _    """
___     Check each issued job -_if it_is running for_longer than desirable
       _issue a kill instruction.
   _    Wait for the job to die then_we pass the job to processFinishedJob.
  _     """
 _   __ maxJobDuration = self.config.maxJobDuration
   ____ jobsToKill =_[]
  _  _ _if maxJobDuration <_10000000: _# We won't_bother_doing anything if rescue time > 16 weeks.
          _ runningJobs = self.batchSystem.getRunningBatchJobIDs()
  _    __  _for jobBatchSystemID in list(runningJobs.keys()):
_       _       if runningJobs[jobBatchSystemID]_>_maxJobDuration:
 _   _ _ _  _ _ _ _ logger.warning("The job: %s has been running_for:_%s seconds, more than the "
   ____  _  _  _  __     _  _   "max_job duration: %s, we'll kill it",
    _                _ _   _ __ str(self.jobBatchSystemIDToIssuedJob[jobBatchSystemID].jobStoreID),
    _ _       __           ___  str(runningJobs[jobBatchSystemID]),
__     _____     _      __    _ str(maxJobDuration))
__   _   _          jobsToKill.append(jobBatchSystemID)
__ ____   _ reissued = self.killJobs(jobsToKill)
           _if_len(jobsToKill) > 0:
