Pyro4.futures
— asynchronous calls
Support for Futures (asynchronously executed callables). If you’re using Python 3.2 or newer, also see http://docs.python.org/3/library/concurrent.futures.html#future-objects
- class Pyro4.futures.Future(somecallable)
Holds a callable that will be executed asynchronously and provide its result value some time in the future. This is a more general implementation than the AsyncRemoteMethod, which only works with Pyro proxies (and provides a bit different syntax). This class has a few extra features as well (delay, canceling).
- cancel()
Cancels the execution of the future altogether. If the execution hasn’t been started yet, the cancellation is successful and returns True. Otherwise, it failed and returns False.
- delay(seconds)
Delay the evaluation of the future for the given number of seconds. Return True if successful otherwise False if the future has already been evaluated.
- iferror(exceptionhandler)
Specify the exception handler to be invoked (with the exception object as only argument) when calculating the result raises an exception. If no exception handler is set, any exception raised in the asynchronous call will be silently ignored. Returns self so you can easily chain other calls.
- then(call, *args, **kwargs)
Add a callable to the call chain, to be invoked when the results become available. The result of the current call will be used as the first argument for the next call. Optional extra arguments can be provided in args and kwargs. Returns self so you can easily chain then() calls.
- class Pyro4.futures.FutureResult
The result object for asynchronous Pyro calls. Unfortunatley it should be similar to the more general Future class but it is still somewhat limited (no delay, no canceling).
- iferror(exceptionhandler)
Specify the exception handler to be invoked (with the exception object as only argument) when asking for the result raises an exception. If no exception handler is set, any exception result will be silently ignored (unless you explicitly ask for the value). Returns self so you can easily chain other calls.
- property ready
Boolean that contains the readiness of the asynchronous result
- then(call, *args, **kwargs)
Add a callable to the call chain, to be invoked when the results become available. The result of the current call will be used as the first argument for the next call. Optional extra arguments can be provided in args and kwargs. Returns self so you can easily chain then() calls.
- property value
The result value of the call. Reading it will block if not available yet.
- wait(timeout=None)
Wait for the result to become available, with optional timeout (in seconds). Returns True if the result is ready, or False if it still isn’t ready.