예제 #1
0
파일: ethdrv.py 프로젝트: ikozhukhov/oTTo
def list_stats(l):
    stats = '\tsamples:%s' % len(l)
    stats += '\taverage:%s' % timefmt(average(l))
    stats += '\tstddev:%s' % timefmt(standard_dev(l))
    stats += '\tmax:%s' % max(l)
    stats += '\tmin:%s' % min(l)
    return stats
예제 #2
0
파일: ethdrv.py 프로젝트: mennis/oTTo
def list_stats(l):
    stats = '\tsamples:%s' % len(l)
    stats += '\taverage:%s' % timefmt(average(l))
    stats += '\tstddev:%s' % timefmt(standard_dev(l))
    stats += '\tmax:%s' % max(l)
    stats += '\tmin:%s' % min(l)
    return stats
예제 #3
0
    def reconnect(self, after=10, timeout=None, nolog=False):
        """
        reconnect to the host::

            after how long to wait for the first attempt
            timeout how long to wait for each attempt

        """
        # default to this instance's current value
        if timeout is None:
            timeout = self.timeout

        self.close()
        start = now()
        while 1:
            sleep(after)
            try:
                if self.connect(timeout=timeout, nolog=nolog):
                    break
            except (TIMEOUT, EOF) as e:
                self.close()
                if not nolog:
                    logger.debug(str(e))
        logger.debug("reconnected after %s" % timefmt(since(start)))
        return True
예제 #4
0
파일: ssh_pexpect.py 프로젝트: mennis/oTTo
    def reconnect(self, after=10, timeout=None, nolog=False):
        """
        reconnect to the host::

            after how long to wait for the first attempt
            timeout how long to wait for each attempt

        """
        # default to this instance's current value
        if timeout is None:
            timeout = self.timeout

        self.close()
        start = now()
        while 1:
            sleep(after)
            try:
                if self.connect(timeout=timeout, nolog=nolog):
                    break
            except (TIMEOUT, EOF) as e:
                self.close()
                if not nolog:
                    logger.debug(str(e))
        logger.debug("reconnected after %s" % timefmt(since(start)))
        return True