Ejemplo n.º 1
0
    def TimeoutRetryWrapper(*args, **kwargs):
        timeout = timeout_func(*args, **kwargs)
        retries = retries_func(*args, **kwargs)
        if pass_values:
            kwargs['timeout'] = timeout
            kwargs['retries'] = retries

        def impl():
            return f(*args, **kwargs)

        try:
            if isinstance(threading.current_thread(),
                          timeout_retry.TimeoutRetryThread):
                return impl()
            else:
                return timeout_retry.Run(impl, timeout, retries)
        except old_errors.WaitForResponseTimedOutError as e:
            raise device_errors.CommandTimeoutError(
                str(e)), None, (sys.exc_info()[2])
        except old_errors.DeviceUnresponsiveError as e:
            raise device_errors.DeviceUnreachableError(
                str(e)), None, (sys.exc_info()[2])
        except reraiser_thread.TimeoutError as e:
            raise device_errors.CommandTimeoutError(
                str(e)), None, (sys.exc_info()[2])
Ejemplo n.º 2
0
    def TimeoutRetryWrapper(*args, **kwargs):
        timeout = timeout_func(*args, **kwargs)
        retries = retries_func(*args, **kwargs)

        def impl():
            return f(*args, **kwargs)

        try:
            return timeout_retry.Run(impl, timeout, retries)
        except old_errors.WaitForResponseTimedOutError as e:
            raise device_errors.CommandTimeoutError(str(e))
        except old_errors.DeviceUnresponsiveError as e:
            raise device_errors.DeviceUnreachableError(str(e))
        except reraiser_thread.TimeoutError as e:
            raise device_errors.CommandTimeoutError(str(e))