Changeset 182


Ignore:
Timestamp:
08/03/05 14:59:16 (19 years ago)
Author:
bastiaans
Message:

daemon/togad.py:

  • Additional heartbeat check and minor changes, short jobs are labeled with a incorrect finished date
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/daemon/togad.py

    r179 r182  
    410410                """
    411411               
    412                 heartbeat = 0
     412                self.heartbeat = 0
    413413               
    414414                jobinfo = { }
     
    449449
    450450                                if check_change:
    451                                         if self.jobinfoChanged( self.jobAttrs, job_id, jobinfo ) and self.jobAttrs[ job_id ]['status'] != 'E':
     451                                        if self.jobinfoChanged( self.jobAttrs, job_id, jobinfo ) and self.jobAttrs[ job_id ]['status'] in [ 'R', 'Q' ]:
    452452                                                self.jobAttrs[ job_id ]['stop_timestamp'] = ''
    453453                                                self.jobAttrs[ job_id ] = self.setJobAttrs( self.jobAttrs[ job_id ], jobinfo )
     
    467467                """When all metrics have gone, check if any jobs have finished"""
    468468
    469                 for jobid, jobinfo in self.jobAttrs.items():
    470 
    471                         # This is an old job, not in current jobinfo list anymore
    472                         # it must have finished, since we _did_ get a new heartbeat
    473                         #
    474                         mytime = int( jobinfo['reported'] ) + int( jobinfo['poll_interval'] )
    475 
    476                         if mytime < self.heartbeat and jobid not in self.jobs_processed and jobinfo['status'] == 'R':
    477 
    478                                 if not jobid in self.jobs_processed:
    479                                         self.jobs_processed.append( jobid )
    480 
    481                                 self.jobAttrs[ jobid ]['status'] = 'F'
    482                                 self.jobAttrs[ jobid ]['stop_timestamp'] = str( mytime )
    483 
    484                                 if not jobid in self.jobs_to_store:
    485                                         self.jobs_to_store.append( jobid )
    486 
    487                 debug_msg( 1, 'torque_xml_thread(): Storing..' )
    488 
    489                 for jobid in self.jobs_to_store:
    490                         if self.jobAttrs[ jobid ]['status'] in [ 'R', 'Q', 'F' ]:
    491                                 self.ds.storeJobInfo( jobid, self.jobAttrs[ jobid ] )   
    492 
    493                 debug_msg( 1, 'torque_xml_thread(): Done storing.' )
    494 
    495                 self.jobs_processed = [ ]
    496                 self.jobs_to_store = [ ]
     469                if self.heartbeat:
     470                        for jobid, jobinfo in self.jobAttrs.items():
     471
     472                                # This is an old job, not in current jobinfo list anymore
     473                                # it must have finished, since we _did_ get a new heartbeat
     474                                #
     475                                mytime = int( jobinfo['reported'] ) + int( jobinfo['poll_interval'] )
     476
     477                                if mytime < self.heartbeat and jobid not in self.jobs_processed and jobinfo['status'] == 'R':
     478
     479                                        if not jobid in self.jobs_processed:
     480                                                self.jobs_processed.append( jobid )
     481
     482                                        self.jobAttrs[ jobid ]['status'] = 'F'
     483                                        self.jobAttrs[ jobid ]['stop_timestamp'] = str( mytime )
     484
     485                                        if not jobid in self.jobs_to_store:
     486                                                self.jobs_to_store.append( jobid )
     487
     488                        debug_msg( 1, 'torque_xml_thread(): Storing..' )
     489
     490                        for jobid in self.jobs_to_store:
     491                                if self.jobAttrs[ jobid ]['status'] in [ 'R', 'Q', 'F' ]:
     492                                        self.ds.storeJobInfo( jobid, self.jobAttrs[ jobid ] )   
     493
     494                        debug_msg( 1, 'torque_xml_thread(): Done storing.' )
     495
     496                        self.jobs_processed = [ ]
     497                        self.jobs_to_store = [ ]
    497498
    498499        def setJobAttrs( self, old, new ):
Note: See TracChangeset for help on using the changeset viewer.