Changeset 950


Ignore:
Timestamp:
01/20/14 17:05:59 (10 years ago)
Author:
ramonb
Message:

1.2/jobmond/jobmond.py:

  • up-port jobmond fixes from 1.1 branch
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/1.2/jobmond/jobmond.py

    r944 r950  
    697697                sys.exit( 1 )
    698698
     699        self.gmetric_send_instances = { }
     700
     701
     702    def __del__( self ):
     703
     704        for send_instance in self.gmetric_send_instances:
     705
     706            del send_instance
     707
    699708    def checkGmetricVersion( self ):
    700709
     
    757766                debug_msg( 10, printTime() + ' ' + metric_debug)
    758767
    759                 gm = Gmetric( c_ip, c_port )
    760 
    761                 gm.send( str( metricname ), str( metricval ), str( self.dmax ), valtype, units )
     768                if not self.gmetric_send_instances.has_key( (c_ip, c_port) ):
     769
     770                    self.gmetric_send_instances[ (c_ip, c_port) ] = Gmetric( c_ip, c_port )
     771
     772                self.gmetric_send_instances[ (c_ip, c_port) ].send( str( metricname ), str( metricval ), str( self.dmax ), valtype, units )
    762773
    763774        elif GMETRIC_TARGET:
     
    770781            debug_msg( 10, printTime() + ' ' + metric_debug)
    771782
    772             gm = Gmetric( GMETRIC_TARGET_HOST, GMETRIC_TARGET_PORT )
    773 
    774             gm.send( str( metricname ), str( metricval ), str( self.dmax ), valtype, units )
     783            if not self.gmetric_send_instances.has_key( (GMETRIC_TARGET_HOST, GMETRIC_TARGET_PORT) ):
     784
     785                self.gmetric_send_instances[ (GMETRIC_TARGET_HOST, GMETRIC_TARGET_PORT) ] = Gmetric( GMETRIC_TARGET_HOST, GMETRIC_TARGET_PORT )
     786
     787            self.gmetric_send_instances[ (GMETRIC_TARGET_HOST, GMETRIC_TARGET_PORT) ].send( str( metricname ), str( metricval ), str( self.dmax ), valtype, units )
    775788
    776789        else:
     
    17841797            self.cur_time  = time.time()
    17851798
    1786         except PBSError, detail:
     1799        except (PBSError, TypeError), detail:
    17871800
    17881801            debug_msg( 10, "PBS server unavailable, skipping until next polling interval: " + str( detail ) )
     
    19831996        self.tmax       = 60
    19841997
     1998    def __del__( self ):
     1999
     2000        self.socket.close()
     2001
    19852002    def checkHostProtocol( self, ip ):
    19862003
Note: See TracChangeset for help on using the changeset viewer.