Changeset 185 for trunk/plugin


Ignore:
Timestamp:
08/04/05 09:59:56 (19 years ago)
Author:
bastiaans
Message:

plugin/togap.py:

  • Added time difference detection when Torque server time and local time differ. May cause inconsistencies in job time determination
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/plugin/togap.py

    r184 r185  
    2626#
    2727#GMOND_CONF = '/etc/gmond.conf'
     28
     29# Wether or not to detect differences in
     30# time from Torque server and local time.
     31#
     32# Ideally both machines (if not the same)
     33# should have the same time (via ntp or whatever)
     34#
     35DETECT_TIME_DIFFS = 1
    2836
    2937from PBSQuery import PBSQuery
     
    127135
    128136                self.jobs = { }
     137                self.timeoffset = 0
    129138                self.dp = DataProcessor()
    130139                self.initPbsQuery()
     
    219228                                        if nodeslist.count( host ) == 0:
    220229                                                nodeslist.append( host )
     230
     231                                if DETECT_TIME_DIFFS:
     232
     233                                        # If a job start if later than our current date,
     234                                        # that must mean the Torque server's time is later
     235                                        # than our local time.
     236                               
     237                                        if int(start_timestamp) > int( int(self.cur_time) + int(self.timeoffset) ):
     238
     239                                                self.timeoffset = int( int(start_timestamp) - int(self.cur_time) )
    221240
    222241                        elif status == 'Q':
     
    254273                        myAttrs['status'] = status
    255274                        myAttrs['start_timestamp'] = start_timestamp
    256                         myAttrs['reported'] = str( int( self.cur_time ) )
     275                        myAttrs['reported'] = str( int( int( self.cur_time ) + int( self.timeoffset ) ) )
    257276                        myAttrs['nodes'] = nodeslist
    258277                        myAttrs['domain'] = string.join( socket.getfqdn().split( '.' )[1:], '.' )
     
    277296                """Submit job info list"""
    278297
    279                 self.dp.multicastGmetric( 'TOGA-HEARTBEAT', str( int( self.cur_time ) ) )
     298                self.dp.multicastGmetric( 'TOGA-HEARTBEAT', str( int( int( self.cur_time ) + int( self.timeoffset ) ) ) )
    280299
    281300                # Now let's spread the knowledge
Note: See TracChangeset for help on using the changeset viewer.