主要维护者¶
主要维护者
Harlowja
其他贡献者
Sileht
https://blueprints.launchpad.net/oslo.utils/+spec/adopt-futurist
这个库的目标是提供一个文档完善的 futures 类/工具/扩展,从一个基本集合开始,并随着时间的推移扩展到更大的集合。这个库(以及 futures 库/模块通常来说)允许提供异步工作执行方式的透明度。
目前,这个库添加了以下功能(超越了 Python 3.2 或更高版本中内置的 futures 库以及常用的 futures backport,后者通常用于 Python 2.6 或 2.7)。
统计信息收集(已运行的 futures 数量、平均失败率、平均运行时间……)
一个 eventlet 执行器(也称为 GreenThreadPoolExecutor),它使用 eventlet greenpool 和 greenthreads(使相同的 futures/执行器接口在 eventlet 环境中工作)。这种添加使得从 eventlet 迁移到另一种执行器风格变得更容易(因为提供的/使用的接口与其他执行器类型相同)。
一个同步执行器(也称为 SynchronousExecutor),它不使用任何池、线程或进程,而是在调用线程(或程序)中执行提交的函数,并返回一个带有结果或异常设置的 future。这允许在出于任何原因需要相同的执行器/futures 接口但不想在线程、进程(或其他)中执行的阻塞使用。
当前/计划的使用情况(正在积极推进)
在 taskflow 中的内部使用(当用户未提供执行器对象时)。也用于内部重试激活(后者本身使用同步执行器)。
在 oslo.messaging 中的内部使用(替换/增强/统一该代码库内的执行器接口)。
这个库的代码是从 taskflow 中提取的,并且希望被 oslo.messaging(以及希望更多的人)使用?
futurist
futurist/__init__.py
futurist/futures.py
futurist/utils.py (仅供内部使用)
Taskflow
Oslo.messaging
其他人?
目前公共 API(伪代码)如下
实际代码可以在 这里 找到。
from concurrent import futures as _futures
from concurrent.futures import process as _process
from concurrent.futures import thread as _thread
ThreadPoolExecutor(_thread.ThreadPoolExecutor)
"""
Executor that uses a thread pool to execute calls asynchronously.
It gathers statistics about the submissions executed for
post-analysis...
See: https://docs.pythonlang.cn/dev/library/concurrent.futures.html
"""
- statistics (read-only property)
- alive (read-only property)
- submit (same as parent class)
- shutdown (same as parent class)
ProcessPoolExecutor(_process.ProcessPoolExecutor)
"""
Executor that uses a process pool to execute calls asynchronously.
It gathers statistics about the submissions executed for
post-analysis...
See: https://docs.pythonlang.cn/dev/library/concurrent.futures.html
"""
- statistics (read-only property)
- alive (read-only property)
- submit (same as parent class)
- shutdown (same as parent class)
SynchronousExecutor(_futures.Executor)
"""Executor that uses the caller to execute calls synchronously.
This provides an interface to a caller that looks like an executor but
will execute the calls inside the caller thread instead of executing it
in a external process/thread for when this type of functionality is
useful to provide... It gathers statistics about the submissions
executed for post-analysis...
"""
- statistics (read-only property)
- alive (read-only property)
- submit (same as parent class)
- restart (Restarts this executor (*iff* previously shutoff/shutdown))
- shutdown (same as parent class)
GreenFuture(Future)
"""Future that ensures internal condition is a green(ed) condition."""
GreenThreadPoolExecutor(_futures.Executor)
"""Executor that uses a green thread pool to execute calls
asynchronously.
See: https://docs.pythonlang.cn/dev/library/concurrent.futures.html
and http://eventlet.net/doc/modules/greenpool.html for information on
how this works.
It gathers statistics about the submissions executed for
post-analysis...
"""
- statistics (read-only property)
- alive (read-only property)
- submit (same as parent class)
- shutdown (same as parent class)
ExecutorStatistics(object)
"""Holds *immutable* information about a executors executions."""
- failures (read-only property)
- executed (read-only property)
- runtime (read-only property)
- cancelled (read-only property)
- average_runtime (read-only property)
主要负责人
Harlowja
其他贡献者
Sileht
主要维护者
Harlowja
其他贡献者
Sileht
安全联系人:harlowja
完成目标里程碑:liberty-1
创建 launchpad 项目
更改 Launchpad 项目的所有者(使其成为 Oslo 项目组的一部分)
授予 openstackci 在 PyPI 上的 Owner 权限
创建初始仓库
让库做一些事情 ✓
更新 README.rst
发布 git 仓库
Oslo 团队审查新仓库
Infra 项目配置
更新 Gerrit 组和 ACL
openstack-infra/devstack-gate 调整
openstack/requirements projects.txt 调整
更新 docs.openstack.org 上的项目列表
标记一个发布版本
盈利!
N/A
python 2.6 –> 3.4 (以及更高版本!)
futures backport (仅在 python < 3.2 时需要)
eventlet (可选地需要用于 green futures/执行器)
注意
所有当前计划的依赖项都在 requirements 仓库中。
N/A
注意
本作品采用知识共享署名 3.0 非移植许可协议授权。 http://creativecommons.org/licenses/by/3.0/legalcode
除非另有说明,此文档根据 知识共享署名 3.0 许可 授权。请参阅所有 OpenStack 法律文件。