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
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))
def __internal_callback(self): """This is the callback set on the low-level RPC object. It sets a flag on the current object indicating that the high-level callback should now be called. If interrupts are enabled, it also interrupts the current wait_any() call by raising an exception. """ self.__must_call_user_callback = True if self.__class__.__local.may_interrupt_wait and not self.__rpc.exception: raise apiproxy_errors.InterruptedError(None, self.__rpc)