Futurist is a Python library from OpenStack that provides useful additions to `concurrent.futures`, aiming to offer enhanced transparency in asynchronous work execution. It includes features like statistics gathering for executors, an eventlet executor, a synchronous executor, and more. Currently at version 3.3.0, it is actively maintained with a regular release cadence.
pip install futuristVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to use `futurist.ThreadPoolExecutor` to run tasks concurrently and collect execution statistics. It submits multiple tasks, waits for their completion, retrieves results, and then displays the executor's performance metrics.
Always verify you are consulting the official OpenStack `futurist` documentation, typically found at `docs.openstack.org/futurist/` or the `openstack/futurist` GitHub repository.
If dynamic pool sizing is required, consider `futurist.DynamicThreadPoolExecutor` (if available and suitable for your version) or manage thread pool lifecycles explicitly. For applications with highly variable workloads, be mindful of `max_workers` setting.
Ensure that the code which creates and uses the `ProcessPoolExecutor` (and any functions it executes) is protected by `if __name__ == '__main__':` guards, especially on Windows.
Avoid using `eventlet.monkey_patch()` when working with `ProcessPoolExecutor`. If eventlet is required, consider using `futurist.GreenThreadPoolExecutor` (if your tasks are I/O bound and compatible) or carefully manage when and what parts of eventlet are monkey-patched, or consider migrating to native Python threading/asyncio where possible, as eventlet support in `futurist` is being deprecated for some components.
Always retrieve the result of a submitted `Future` object using `future.result()` within a `try-except` block, or call `future.exception()` to check for and handle any exceptions that occurred in the worker thread. Iterate over futures using `concurrent.futures.as_completed` for robust error handling.
To get the result of a `Future` object, call its `.result()` method. If you need to process results as they complete from multiple futures, use `concurrent.futures.as_completed()`.
Install the `futurist` library using pip: `pip install futurist`. Ensure you are running your code with the same Python interpreter where the library was installed.
Import the specific executor class directly from the `futurist` library, for example: `from futurist import ThreadPoolExecutor`. Then you can instantiate it as `executor = ThreadPoolExecutor()`. Check the `futurist` documentation for the correct import path of the specific class you intend to use.
No dependency data recorded yet.