Back to index

nagios-plugins  1.4.16
Public Member Functions | Public Attributes
utils.TimeoutHandler Class Reference

List of all members.

Public Member Functions

def __init__
def Check
def TimeOut
def WasTimeOut

Public Attributes

 kill_func
 start_time
 stop_time
 debug
 aborted

Detailed Description

Definition at line 281 of file utils.py.


Constructor & Destructor Documentation

def utils.TimeoutHandler.__init__ (   self,
  kill_func,
  time_to_live = 10,
  debug = 0 
)

Definition at line 282 of file utils.py.

00282 
00283     def __init__(self,kill_func,time_to_live=10,debug=0):
00284        'Generic time-out handler.'
00285        self.kill_func=kill_func
00286        self.start_time=time.time()
00287        self.stop_time=+self.start_time+int(time_to_live)
00288        self.debug=debug
00289        self.aborted=0
    

Member Function Documentation

Definition at line 290 of file utils.py.

00290 
00291     def Check(self):
00292        'Call this periodically to check for time-out.'
00293        if self.debug:
00294            sys.stdout.write('.')
00295            sys.stdout.flush()
00296        if time.time()>=self.stop_time:
00297            self.TimeOut()
           

Here is the call graph for this function:

Definition at line 298 of file utils.py.

00298 
00299     def TimeOut(self):
00300        'Trigger the time-out callback.'
00301        self.aborted=1
00302        if self.debug:
00303            print 'Timeout, aborting'
00304        self.kill_func()
       

Here is the caller graph for this function:

Definition at line 305 of file utils.py.

00305 
00306     def WasTimeOut(self):
00307        'Indicates if timeout was triggered 1=yes, 0=no.'
00308        if self.debug:
00309            print ''
00310            print 'call duration: %.2f seconds' % (time.time()-self.start_time)
00311        return self.aborted

Member Data Documentation

Definition at line 288 of file utils.py.

Definition at line 287 of file utils.py.

Definition at line 284 of file utils.py.

Definition at line 285 of file utils.py.

Definition at line 286 of file utils.py.


The documentation for this class was generated from the following file: