concurrent.futures.TimeoutError

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

concurrent.futures.ThreadPoolExecutor

class concurrent.futures.ThreadPoolExecutor(max_workers=None) An Executor subclass that uses a pool of at most max_workers threads to execute calls asynchronously. Changed in version 3.5: If max_workers is None or not given, it will default to the number of processors on the machine, multiplied by 5, assuming that ThreadPoolExecutor is often used to overlap I/O instead of CPU work and the number of workers should be higher than the number of workers for ProcessPoolExecutor.

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.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.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_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.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.running()

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

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.exception()

exception(timeout=None) Return the exception raised 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 completed without raising, None is returned.