Example #1
0
    def healthy(self, now=0, timeout=0):
        """Report if a connection is healthy.  If a connection should be
        removed then return false.  An optional now argument is provided
        to give the current time."""

        # did we lose the connection
        if self.fileno() < 0:
            log("lost connection with " + str(self))
            return 0

        # make sure we know the current time
        if not now: now = time.time()
        if not timeout: timeout = self.IdleTimeout

        # when was the last message received
        if timeout and (now - self.lastmsg) > timeout:
            log(str(self) + " was idle for more than %d seconds, " \
                  "removing" % timeout)
            return 0

        return 1
Example #2
0
    def healthy(self, now=0, timeout=0):
        """Report if a connection is healthy.  If a connection should be
        removed then return false.  An optional now argument is provided
        to give the current time."""

        # did we lose the connection
        if self.fileno() < 0:
            log("lost connection with " + str(self))
            return 0

        # make sure we know the current time
        if not now: now = time.time()
        if not timeout: timeout = self.IdleTimeout

        # when was the last message received
        if timeout and (now - self.lastmsg) > timeout:
            log(str(self) + " was idle for more than %d seconds, " \
                  "removing" % timeout)
            return 0

        return 1
Example #3
0
def printTraceback(msg=None):
    """Prints the current error stack to stderr."""

    if msg:
        log(msg)
    log("printing traceback")
    traceback.print_exc()
    log("end traceback")
Example #4
0
def printTraceback(msg=None):
    """Prints the current error stack to stderr."""
    
    if msg:
        log(msg)
    log("printing traceback")
    traceback.print_exc()
    log("end traceback")
Example #5
0
 def dprintUrl(self, url):
     """Display url when running in debug mode."""
     if self.debug:
         progutil.log(
             "[%s:%s] http://%s:%s/Tractor/%s" %
             (self.hostname, self.port, self.hostname, self.port, url))
Example #6
0
 def dprint(self, msg):
     """Display message when running in debug mode."""
     if self.debug:
         progutil.log("[%s:%s] %s" % (self.hostname, self.port, msg))
Example #7
0
 def dprintUrl(self, url):
     """Display url when running in debug mode."""
     if self.debug:
         progutil.log("[%s:%s] http://%s:%s/Tractor/%s" % (self.hostname, self.port, self.hostname, self.port, url))
Example #8
0
 def dprint(self, msg):
     """Display message when running in debug mode."""
     if self.debug:
         progutil.log("[%s:%s] %s" % (self.hostname, self.port, msg))