celestialflow 3.2.4__tar.gz → 3.2.6__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- celestialflow-3.2.6/LICENSE +21 -0
- {celestialflow-3.2.4 → celestialflow-3.2.6}/PKG-INFO +42 -101
- celestialflow-3.2.6/README.md +267 -0
- {celestialflow-3.2.4 → celestialflow-3.2.6}/pyproject.toml +1 -19
- {celestialflow-3.2.4 → celestialflow-3.2.6}/src/celestialflow/__init__.py +6 -5
- {celestialflow-3.2.4 → celestialflow-3.2.6}/src/celestialflow/funnel/__init__.py +5 -0
- celestialflow-3.2.6/src/celestialflow/funnel/core_inlet.py +48 -0
- {celestialflow-3.2.4 → celestialflow-3.2.6}/src/celestialflow/funnel/core_spout.py +63 -28
- celestialflow-3.2.6/src/celestialflow/funnel/util_count.py +51 -0
- {celestialflow-3.2.4 → celestialflow-3.2.6}/src/celestialflow/graph/__init__.py +5 -0
- {celestialflow-3.2.4 → celestialflow-3.2.6}/src/celestialflow/graph/core_graph.py +62 -38
- {celestialflow-3.2.4 → celestialflow-3.2.6}/src/celestialflow/graph/core_structure.py +0 -88
- celestialflow-3.2.6/src/celestialflow/graph/util_graph.py +345 -0
- {celestialflow-3.2.4 → celestialflow-3.2.6}/src/celestialflow/observability/core_report.py +22 -15
- {celestialflow-3.2.4 → celestialflow-3.2.6}/src/celestialflow/persistence/__init__.py +5 -0
- {celestialflow-3.2.4 → celestialflow-3.2.6}/src/celestialflow/persistence/core_fallback.py +13 -13
- {celestialflow-3.2.4 → celestialflow-3.2.6}/src/celestialflow/persistence/core_log.py +2 -5
- {celestialflow-3.2.4 → celestialflow-3.2.6}/src/celestialflow/persistence/util_sqlite.py +185 -107
- {celestialflow-3.2.4 → celestialflow-3.2.6}/src/celestialflow/runtime/__init__.py +6 -0
- {celestialflow-3.2.4 → celestialflow-3.2.6}/src/celestialflow/runtime/core_metrics.py +9 -0
- {celestialflow-3.2.4 → celestialflow-3.2.6}/src/celestialflow/runtime/util_constant.py +3 -6
- {celestialflow-3.2.4 → celestialflow-3.2.6}/src/celestialflow/runtime/util_errors.py +6 -18
- {celestialflow-3.2.4 → celestialflow-3.2.6}/src/celestialflow/runtime/util_estimators.py +8 -7
- {celestialflow-3.2.4 → celestialflow-3.2.6}/src/celestialflow/stage/__init__.py +6 -0
- {celestialflow-3.2.4 → celestialflow-3.2.6}/src/celestialflow/stage/core_executor.py +31 -14
- {celestialflow-3.2.4 → celestialflow-3.2.6}/src/celestialflow/stage/core_stage.py +8 -12
- {celestialflow-3.2.4 → celestialflow-3.2.6}/src/celestialflow/stage/core_stages.py +0 -6
- {celestialflow-3.2.4 → celestialflow-3.2.6}/src/celestialflow.egg-info/PKG-INFO +42 -101
- celestialflow-3.2.6/src/celestialflow.egg-info/SOURCES.txt +50 -0
- celestialflow-3.2.6/src/celestialflow.egg-info/requires.txt +2 -0
- celestialflow-3.2.4/README.md +0 -323
- celestialflow-3.2.4/src/celestialflow/funnel/core_inlet.py +0 -22
- celestialflow-3.2.4/src/celestialflow/graph/util_analysis.py +0 -70
- celestialflow-3.2.4/src/celestialflow/web/__init__.py +0 -11
- celestialflow-3.2.4/src/celestialflow/web/config.json +0 -34
- celestialflow-3.2.4/src/celestialflow/web/core_server.py +0 -421
- celestialflow-3.2.4/src/celestialflow/web/routes/__init__.py +0 -33
- celestialflow-3.2.4/src/celestialflow/web/routes/pull_routes.py +0 -135
- celestialflow-3.2.4/src/celestialflow/web/routes/push_routes.py +0 -130
- celestialflow-3.2.4/src/celestialflow/web/static/css/_colors.css +0 -136
- celestialflow-3.2.4/src/celestialflow/web/static/css/base.css +0 -816
- celestialflow-3.2.4/src/celestialflow/web/static/css/dashboard.css +0 -175
- celestialflow-3.2.4/src/celestialflow/web/static/css/dashboard_analysis.css +0 -41
- celestialflow-3.2.4/src/celestialflow/web/static/css/dashboard_history.css +0 -89
- celestialflow-3.2.4/src/celestialflow/web/static/css/dashboard_statuses.css +0 -225
- celestialflow-3.2.4/src/celestialflow/web/static/css/dashboard_structure.css +0 -27
- celestialflow-3.2.4/src/celestialflow/web/static/css/dashboard_summary.css +0 -136
- celestialflow-3.2.4/src/celestialflow/web/static/css/errors.css +0 -364
- celestialflow-3.2.4/src/celestialflow/web/static/css/injection_editor.css +0 -223
- celestialflow-3.2.4/src/celestialflow/web/static/css/injection_layout.css +0 -119
- celestialflow-3.2.4/src/celestialflow/web/static/css/injection_nodes.css +0 -92
- celestialflow-3.2.4/src/celestialflow/web/static/css/injection_preview.css +0 -140
- celestialflow-3.2.4/src/celestialflow/web/static/favicon.ico +0 -0
- celestialflow-3.2.4/src/celestialflow/web/static/js/dashboard_analysis.js +0 -84
- celestialflow-3.2.4/src/celestialflow/web/static/js/dashboard_history.js +0 -386
- celestialflow-3.2.4/src/celestialflow/web/static/js/dashboard_statuses.js +0 -252
- celestialflow-3.2.4/src/celestialflow/web/static/js/dashboard_structure.js +0 -186
- celestialflow-3.2.4/src/celestialflow/web/static/js/dashboard_summary.js +0 -44
- celestialflow-3.2.4/src/celestialflow/web/static/js/errors.js +0 -250
- celestialflow-3.2.4/src/celestialflow/web/static/js/i18n.js +0 -450
- celestialflow-3.2.4/src/celestialflow/web/static/js/injection.js +0 -675
- celestialflow-3.2.4/src/celestialflow/web/static/js/layout_editor.js +0 -196
- celestialflow-3.2.4/src/celestialflow/web/static/js/main.js +0 -340
- celestialflow-3.2.4/src/celestialflow/web/static/js/utils.js +0 -177
- celestialflow-3.2.4/src/celestialflow/web/static/js/web_config.js +0 -460
- celestialflow-3.2.4/src/celestialflow/web/static/ts/dashboard_analysis.ts +0 -98
- celestialflow-3.2.4/src/celestialflow/web/static/ts/dashboard_history.ts +0 -473
- celestialflow-3.2.4/src/celestialflow/web/static/ts/dashboard_statuses.ts +0 -360
- celestialflow-3.2.4/src/celestialflow/web/static/ts/dashboard_structure.ts +0 -221
- celestialflow-3.2.4/src/celestialflow/web/static/ts/dashboard_summary.ts +0 -49
- celestialflow-3.2.4/src/celestialflow/web/static/ts/errors.ts +0 -301
- celestialflow-3.2.4/src/celestialflow/web/static/ts/globals.d.ts +0 -155
- celestialflow-3.2.4/src/celestialflow/web/static/ts/i18n.ts +0 -491
- celestialflow-3.2.4/src/celestialflow/web/static/ts/injection.ts +0 -787
- celestialflow-3.2.4/src/celestialflow/web/static/ts/layout_editor.ts +0 -223
- celestialflow-3.2.4/src/celestialflow/web/static/ts/main.ts +0 -382
- celestialflow-3.2.4/src/celestialflow/web/static/ts/utils.ts +0 -205
- celestialflow-3.2.4/src/celestialflow/web/static/ts/web_config.ts +0 -561
- celestialflow-3.2.4/src/celestialflow/web/templates/index.html +0 -709
- celestialflow-3.2.4/src/celestialflow/web/util_cal.py +0 -9
- celestialflow-3.2.4/src/celestialflow/web/util_config.py +0 -38
- celestialflow-3.2.4/src/celestialflow/web/util_error.py +0 -30
- celestialflow-3.2.4/src/celestialflow/web/util_models.py +0 -91
- celestialflow-3.2.4/src/celestialflow.egg-info/SOURCES.txt +0 -99
- celestialflow-3.2.4/src/celestialflow.egg-info/entry_points.txt +0 -2
- celestialflow-3.2.4/src/celestialflow.egg-info/requires.txt +0 -6
- {celestialflow-3.2.4 → celestialflow-3.2.6}/setup.cfg +0 -0
- {celestialflow-3.2.4 → celestialflow-3.2.6}/src/celestialflow/graph/util_serialize.py +0 -0
- {celestialflow-3.2.4 → celestialflow-3.2.6}/src/celestialflow/observability/__init__.py +0 -0
- {celestialflow-3.2.4 → celestialflow-3.2.6}/src/celestialflow/observability/core_observer.py +0 -0
- {celestialflow-3.2.4 → celestialflow-3.2.6}/src/celestialflow/observability/core_progress.py +0 -0
- {celestialflow-3.2.4 → celestialflow-3.2.6}/src/celestialflow/observability/util_types.py +0 -0
- {celestialflow-3.2.4 → celestialflow-3.2.6}/src/celestialflow/persistence/util_payload.py +0 -0
- {celestialflow-3.2.4 → celestialflow-3.2.6}/src/celestialflow/runtime/core_dispatch.py +0 -0
- {celestialflow-3.2.4 → celestialflow-3.2.6}/src/celestialflow/runtime/core_envelope.py +0 -0
- {celestialflow-3.2.4 → celestialflow-3.2.6}/src/celestialflow/runtime/core_queue.py +0 -0
- {celestialflow-3.2.4 → celestialflow-3.2.6}/src/celestialflow/runtime/util_event.py +0 -0
- {celestialflow-3.2.4 → celestialflow-3.2.6}/src/celestialflow/runtime/util_hash.py +0 -0
- {celestialflow-3.2.4 → celestialflow-3.2.6}/src/celestialflow/runtime/util_types.py +0 -0
- {celestialflow-3.2.4 → celestialflow-3.2.6}/src/celestialflow/stage/util_callable.py +0 -0
- {celestialflow-3.2.4 → celestialflow-3.2.6}/src/celestialflow/stage/util_types.py +0 -0
- {celestialflow-3.2.4 → celestialflow-3.2.6}/src/celestialflow/utils/__init__.py +0 -0
- {celestialflow-3.2.4 → celestialflow-3.2.6}/src/celestialflow/utils/util_benchmark.py +0 -0
- {celestialflow-3.2.4 → celestialflow-3.2.6}/src/celestialflow/utils/util_clone.py +0 -0
- {celestialflow-3.2.4 → celestialflow-3.2.6}/src/celestialflow/utils/util_collections.py +0 -0
- {celestialflow-3.2.4 → celestialflow-3.2.6}/src/celestialflow/utils/util_format.py +0 -0
- {celestialflow-3.2.4 → celestialflow-3.2.6}/src/celestialflow.egg-info/dependency_links.txt +0 -0
- {celestialflow-3.2.4 → celestialflow-3.2.6}/src/celestialflow.egg-info/top_level.txt +0 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Mr-xiaotian
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: celestialflow
|
|
3
|
-
Version: 3.2.
|
|
3
|
+
Version: 3.2.6
|
|
4
4
|
Summary: A flexible GRAPH-based task orchestration framework.
|
|
5
5
|
Author-email: Mr-xiaotian <mingxiaomingtian@gmail.com>
|
|
6
6
|
License: MIT
|
|
@@ -10,16 +10,13 @@ Keywords: workflow,task,graph,async,CelestialFlow
|
|
|
10
10
|
Classifier: Programming Language :: Python :: 3
|
|
11
11
|
Classifier: License :: OSI Approved :: MIT License
|
|
12
12
|
Classifier: Operating System :: OS Independent
|
|
13
|
-
Classifier: Framework :: FastAPI
|
|
14
13
|
Classifier: Topic :: Software Development :: Libraries
|
|
15
14
|
Requires-Python: >=3.12
|
|
16
15
|
Description-Content-Type: text/markdown
|
|
16
|
+
License-File: LICENSE
|
|
17
17
|
Requires-Dist: tqdm
|
|
18
|
-
Requires-Dist: fastapi
|
|
19
|
-
Requires-Dist: uvicorn
|
|
20
18
|
Requires-Dist: requests
|
|
21
|
-
|
|
22
|
-
Requires-Dist: jinja2
|
|
19
|
+
Dynamic: license-file
|
|
23
20
|
|
|
24
21
|
# CelestialFlow ——一个轻量级、可并行、基于图结构的 Python 任务调度框架
|
|
25
22
|
|
|
@@ -38,14 +35,13 @@ Requires-Dist: jinja2
|
|
|
38
35
|
<img src="https://img.shields.io/badge/Task%20Graph-DAG-blueviolet">
|
|
39
36
|
<img src="https://img.shields.io/badge/Workflow-Orchestrator-7c3aed">
|
|
40
37
|
<img src="https://img.shields.io/badge/Event%20Tracing-CelestialTree-0ea5e9">
|
|
41
|
-
<img src="https://img.shields.io/badge/Web-Dashboard-FastAPI-ec4899">
|
|
42
38
|
</p>
|
|
43
39
|
|
|
44
40
|
<p align="center">
|
|
45
|
-
<a href="https://github.com/Mr-xiaotian/CelestialFlow/blob/main/
|
|
41
|
+
<a href="https://github.com/Mr-xiaotian/CelestialFlow/blob/main/README.md">中文</a> | <a href="https://github.com/Mr-xiaotian/CelestialFlow/blob/main/docs/en/README.md">English</a> | <a href="https://github.com/Mr-xiaotian/CelestialFlow/blob/main/docs/ja/README.md">日本語</a>
|
|
46
42
|
</p>
|
|
47
43
|
|
|
48
|
-
**CelestialFlow** 是一个轻量级但功能完全的任务流框架,适合需要
|
|
44
|
+
**CelestialFlow** 是一个轻量级但功能完全的任务流框架,适合需要 **复杂依赖关系**、**灵活执行模型**、**跨设备运行** 与 **可观测执行链路** 的中/大型 Python 任务系统。
|
|
49
45
|
|
|
50
46
|
- 相比 Airflow/Dagster 更轻、更快开始
|
|
51
47
|
- 相比 multiprocessing/threading 更结构化,可直接表达 loop / complete graph 等复杂依赖模式
|
|
@@ -71,7 +67,7 @@ TaskGraph 能构建完整的 **有向图结构(Directed Graph)**,不仅支
|
|
|
71
67
|
|
|
72
68
|
在执行与调度之外,CelestialFlow 进一步引入 **CelestialTree(简称: ctree) 事件追踪系统**,为每一个任务及其衍生行为(成功、失败、重试、拆分、路由等)记录明确的因果关系。借助 ctree,可以从任意一个初始任务出发,完整还原其在 TaskGraph 中的传播路径与执行轨迹,使任务系统可以进行完整的**追溯、分析、解释**。
|
|
73
69
|
|
|
74
|
-
在此基础上,CelestialFlow
|
|
70
|
+
在此基础上,CelestialFlow 提供事件追踪、状态上报、持久化回放,并提供基于 Redis 的 demo 与 Go Worker 外部协作示例,用于展示按需构建跨进程、跨设备任务协作的方式。
|
|
75
71
|
|
|
76
72
|
## 项目结构(Project Structure)
|
|
77
73
|
|
|
@@ -101,24 +97,11 @@ flowchart LR
|
|
|
101
97
|
%% 美化 TaskStages
|
|
102
98
|
class S1,S2,S3,S4 blueNode;
|
|
103
99
|
|
|
104
|
-
%% ===== WebUI =====
|
|
105
|
-
subgraph W[WebUI]
|
|
106
|
-
JS
|
|
107
|
-
HTML
|
|
108
|
-
end
|
|
109
|
-
|
|
110
|
-
style W fill:#ffeaf0,stroke:#d66b8c,stroke-width:2px,rx:10px,ry:10px
|
|
111
|
-
style JS fill:#ffffff,stroke:#d66b8c,rx:5px,ry:5px
|
|
112
|
-
style HTML fill:#ffffff,stroke:#d66b8c,rx:5px,ry:5px
|
|
113
|
-
|
|
114
|
-
R[TaskWeb]
|
|
115
|
-
style R fill:#f0e9ff,stroke:#8a6bc9,stroke-width:2px,rx:8px,ry:8px
|
|
116
|
-
|
|
117
100
|
%% ===== Links =====
|
|
118
|
-
TG -->
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
101
|
+
TG --> CFB[CelestialFlow Web]
|
|
102
|
+
CFB --> TG
|
|
103
|
+
|
|
104
|
+
style CFB fill:#ffeaf0,stroke:#d66b8c,stroke-width:2px,rx:10px,ry:10px
|
|
122
105
|
|
|
123
106
|
```
|
|
124
107
|
|
|
@@ -134,7 +117,7 @@ uv pip install celestialflow
|
|
|
134
117
|
pip install celestialflow
|
|
135
118
|
```
|
|
136
119
|
|
|
137
|
-
如果你只使用 CelestialFlow
|
|
120
|
+
如果你只使用 CelestialFlow 的核心调度、可观测性与持久化能力,上面的安装已经足够。
|
|
138
121
|
|
|
139
122
|
如果你还需要启用 CelestialTree 事件追踪能力,则需要**额外安装** `celestialtree`:
|
|
140
123
|
|
|
@@ -163,7 +146,7 @@ if __name__ == "__main__":
|
|
|
163
146
|
stage2 = TaskStage(name="Squarer", func=square, stage_mode="thread", execution_mode="thread")
|
|
164
147
|
|
|
165
148
|
# 构建任务图结构
|
|
166
|
-
graph = TaskGraph()
|
|
149
|
+
graph = TaskGraph(name="DemoGraph")
|
|
167
150
|
graph.set_stages(stages=[stage1, stage2])
|
|
168
151
|
graph.connect([stage1], [stage2])
|
|
169
152
|
|
|
@@ -179,17 +162,16 @@ if __name__ == "__main__":
|
|
|
179
162
|
|
|
180
163
|
若你想了解框架的整体结构与核心组件,下面的参考文档会对你有帮助:
|
|
181
164
|
|
|
182
|
-
- [
|
|
183
|
-
- [
|
|
184
|
-
- [
|
|
185
|
-
- [
|
|
186
|
-
- [
|
|
187
|
-
- [
|
|
188
|
-
- [
|
|
189
|
-
- [
|
|
190
|
-
- [
|
|
191
|
-
- [
|
|
192
|
-
- [other/go_worker.md](https://github.com/Mr-xiaotian/CelestialFlow/blob/main/docs/zh-CN/other/go_worker.md)
|
|
165
|
+
- [TaskExecutor.md](https://github.com/Mr-xiaotian/CelestialFlow/blob/main/docs/zh-CN/src/stage/core_executor.md)
|
|
166
|
+
- [TaskStage.md](https://github.com/Mr-xiaotian/CelestialFlow/blob/main/docs/zh-CN/src/stage/core_stage.md)
|
|
167
|
+
- [TaskGraph.md](https://github.com/Mr-xiaotian/CelestialFlow/blob/main/docs/zh-CN/src/graph/core_graph.md)
|
|
168
|
+
- [TaskProgress.md](https://github.com/Mr-xiaotian/CelestialFlow/blob/main/docs/zh-CN/src/observability/core_progress.md)
|
|
169
|
+
- [TaskMetrics.md](https://github.com/Mr-xiaotian/CelestialFlow/blob/main/docs/zh-CN/src/runtime/core_metrics.md)
|
|
170
|
+
- [TaskQueue.md](https://github.com/Mr-xiaotian/CelestialFlow/blob/main/docs/zh-CN/src/runtime/core_queue.md)
|
|
171
|
+
- [TaskStages.md](https://github.com/Mr-xiaotian/CelestialFlow/blob/main/docs/zh-CN/src/stage/core_stages.md)
|
|
172
|
+
- [TaskReport.md](https://github.com/Mr-xiaotian/CelestialFlow/blob/main/docs/zh-CN/src/observability/core_report.md)
|
|
173
|
+
- [TaskStructure.md](https://github.com/Mr-xiaotian/CelestialFlow/blob/main/docs/zh-CN/src/graph/core_structure.md)
|
|
174
|
+
- [Go Worker.md](https://github.com/Mr-xiaotian/CelestialFlow/blob/main/docs/zh-CN/other/go_worker.md)
|
|
193
175
|
|
|
194
176
|
推荐阅读顺序:
|
|
195
177
|
|
|
@@ -199,7 +181,6 @@ flowchart TD
|
|
|
199
181
|
classDef runtime fill:#e9f8ef,stroke:#22c55e,color:#14532d;
|
|
200
182
|
classDef structure fill:#fff6e6,stroke:#f59e0b,color:#78350f;
|
|
201
183
|
classDef execution fill:#f3e8ff,stroke:#a855f7,color:#581c87;
|
|
202
|
-
classDef web fill:#ffeaea,stroke:#ef4444,color:#7f1d1d;
|
|
203
184
|
|
|
204
185
|
TM[TaskExecutor.md] --> TS[TaskStage.md] --> TG[TaskGraph.md]
|
|
205
186
|
TM --> TP[TaskProgress.md]
|
|
@@ -210,23 +191,22 @@ flowchart TD
|
|
|
210
191
|
TG --> TR[TaskReport.md]
|
|
211
192
|
TG --> TSR[TaskStructure.md]
|
|
212
193
|
|
|
213
|
-
TR --> TW[TaskWeb.md]
|
|
214
194
|
TN --> GW[Go Worker.md]
|
|
215
195
|
|
|
216
196
|
class TM,TS,TG core;
|
|
217
197
|
class TP,TME runtime;
|
|
218
198
|
class TSR structure;
|
|
219
199
|
class TQ,TN,GW execution;
|
|
220
|
-
class TR
|
|
200
|
+
class TR execution;
|
|
221
201
|
```
|
|
222
202
|
|
|
223
|
-
|
|
203
|
+
以下五篇可以作为补充阅读:
|
|
224
204
|
|
|
225
|
-
- [
|
|
226
|
-
- [
|
|
227
|
-
- [
|
|
228
|
-
- [
|
|
229
|
-
- [
|
|
205
|
+
- [UtilHash.md](https://github.com/Mr-xiaotian/CelestialFlow/blob/main/docs/zh-CN/src/runtime/util_hash.md)
|
|
206
|
+
- [UtilTypes.md](https://github.com/Mr-xiaotian/CelestialFlow/blob/main/docs/zh-CN/src/runtime/util_types.md)
|
|
207
|
+
- [UtilErrors.md](https://github.com/Mr-xiaotian/CelestialFlow/blob/main/docs/zh-CN/src/runtime/util_errors.md)
|
|
208
|
+
- [Fallback.md](https://github.com/Mr-xiaotian/CelestialFlow/blob/main/docs/zh-CN/src/persistence/core_fallback.md)
|
|
209
|
+
- [Log.md](https://github.com/Mr-xiaotian/CelestialFlow/blob/main/docs/zh-CN/src/persistence/core_log.md)
|
|
230
210
|
|
|
231
211
|
如果你更喜欢通过完整案例理解框架的运行方式,可以参考这篇利用 TaskGraph 从零开始构建项目的教程:
|
|
232
212
|
|
|
@@ -256,76 +236,37 @@ flowchart TD
|
|
|
256
236
|
| 依赖包 | 说明 |
|
|
257
237
|
| ----------------- | ---- |
|
|
258
238
|
| **Python ≥ 3.12** | 运行环境,建议使用 3.12 及以上版本 |
|
|
259
|
-
| **fastapi** | Web 服务接口框架(用于任务可视化与远程控制) |
|
|
260
|
-
| **uvicorn** | FastAPI 的高性能 ASGI 服务器 |
|
|
261
239
|
| **requests** | HTTP 客户端库,用于任务状态上报与远程调用 |
|
|
262
|
-
| **networkx** | 任务图(TaskGraph)结构与依赖分析 |
|
|
263
|
-
| **jinja2** | FastAPI 模板引擎,用于 Web 可视化界面渲染 |
|
|
264
240
|
| **tqdm** | 可选组件,进度条显示,用于任务执行可视化 |
|
|
265
241
|
|
|
266
|
-
如需运行 `demo/demo_redis.py` 或 Go Worker 示例,请额外安装 `redis` 并准备 Redis 服务;这部分不属于默认运行时依赖。
|
|
242
|
+
- 如需运行 `demo/demo_redis.py` 或 Go Worker 示例,请额外安装 `redis` 并准备 Redis 服务;这部分不属于默认运行时依赖。
|
|
243
|
+
|
|
244
|
+
- 如需运行依赖 CelestialTree 的 demo / bench / 追踪查询,请额外安装 `celestialtree`,或直接在源码仓库中执行 `uv sync --group dev`。
|
|
267
245
|
|
|
268
|
-
|
|
246
|
+
- 如需使用可视化的Web服务, 请额外安装 `celestialflow-web` 并运行 `celestialflow-web --host 0.0.0.0 --port 5000`。
|
|
269
247
|
|
|
270
248
|
## 文件结构(File Structure)
|
|
271
249
|
|
|
272
250
|
<p align="center">
|
|
273
251
|
<img src="https://raw.githubusercontent.com/Mr-xiaotian/CelestialFlow/main/img/file_structure.svg" alt="FileStructure" />
|
|
274
252
|
<br/>
|
|
275
|
-
<em>celestial-flow 3.2.
|
|
253
|
+
<em>celestial-flow 3.2.6</em>
|
|
276
254
|
</p>
|
|
277
255
|
|
|
278
256
|
(该视图由我的另一个项目[CelestialVault](https://github.com/Mr-xiaotian/CelestialVault)中inst_file.FileTree.print_tree()生成。转换为图片则借助[Carbon](https://carbon.now.sh)。)
|
|
279
257
|
|
|
280
258
|
## 版本日志(Version Log)
|
|
281
|
-
- 3.2.
|
|
259
|
+
- 3.2.6
|
|
282
260
|
- feat:
|
|
283
|
-
-
|
|
284
|
-
-
|
|
285
|
-
- Richard 万岁!
|
|
286
|
-
- 至于原有的 `success_funnel` 机制完全是个半成品: 只能用于 `executor`, 而不能用于 `stage`; 完全在内存存储. 所以借着这次机会也一并重构, 合并入 `fallback_funnel`
|
|
287
|
-
- 现在 `fallback_funnel` 会在任务 `注入/重复/重试/失败/成功` 时对sqlite中相应记录进行插入/更新/删除操作
|
|
288
|
-
- 其中在任务成功时默认会删除该条记录, 但如果开启 `executor` 中的 `perist_result` 选项, 则会保留该条记录, 并将 `status` 字段更新为 `success`
|
|
289
|
-
- **[IMPORTANT]** 移除 `stages` 中的三个redis节点, 并添加demo文件, 说明如果自行构建相关节点
|
|
290
|
-
- 相比 `TaskSplitter` 与 `TaskRouter`, 这三个节点实在可有可无, 还会导致多一个 `redis` 依赖包
|
|
291
|
-
- **[IMPORTANT]** `celestialtree` 不再继续作为依赖库, 现有的事件声明机制基于一套protol接口, 并默认使用本地的超简化实现
|
|
292
|
-
- 这样做同样是为了避免太多库依赖, `celestialtree` 库包含对 `grpcio` 与 `protobuf` 的依赖, 而这两者对于python free-threading版本的支持性不太好, 因此在有他们的情况下 `celestialflow` 无法在free-threading版本下运行----而这是我非常期待的
|
|
293
|
-
- 根据 `bench_gil_vs_nogil`, 在free-threading版本下, `executor` 在cpu密集任务中会得到5.25倍提升, 而 `graph` 在cpu密集任务中则会得到7.55倍提升. 非常喜人
|
|
294
|
-
- 在前端 `节点指标走向` 卡片中添加 `全局等待队列`
|
|
295
|
-
- 在 `graph` 中添加 `start_graph_db` 方法, 接受一个fallback数据库地址, 然后根据其中失败数据进行 `start_graph`; 在 `executor` 中添加 `start_db` 方法, 接受一个fallback数据库地址, 然后根据其中失败数据进行 `start`
|
|
296
|
-
- 很方便
|
|
261
|
+
- 在 `graph` 与 `stage` 中添加直接读取db文件并重试/继续任务的方法
|
|
262
|
+
- 分别为 `start_graph_db` 与 `start_db`
|
|
297
263
|
- refactor:
|
|
298
|
-
- **[IMPORTANT]** 将
|
|
299
|
-
-
|
|
300
|
-
|
|
301
|
-
- 重写reporter与server端的交互逻辑
|
|
302
|
-
- 现在每一轮refresh开始时都会进行状态对齐, 通过 `graph_id` 确定两者所持有的数据是否来自一个 `graph` 对象, 是的话则不用重复push structure/analysis数据
|
|
303
|
-
- 在状态对齐时如果双方的graph一致, server会返回自己所持有的错误数据中最大的 `event_id` 值, 经过严格校验, `event_id` 在数据库中严格递增
|
|
304
|
-
- 将reporter中原有的 `push_error_meta` 与 `push_error_content` 合并, 每次刷新时只发送新增的错误数据, 而新增数据则根据server返回的最大 `event_id` 值与本地数据库中的最大 `event_id` 值进行筛选
|
|
305
|
-
- 为 `graph.connect` 与 `graph_set_stage` 绑定更多职责
|
|
306
|
-
- 现在节点与 `graph` 在 `ctree` `reporter` 上的同步在 `graph_set_stage` 中完成
|
|
307
|
-
- 而 `task_queue` 与 `result_queue` 的上下流绑定, 以及 `counter` 的绑定都在 `graph.connect` 中完成
|
|
308
|
-
- 删除 `TaskEnvelope` 中无关数据, 只保留 `task` `hash` `id` 三项
|
|
309
|
-
- `source` 字段本就不该添加, 它一致没有发挥作用
|
|
310
|
-
- `prev` 字段是为了原版 `success_funnel` 而服务的, 现在已经没有必要
|
|
311
|
-
- `TaskMetrics` 中固定使用 `Lock` 对所有 `counter` 进行限定, 而无关乎 `executor` 的 `execution_mode`
|
|
312
|
-
- 这种固定的模式在牺牲部分性能的情况下使得代码更加稳定
|
|
313
|
-
- 根据 `bench_lock_overhead`, 这会导致 `counter` 慢3.2倍左右, 考虑到 `counter` 的更新全部基于 `int` 类型, 本就很快, 可以接受
|
|
314
|
-
- 在 `process_task_success` 中除去已有的一次 `task.success` 声明, 会在 `result_envelope` 进入 `result_queue` 前再进行 `task.input` 声明
|
|
315
|
-
- 为了保证fallback的sqlite中 `event_id` 全局统一
|
|
316
|
-
- `executor.get_fail_pairs`(原 `executor.get_error_pairs`) 会返回 `tuple[T, PeristedError]`
|
|
317
|
-
- `PeristedError` 由记录的 `error_type` 与 `error_message` 组成
|
|
318
|
-
- 重写 `TaskRouter` 节点, 现在必须传入一个 `router` 函数, 去指定任务的路由方向
|
|
319
|
-
- 移除一些没用的方法
|
|
320
|
-
- 比如 `TaskGraph.get_stage_input_trace`
|
|
321
|
-
- fix:
|
|
322
|
-
- 前端仪表盘页面中的结构图不会再因切换tab而显示空白
|
|
323
|
-
- 这是很古老的bug, 我不知道我为什么译制片没有修复
|
|
264
|
+
- **[IMPORTANT]** 将web部分移至单独项目 [celestialflow-web](https://github.com/Mr-xiaotian/celestialflow-web)
|
|
265
|
+
- 考虑许久的决定, 当前的web端代码与项目整体风格差异极大, 已经不再适合继续合并一处
|
|
266
|
+
- 当然这意味着 `celestialflow-web` 命令在当前项目下失效, 需要单独安装 `pip install celestialflow-web`
|
|
324
267
|
- chore:
|
|
325
|
-
-
|
|
326
|
-
-
|
|
327
|
-
- 添加 `Agents.md` 文件
|
|
328
|
-
- 我受够了无休止的对ai进行强调
|
|
268
|
+
- 全量更新文档, 并翻译为en/ja双语言
|
|
269
|
+
- 移除 docs/zh-CN 下的 `README.md`, 现在中文readme只保留根目录下的这一份
|
|
329
270
|
|
|
330
271
|
更多过往日志可看:
|
|
331
272
|
|
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
# CelestialFlow ——一个轻量级、可并行、基于图结构的 Python 任务调度框架
|
|
2
|
+
|
|
3
|
+
<p align="center">
|
|
4
|
+
<img src="https://raw.githubusercontent.com/Mr-xiaotian/CelestialFlow/main/img/logo.png" width="1080" alt="CelestialFlow Logo">
|
|
5
|
+
</p>
|
|
6
|
+
|
|
7
|
+
<p align="center">
|
|
8
|
+
<a href="https://pypi.org/project/celestialflow/"><img src="https://badge.fury.io/py/celestialflow.svg"></a>
|
|
9
|
+
<a href="https://pepy.tech/projects/celestialflow"><img src="https://static.pepy.tech/personalized-badge/celestialflow?period=total&units=INTERNATIONAL_SYSTEM&left_color=BLACK&right_color=GREEN&left_text=downloads"></a>
|
|
10
|
+
<a href="https://pypi.org/project/celestialflow/"><img src="https://img.shields.io/pypi/l/celestialflow.svg"></a>
|
|
11
|
+
<a href="https://pypi.org/project/celestialflow/"><img src="https://img.shields.io/pypi/pyversions/celestialflow.svg"></a>
|
|
12
|
+
</p>
|
|
13
|
+
|
|
14
|
+
<p align="center">
|
|
15
|
+
<img src="https://img.shields.io/badge/Task%20Graph-DAG-blueviolet">
|
|
16
|
+
<img src="https://img.shields.io/badge/Workflow-Orchestrator-7c3aed">
|
|
17
|
+
<img src="https://img.shields.io/badge/Event%20Tracing-CelestialTree-0ea5e9">
|
|
18
|
+
</p>
|
|
19
|
+
|
|
20
|
+
<p align="center">
|
|
21
|
+
<a href="https://github.com/Mr-xiaotian/CelestialFlow/blob/main/README.md">中文</a> | <a href="https://github.com/Mr-xiaotian/CelestialFlow/blob/main/docs/en/README.md">English</a> | <a href="https://github.com/Mr-xiaotian/CelestialFlow/blob/main/docs/ja/README.md">日本語</a>
|
|
22
|
+
</p>
|
|
23
|
+
|
|
24
|
+
**CelestialFlow** 是一个轻量级但功能完全的任务流框架,适合需要 **复杂依赖关系**、**灵活执行模型**、**跨设备运行** 与 **可观测执行链路** 的中/大型 Python 任务系统。
|
|
25
|
+
|
|
26
|
+
- 相比 Airflow/Dagster 更轻、更快开始
|
|
27
|
+
- 相比 multiprocessing/threading 更结构化,可直接表达 loop / complete graph 等复杂依赖模式
|
|
28
|
+
|
|
29
|
+
框架的基本单元为 **TaskExecutor**,可独立运行,并支持三种执行模式:
|
|
30
|
+
|
|
31
|
+
* **线性(serial)**
|
|
32
|
+
* **多线程(thread)**
|
|
33
|
+
* **协程(async)**
|
|
34
|
+
|
|
35
|
+
TaskExecutor 实现了对任务的结果缓存,任务去重,进度条显示,多执行模式比较等功能,单独使用也很好用。
|
|
36
|
+
|
|
37
|
+
但除去直接使用 TaskExecutor,更重要的是使用其子类**TaskStage**。TaskStage 可以互相连接,形成具有上游与下游依赖关系的任务图(**TaskGraph**)。下游 stage 会自动接收上游执行完成的结果作为输入,从而形成明确的数据流。
|
|
38
|
+
|
|
39
|
+
TaskStage 的任务执行模式同样包含三种,与TaskExecutor中一致。
|
|
40
|
+
|
|
41
|
+
在图级别上,每个 Stage 支持两种上下文模式:
|
|
42
|
+
|
|
43
|
+
* **线性执行(serial layout)**:当前节点执行完毕再启动下一节点(下游节点可提前接收任务但不会立即执行)。
|
|
44
|
+
* **线程执行(thread layout)**:当前节点在主进程的独立线程中启动,适合 I/O 密集型任务和不可 pickle 的函数(如 lambda)。
|
|
45
|
+
|
|
46
|
+
TaskGraph 能构建完整的 **有向图结构(Directed Graph)**,不仅支持传统的有向无环图(DAG),也能灵活表达 **树形(Tree)**、**环形(loop)** 乃至于 **完全图(Complete Graph)** 形式的任务依赖。
|
|
47
|
+
|
|
48
|
+
在执行与调度之外,CelestialFlow 进一步引入 **CelestialTree(简称: ctree) 事件追踪系统**,为每一个任务及其衍生行为(成功、失败、重试、拆分、路由等)记录明确的因果关系。借助 ctree,可以从任意一个初始任务出发,完整还原其在 TaskGraph 中的传播路径与执行轨迹,使任务系统可以进行完整的**追溯、分析、解释**。
|
|
49
|
+
|
|
50
|
+
在此基础上,CelestialFlow 提供事件追踪、状态上报、持久化回放,并提供基于 Redis 的 demo 与 Go Worker 外部协作示例,用于展示按需构建跨进程、跨设备任务协作的方式。
|
|
51
|
+
|
|
52
|
+
## 项目结构(Project Structure)
|
|
53
|
+
|
|
54
|
+
```mermaid
|
|
55
|
+
flowchart LR
|
|
56
|
+
|
|
57
|
+
%% ===== TaskGraph =====
|
|
58
|
+
subgraph TG[TaskGraph]
|
|
59
|
+
direction LR
|
|
60
|
+
|
|
61
|
+
S1[TaskStage A]
|
|
62
|
+
S2[TaskStage B]
|
|
63
|
+
S3[TaskStage C]
|
|
64
|
+
S4[TaskStage D]
|
|
65
|
+
|
|
66
|
+
S1 --> S2 --> S3 --> S1
|
|
67
|
+
S1 --> S4
|
|
68
|
+
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
%% 美化 TaskGraph 外框
|
|
72
|
+
style TG fill:#e8f2ff,stroke:#6b93d6,stroke-width:2px,color:#0b1e3f,rx:10px,ry:10px
|
|
73
|
+
|
|
74
|
+
%% 统一美化格式
|
|
75
|
+
classDef blueNode fill:#ffffff,stroke:#6b93d6,rx:6px,ry:6px;
|
|
76
|
+
|
|
77
|
+
%% 美化 TaskStages
|
|
78
|
+
class S1,S2,S3,S4 blueNode;
|
|
79
|
+
|
|
80
|
+
%% ===== Links =====
|
|
81
|
+
TG --> CFB[CelestialFlow Web]
|
|
82
|
+
CFB --> TG
|
|
83
|
+
|
|
84
|
+
style CFB fill:#ffeaf0,stroke:#d66b8c,stroke-width:2px,rx:10px,ry:10px
|
|
85
|
+
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## 快速开始(Quick Start)
|
|
89
|
+
|
|
90
|
+
安装 CelestialFlow:
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
# 推荐使用 `uv` 管理依赖与环境
|
|
94
|
+
uv pip install celestialflow
|
|
95
|
+
|
|
96
|
+
# 不过也可以直接使用 `pip`
|
|
97
|
+
pip install celestialflow
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
如果你只使用 CelestialFlow 的核心调度、可观测性与持久化能力,上面的安装已经足够。
|
|
101
|
+
|
|
102
|
+
如果你还需要启用 CelestialTree 事件追踪能力,则需要**额外安装** `celestialtree`:
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
# 对已发布包使用者
|
|
106
|
+
uv pip install celestialtree
|
|
107
|
+
|
|
108
|
+
# 如果你是 clone 仓库后的开发者/贡献者
|
|
109
|
+
uv sync --group dev
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
一个简单的可运行代码:
|
|
113
|
+
|
|
114
|
+
```python
|
|
115
|
+
from celestialflow import TaskStage, TaskGraph
|
|
116
|
+
|
|
117
|
+
def add(x, y):
|
|
118
|
+
return x + y
|
|
119
|
+
|
|
120
|
+
def square(x):
|
|
121
|
+
return x ** 2
|
|
122
|
+
|
|
123
|
+
if __name__ == "__main__":
|
|
124
|
+
# 定义两个任务节点
|
|
125
|
+
stage1 = TaskStage(name="Adder", func=add, stage_mode="thread", execution_mode="thread", unpack_task_args=True)
|
|
126
|
+
stage2 = TaskStage(name="Squarer", func=square, stage_mode="thread", execution_mode="thread")
|
|
127
|
+
|
|
128
|
+
# 构建任务图结构
|
|
129
|
+
graph = TaskGraph(name="DemoGraph")
|
|
130
|
+
graph.set_stages(stages=[stage1, stage2])
|
|
131
|
+
graph.connect([stage1], [stage2])
|
|
132
|
+
|
|
133
|
+
# 初始化任务并启动
|
|
134
|
+
graph.start_graph({stage1.get_name(): [(1, 2), (3, 4), (5, 6)]})
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
注意不要在.ipynb中运行。
|
|
138
|
+
|
|
139
|
+
👉 想查看完整Quick Start,请见[Quick Start](https://github.com/Mr-xiaotian/CelestialFlow/blob/main/docs/zh-CN/quick_start.md)
|
|
140
|
+
|
|
141
|
+
## 深入阅读(Further Reading)
|
|
142
|
+
|
|
143
|
+
若你想了解框架的整体结构与核心组件,下面的参考文档会对你有帮助:
|
|
144
|
+
|
|
145
|
+
- [TaskExecutor.md](https://github.com/Mr-xiaotian/CelestialFlow/blob/main/docs/zh-CN/src/stage/core_executor.md)
|
|
146
|
+
- [TaskStage.md](https://github.com/Mr-xiaotian/CelestialFlow/blob/main/docs/zh-CN/src/stage/core_stage.md)
|
|
147
|
+
- [TaskGraph.md](https://github.com/Mr-xiaotian/CelestialFlow/blob/main/docs/zh-CN/src/graph/core_graph.md)
|
|
148
|
+
- [TaskProgress.md](https://github.com/Mr-xiaotian/CelestialFlow/blob/main/docs/zh-CN/src/observability/core_progress.md)
|
|
149
|
+
- [TaskMetrics.md](https://github.com/Mr-xiaotian/CelestialFlow/blob/main/docs/zh-CN/src/runtime/core_metrics.md)
|
|
150
|
+
- [TaskQueue.md](https://github.com/Mr-xiaotian/CelestialFlow/blob/main/docs/zh-CN/src/runtime/core_queue.md)
|
|
151
|
+
- [TaskStages.md](https://github.com/Mr-xiaotian/CelestialFlow/blob/main/docs/zh-CN/src/stage/core_stages.md)
|
|
152
|
+
- [TaskReport.md](https://github.com/Mr-xiaotian/CelestialFlow/blob/main/docs/zh-CN/src/observability/core_report.md)
|
|
153
|
+
- [TaskStructure.md](https://github.com/Mr-xiaotian/CelestialFlow/blob/main/docs/zh-CN/src/graph/core_structure.md)
|
|
154
|
+
- [Go Worker.md](https://github.com/Mr-xiaotian/CelestialFlow/blob/main/docs/zh-CN/other/go_worker.md)
|
|
155
|
+
|
|
156
|
+
推荐阅读顺序:
|
|
157
|
+
|
|
158
|
+
```mermaid
|
|
159
|
+
flowchart TD
|
|
160
|
+
classDef core fill:#e6efff,stroke:#3b82f6,color:#1e3a8a;
|
|
161
|
+
classDef runtime fill:#e9f8ef,stroke:#22c55e,color:#14532d;
|
|
162
|
+
classDef structure fill:#fff6e6,stroke:#f59e0b,color:#78350f;
|
|
163
|
+
classDef execution fill:#f3e8ff,stroke:#a855f7,color:#581c87;
|
|
164
|
+
|
|
165
|
+
TM[TaskExecutor.md] --> TS[TaskStage.md] --> TG[TaskGraph.md]
|
|
166
|
+
TM --> TP[TaskProgress.md]
|
|
167
|
+
TM --> TME[TaskMetrics.md]
|
|
168
|
+
|
|
169
|
+
TG --> TQ[TaskQueue.md]
|
|
170
|
+
TG --> TN[TaskStages.md]
|
|
171
|
+
TG --> TR[TaskReport.md]
|
|
172
|
+
TG --> TSR[TaskStructure.md]
|
|
173
|
+
|
|
174
|
+
TN --> GW[Go Worker.md]
|
|
175
|
+
|
|
176
|
+
class TM,TS,TG core;
|
|
177
|
+
class TP,TME runtime;
|
|
178
|
+
class TSR structure;
|
|
179
|
+
class TQ,TN,GW execution;
|
|
180
|
+
class TR execution;
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
以下五篇可以作为补充阅读:
|
|
184
|
+
|
|
185
|
+
- [UtilHash.md](https://github.com/Mr-xiaotian/CelestialFlow/blob/main/docs/zh-CN/src/runtime/util_hash.md)
|
|
186
|
+
- [UtilTypes.md](https://github.com/Mr-xiaotian/CelestialFlow/blob/main/docs/zh-CN/src/runtime/util_types.md)
|
|
187
|
+
- [UtilErrors.md](https://github.com/Mr-xiaotian/CelestialFlow/blob/main/docs/zh-CN/src/runtime/util_errors.md)
|
|
188
|
+
- [Fallback.md](https://github.com/Mr-xiaotian/CelestialFlow/blob/main/docs/zh-CN/src/persistence/core_fallback.md)
|
|
189
|
+
- [Log.md](https://github.com/Mr-xiaotian/CelestialFlow/blob/main/docs/zh-CN/src/persistence/core_log.md)
|
|
190
|
+
|
|
191
|
+
如果你更喜欢通过完整案例理解框架的运行方式,可以参考这篇利用 TaskGraph 从零开始构建项目的教程:
|
|
192
|
+
|
|
193
|
+
[📘案例教程](https://github.com/Mr-xiaotian/CelestialFlow/blob/main/docs/zh-CN/tutorial.md)
|
|
194
|
+
|
|
195
|
+
如果你对3.0.7版本加入的ctree_client与其功能感兴趣, 可以看看这一篇:
|
|
196
|
+
|
|
197
|
+
[📚CelestialTreeClient](https://github.com/Mr-xiaotian/CelestialFlow/blob/main/docs/zh-CN/other/ctree_client.md)
|
|
198
|
+
|
|
199
|
+
你可以继续运行更多的演示代码,这里记录了各个演示文件与其中的演示函数说明:
|
|
200
|
+
|
|
201
|
+
[🎮demo/ 总览](https://github.com/Mr-xiaotian/CelestialFlow/blob/main/docs/zh-CN/demo/README.md)
|
|
202
|
+
|
|
203
|
+
如果你想运行测试代码,可以先查看如下文档内容:
|
|
204
|
+
|
|
205
|
+
[🧪tests/ 总览](https://github.com/Mr-xiaotian/CelestialFlow/blob/main/docs/zh-CN/tests/README.md)
|
|
206
|
+
|
|
207
|
+
如果你想查看 bench 内容,这些数据也是框架中部分设计取舍的依据:
|
|
208
|
+
|
|
209
|
+
[⚡bench/ 总览](https://github.com/Mr-xiaotian/CelestialFlow/blob/main/docs/zh-CN/bench/README.md)
|
|
210
|
+
|
|
211
|
+
## 环境要求(Requirements)
|
|
212
|
+
|
|
213
|
+
**CelestialFlow** 基于 Python 3.12+,默认运行时依赖以下核心组件。
|
|
214
|
+
其中 `celestialtree` 不再属于默认运行时依赖,而是额外安装的可选组件。
|
|
215
|
+
|
|
216
|
+
| 依赖包 | 说明 |
|
|
217
|
+
| ----------------- | ---- |
|
|
218
|
+
| **Python ≥ 3.12** | 运行环境,建议使用 3.12 及以上版本 |
|
|
219
|
+
| **requests** | HTTP 客户端库,用于任务状态上报与远程调用 |
|
|
220
|
+
| **tqdm** | 可选组件,进度条显示,用于任务执行可视化 |
|
|
221
|
+
|
|
222
|
+
- 如需运行 `demo/demo_redis.py` 或 Go Worker 示例,请额外安装 `redis` 并准备 Redis 服务;这部分不属于默认运行时依赖。
|
|
223
|
+
|
|
224
|
+
- 如需运行依赖 CelestialTree 的 demo / bench / 追踪查询,请额外安装 `celestialtree`,或直接在源码仓库中执行 `uv sync --group dev`。
|
|
225
|
+
|
|
226
|
+
- 如需使用可视化的Web服务, 请额外安装 `celestialflow-web` 并运行 `celestialflow-web --host 0.0.0.0 --port 5000`。
|
|
227
|
+
|
|
228
|
+
## 文件结构(File Structure)
|
|
229
|
+
|
|
230
|
+
<p align="center">
|
|
231
|
+
<img src="https://raw.githubusercontent.com/Mr-xiaotian/CelestialFlow/main/img/file_structure.svg" alt="FileStructure" />
|
|
232
|
+
<br/>
|
|
233
|
+
<em>celestial-flow 3.2.6</em>
|
|
234
|
+
</p>
|
|
235
|
+
|
|
236
|
+
(该视图由我的另一个项目[CelestialVault](https://github.com/Mr-xiaotian/CelestialVault)中inst_file.FileTree.print_tree()生成。转换为图片则借助[Carbon](https://carbon.now.sh)。)
|
|
237
|
+
|
|
238
|
+
## 版本日志(Version Log)
|
|
239
|
+
- 3.2.6
|
|
240
|
+
- feat:
|
|
241
|
+
- 在 `graph` 与 `stage` 中添加直接读取db文件并重试/继续任务的方法
|
|
242
|
+
- 分别为 `start_graph_db` 与 `start_db`
|
|
243
|
+
- refactor:
|
|
244
|
+
- **[IMPORTANT]** 将web部分移至单独项目 [celestialflow-web](https://github.com/Mr-xiaotian/celestialflow-web)
|
|
245
|
+
- 考虑许久的决定, 当前的web端代码与项目整体风格差异极大, 已经不再适合继续合并一处
|
|
246
|
+
- 当然这意味着 `celestialflow-web` 命令在当前项目下失效, 需要单独安装 `pip install celestialflow-web`
|
|
247
|
+
- chore:
|
|
248
|
+
- 全量更新文档, 并翻译为en/ja双语言
|
|
249
|
+
- 移除 docs/zh-CN 下的 `README.md`, 现在中文readme只保留根目录下的这一份
|
|
250
|
+
|
|
251
|
+
更多过往日志可看:
|
|
252
|
+
|
|
253
|
+
[change_log.md](https://github.com/Mr-xiaotian/CelestialFlow/blob/main/docs/zh-CN/change_log.md)
|
|
254
|
+
|
|
255
|
+
## Star 历史趋势(Star History)
|
|
256
|
+
|
|
257
|
+
如果对项目感兴趣的话,欢迎star。如果有问题或者建议的话, 欢迎提交[Issues](https://github.com/Mr-xiaotian/CelestialFlow/issues)或者在[Discussion](https://github.com/Mr-xiaotian/CelestialFlow/discussions)中告诉我。
|
|
258
|
+
|
|
259
|
+

|
|
260
|
+
|
|
261
|
+
## 许可(License)
|
|
262
|
+
This project is licensed under the MIT License - see the [LICENSE](https://github.com/Mr-xiaotian/CelestialFlow/blob/main/LICENSE) file for details.
|
|
263
|
+
|
|
264
|
+
## 作者(Author)
|
|
265
|
+
Author: Mr-xiaotian
|
|
266
|
+
Email: mingxiaomingtian@gmail.com
|
|
267
|
+
Project Link: [https://github.com/Mr-xiaotian/CelestialFlow](https://github.com/Mr-xiaotian/CelestialFlow)
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "celestialflow"
|
|
7
|
-
version = "3.2.
|
|
7
|
+
version = "3.2.6"
|
|
8
8
|
description = "A flexible GRAPH-based task orchestration framework."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = { text = "MIT" }
|
|
@@ -14,18 +14,13 @@ requires-python = ">=3.12"
|
|
|
14
14
|
|
|
15
15
|
dependencies = [
|
|
16
16
|
"tqdm",
|
|
17
|
-
"fastapi",
|
|
18
|
-
"uvicorn",
|
|
19
17
|
"requests",
|
|
20
|
-
"networkx",
|
|
21
|
-
"jinja2",
|
|
22
18
|
]
|
|
23
19
|
|
|
24
20
|
classifiers = [
|
|
25
21
|
"Programming Language :: Python :: 3",
|
|
26
22
|
"License :: OSI Approved :: MIT License",
|
|
27
23
|
"Operating System :: OS Independent",
|
|
28
|
-
"Framework :: FastAPI",
|
|
29
24
|
"Topic :: Software Development :: Libraries",
|
|
30
25
|
]
|
|
31
26
|
|
|
@@ -33,19 +28,6 @@ classifiers = [
|
|
|
33
28
|
"Homepage" = "https://github.com/Mr-xiaotian/CelestialFlow"
|
|
34
29
|
"Bug Tracker" = "https://github.com/Mr-xiaotian/CelestialFlow/issues"
|
|
35
30
|
|
|
36
|
-
[project.scripts]
|
|
37
|
-
celestialflow-web = "celestialflow.web.core_server:main_entry"
|
|
38
|
-
|
|
39
|
-
[tool.setuptools]
|
|
40
|
-
license-files = []
|
|
41
|
-
|
|
42
|
-
[tool.setuptools.package-data]
|
|
43
|
-
celestialflow = [
|
|
44
|
-
"web/templates/**/*.html",
|
|
45
|
-
"web/static/**/*",
|
|
46
|
-
"web/config.json"
|
|
47
|
-
]
|
|
48
|
-
|
|
49
31
|
[tool.pytest.ini_options]
|
|
50
32
|
addopts = "-s"
|
|
51
33
|
log_cli = true
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
# __init__.py
|
|
2
2
|
"""CelestialFlow — 基于图结构的轻量级异步任务编排框架。
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
提供任务图构建、执行调度、实时监控与持久化等核心能力。
|
|
5
5
|
"""
|
|
6
6
|
|
|
7
|
+
from .funnel import BaseInlet, BaseSpout
|
|
7
8
|
from .graph import (
|
|
8
9
|
TaskChain,
|
|
9
10
|
TaskComplete,
|
|
@@ -16,7 +17,7 @@ from .graph import (
|
|
|
16
17
|
from .observability import BaseObserver, TaskProgress
|
|
17
18
|
from .persistence.util_sqlite import (
|
|
18
19
|
load_records,
|
|
19
|
-
|
|
20
|
+
load_tasks_grouped_by_stage,
|
|
20
21
|
)
|
|
21
22
|
from .runtime.util_hash import make_hashable
|
|
22
23
|
from .runtime.util_types import TerminationSignal
|
|
@@ -28,10 +29,11 @@ from .stage import (
|
|
|
28
29
|
)
|
|
29
30
|
from .utils.util_benchmark import benchmark_executor, benchmark_graph
|
|
30
31
|
from .utils.util_format import format_table
|
|
31
|
-
from .web import TaskWebServer
|
|
32
32
|
|
|
33
33
|
__all__ = [
|
|
34
|
+
"BaseInlet",
|
|
34
35
|
"BaseObserver",
|
|
36
|
+
"BaseSpout",
|
|
35
37
|
"TaskChain",
|
|
36
38
|
"TaskComplete",
|
|
37
39
|
"TaskCross",
|
|
@@ -43,13 +45,12 @@ __all__ = [
|
|
|
43
45
|
"TaskRouter",
|
|
44
46
|
"TaskSplitter",
|
|
45
47
|
"TaskStage",
|
|
46
|
-
"TaskWebServer",
|
|
47
48
|
"TaskWheel",
|
|
48
49
|
"TerminationSignal",
|
|
49
50
|
"benchmark_executor",
|
|
50
51
|
"benchmark_graph",
|
|
51
52
|
"format_table",
|
|
52
53
|
"load_records",
|
|
53
|
-
"
|
|
54
|
+
"load_tasks_grouped_by_stage",
|
|
54
55
|
"make_hashable",
|
|
55
56
|
]
|