concurrent.futures.ProcessPoolExecutor

class concurrent.futures.ProcessPoolExecutor(max_workers=None) An Executor subclass that executes calls asynchronously using a pool of at most max_workers processes. If max_workers is None or not given, it will default to the number of processors on the machine. If max_workers is lower or equal to 0, then a ValueError will be raised. Changed in version 3.3: When one of the worker processes terminates abruptly, a BrokenProcessPool error is now raised. Previously, behaviour was undefined but

concurrent.futures.TimeoutError

exception concurrent.futures.TimeoutError Raised when a future operation exceeds the given timeout.

concurrent.futures.process.BrokenProcessPool

exception concurrent.futures.process.BrokenProcessPool Derived from RuntimeError, this exception class is raised when one of the workers of a ProcessPoolExecutor has terminated in a non-clean fashion (for example, if it was killed from the outside). New in version 3.3.

concurrent.futures.wait()

concurrent.futures.wait(fs, timeout=None, return_when=ALL_COMPLETED) Wait for the Future instances (possibly created by different Executor instances) given by fs to complete. Returns a named 2-tuple of sets. The first set, named done, contains the futures that completed (finished or were cancelled) before the wait completed. The second set, named not_done, contains uncompleted futures. timeout can be used to control the maximum number of seconds to wait before returning. timeout can be an in

concurrent.futures.Future.running()

running() Return True if the call is currently being executed and cannot be cancelled.

concurrent.futures.Future.set_result()

set_result(result) Sets the result of the work associated with the Future to result. This method should only be used by Executor implementations and unit tests.

concurrent.futures.Future.result()

result(timeout=None) Return the value returned by the call. If the call hasn’t yet completed then this method will wait up to timeout seconds. If the call hasn’t completed in timeout seconds, then a concurrent.futures.TimeoutError will be raised. timeout can be an int or float. If timeout is not specified or None, there is no limit to the wait time. If the future is cancelled before completing then CancelledError will be raised. If the call raised, this method will raise the same exception.

concurrent.futures.Future.set_running_or_notify_cancel()

set_running_or_notify_cancel() This method should only be called by Executor implementations before executing the work associated with the Future and by unit tests. If the method returns False then the Future was cancelled, i.e. Future.cancel() was called and returned True. Any threads waiting on the Future completing (i.e. through as_completed() or wait()) will be woken up. If the method returns True then the Future was not cancelled and has been put in the running state, i.e. calls to Futu

concurrent.futures.Future.set_exception()

set_exception(exception) Sets the result of the work associated with the Future to the Exception exception. This method should only be used by Executor implementations and unit tests.

concurrent.futures.Future

class concurrent.futures.Future Encapsulates the asynchronous execution of a callable. Future instances are created by Executor.submit() and should not be created directly except for testing. cancel() Attempt to cancel the call. If the call is currently being executed and cannot be cancelled then the method will return False, otherwise the call will be cancelled and the method will return True. cancelled() Return True if the call was successfully cancelled. running() Return Tr