(self)
Wait for network service to appear. A timeout of 0 waits forever.
Wait for network service to appear. A timeout of 0 waits forever.
Wait for network service to appear . A timeout of 0 waits forever .
def _wait_for_docker(self):
        """Wait for network service to appear. A timeout of 0 waits forever."""
        timeout = self._timeout
        backoff = .25
        max_backoff = min(timeout, 16)

        if timeout:
            # time module is needed to calc timeout shared between two exceptions
            end = time.time() + timeout

        while True:
            try:
                now = time.time()
                if timeout and end < now:
                    print("Timed out - %s:%s" % (self._server, self._port))
                    raise

                request_url = '%s:%s/ping' % (self._server, self._port)
                req = requests.get(request_url)
                self._acknowledged = True
                return True
            except requests.exceptions.ConnectionError as e:
                print("ConnectionError: ", e)
                backoff = min(max_backoff, backoff * 2)
                time.sleep(backoff)
            except requests.exceptions.HTTPError as e:
                print("HTTPError: ", e)
                backoff = min(max_backoff, backoff * 2)
                time.sleep(backoff)
            except docker.errors.APIError as e:
                print("This is a Docker error. Please fix: ", e)
                raise
def _wait_for_docker ( self ) : timeout = self . _timeout backoff = .25 max_backoff = min ( timeout , 16 ) if timeout : # time module is needed to calc timeout shared between two exceptions end = time . time ( ) + timeout while True : try : now = time . time ( ) if timeout and end < now : print ( "Timed out - %s:%s" % ( self . _server , self . _port ) ) raise request_url = '%s:%s/ping' % ( self . _server , self . _port ) req = requests . get ( request_url ) self . _acknowledged = True return True except requests . exceptions . ConnectionError as e : print ( "ConnectionError: " , e ) backoff = min ( max_backoff , backoff * 2 ) time . sleep ( backoff ) except requests . exceptions . HTTPError as e : print ( "HTTPError: " , e ) backoff = min ( max_backoff , backoff * 2 ) time . sleep ( backoff ) except docker . errors . APIError as e : print ( "This is a Docker error. Please fix: " , e ) raise