Ejemplo n.º 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
Ejemplo n.º 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
Ejemplo n.º 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")
Ejemplo n.º 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")
Ejemplo n.º 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))
Ejemplo n.º 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))
Ejemplo n.º 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))
Ejemplo n.º 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))