Exemplo n.º 1
0
    def _WaitImpl(self):
        """Waits on the API call associated with this RPC. The callback,
    if provided, will be executed before Wait() returns. If this RPC
    is already complete, or if the RPC was never started, this
    function will return immediately.

    Raises:
      InterruptedError if a callback throws an uncaught exception.
    """
        try:
            rpc_completed = _apphosting_runtime___python__apiproxy.Wait(self)
        except (runtime.DeadlineExceededError,
                apiproxy_errors.InterruptedError):
            raise
        except:
            exc_class, exc, tb = sys.exc_info()
            if (isinstance(exc, SystemError)
                    and exc.args[0] == 'uncaught RPC exception'):
                raise
            rpc = None
            if hasattr(exc, "_appengine_apiproxy_rpc"):
                rpc = exc._appengine_apiproxy_rpc
            new_exc = apiproxy_errors.InterruptedError(exc, rpc)
            raise new_exc.__class__, new_exc, tb
        return True
Exemplo n.º 2
0
    def Wait(self):
        """Waits on the API call associated with this RPC. The callback,
    if provided, will be executed before Wait() returns. If this RPC
    is already complete, or if the RPC was never started, this
    function will return immediately.

    Raises:
      InterruptedError if a callback throws an uncaught exception.
    """
        try:
            rpc_completed = _apphosting_runtime___python__apiproxy.Wait(self)
        except runtime.DeadlineExceededError:
            raise
        except apiproxy_errors.InterruptedError:
            raise
        except:
            exc_class, exc, tb = sys.exc_info()
            if (isinstance(exc, SystemError)
                    and exc.args == ('uncaught RPC exception', )):
                raise
            rpc = None
            if hasattr(exc, "_appengine_apiproxy_rpc"):
                rpc = exc._appengine_apiproxy_rpc
            new_exc = apiproxy_errors.InterruptedError(exc, rpc)
            raise new_exc.__class__, new_exc, tb

        assert rpc_completed, (
            "RPC for %s.%s was not completed, and no other " +
            "exception was raised " % (self.package, self.call))