The following methods are part of the futures module. They can be accessed like so:
from scoop import futures
results = futures.map(func, data)
futureObject = futures.submit(func, arg)
...
More informations are available in the Usage document.
An iterator over the given futures that yields each as it completes.
Parameters: |
|
---|---|
Returns: | An iterator that yields the given Futures as they complete (finished or cancelled). |
Equivalent to map(func, *iterables, ...) but func is executed asynchronously and several calls to func may be made concurrently. The returned iterator raises a TimeoutError if __next__() is called and the result isn’t available after timeout seconds from the original call to map() [To be done in future version of SCOOP]. If timeout is not specified or None then there is no limit to the wait time. If a call raises an exception then that exception will be raised when its value is retrieved from the iterator.
Parameters: |
|
---|---|
Returns: | A generator of map results, each corresponding to one map iteration. |
This function is here for compatibility with futures (PEP 3148).
Parameters: | wait – Unapplied parameter. |
---|
Submit an independent parallel scoop._types.Future that will either run locally or remotely as func(*args, **kargs).
Parameters: |
|
---|---|
Returns: | A future object for retrieving the Future result. |
On return, the Future is pending execution locally, but may also be transfered remotely depending on load or on remote distributed workers. You may carry on with any further computations while the Future completes. Result retrieval is made via the result() function on the Future.
Wait for the futures in the given sequence to complete.
Parameters: |
|
||||||
---|---|---|---|---|---|---|---|
Returns: | A named 2-tuple of sets. The first set, named ‘done’, contains the futures that completed (is finished or cancelled) before the wait completed. The second set, named ‘not_done’, contains uncompleted futures. |
The submit() function returns a Future object. This instance possess the following methods.
This class encapsulates an independent future that can be executed in parallel. A future can spawn other parallel futures which themselves can recursively spawn other futures.
Attach a callable to the future that will be called when the future is cancelled or finishes running. Callable will be called with the future as its only argument.
Added callables are called in the order that they were added and are always called in a thread belonging to the process that added them. If the callable raises an Exception then it will be logged and ignored. If the callable raises another BaseException then behavior is not defined.
If the future has already completed or been cancelled then callable will be called immediately.
If the call is currently being executed then it cannot be cancelled and the method will return False, otherwise the call will be cancelled and the method will return True.
Return the exception raised by the call. If the call hasn’t yet completed then this method will wait up to timeout seconds [To be done in future version of SCOOP]. If the call hasn’t completed in timeout seconds then a TimeoutError will be raised. If timeout is not specified or None then there is no limit to the wait time.
If the future is cancelled before completing then CancelledError will be raised.
If the call completed without raising then None is returned.
Returns: | The exception raised by the call. |
---|
Return the value returned by the call. If the call hasn’t yet completed then this method will wait up to ‘’timeout’’ seconds [To be done in future version of SCOOP]. If the call hasn’t completed in timeout seconds then a TimeoutError will be raised. If timeout is not specified or None then there is no limit to the wait time.
If the future is cancelled before completing then CancelledError will be raised.
If the call raised an exception then this method will raise the same exception.
Returns: | The value returned by the call. |
---|