celestialflow 3.2.5__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.5 → celestialflow-3.2.6}/PKG-INFO +42 -67
- {celestialflow-3.2.5 → celestialflow-3.2.6}/README.md +39 -62
- {celestialflow-3.2.5 → celestialflow-3.2.6}/pyproject.toml +1 -18
- {celestialflow-3.2.5 → celestialflow-3.2.6}/src/celestialflow/__init__.py +1 -5
- {celestialflow-3.2.5 → celestialflow-3.2.6}/src/celestialflow/funnel/__init__.py +5 -0
- {celestialflow-3.2.5 → celestialflow-3.2.6}/src/celestialflow/funnel/core_inlet.py +1 -1
- {celestialflow-3.2.5 → celestialflow-3.2.6}/src/celestialflow/graph/__init__.py +5 -0
- {celestialflow-3.2.5 → celestialflow-3.2.6}/src/celestialflow/graph/core_graph.py +25 -6
- {celestialflow-3.2.5 → celestialflow-3.2.6}/src/celestialflow/graph/core_structure.py +0 -88
- {celestialflow-3.2.5 → celestialflow-3.2.6}/src/celestialflow/graph/util_graph.py +1 -0
- {celestialflow-3.2.5 → celestialflow-3.2.6}/src/celestialflow/observability/core_report.py +1 -1
- {celestialflow-3.2.5 → celestialflow-3.2.6}/src/celestialflow/persistence/__init__.py +5 -0
- {celestialflow-3.2.5 → celestialflow-3.2.6}/src/celestialflow/persistence/core_fallback.py +1 -1
- {celestialflow-3.2.5 → celestialflow-3.2.6}/src/celestialflow/persistence/util_sqlite.py +110 -117
- {celestialflow-3.2.5 → celestialflow-3.2.6}/src/celestialflow/runtime/__init__.py +6 -0
- {celestialflow-3.2.5 → celestialflow-3.2.6}/src/celestialflow/runtime/core_metrics.py +9 -0
- {celestialflow-3.2.5 → celestialflow-3.2.6}/src/celestialflow/runtime/util_constant.py +3 -6
- {celestialflow-3.2.5 → celestialflow-3.2.6}/src/celestialflow/runtime/util_errors.py +6 -24
- {celestialflow-3.2.5 → celestialflow-3.2.6}/src/celestialflow/runtime/util_estimators.py +8 -8
- {celestialflow-3.2.5 → celestialflow-3.2.6}/src/celestialflow/stage/__init__.py +6 -0
- {celestialflow-3.2.5 → celestialflow-3.2.6}/src/celestialflow/stage/core_executor.py +27 -7
- {celestialflow-3.2.5 → celestialflow-3.2.6}/src/celestialflow.egg-info/PKG-INFO +42 -67
- 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.5/src/celestialflow/web/__init__.py +0 -11
- celestialflow-3.2.5/src/celestialflow/web/config.json +0 -34
- celestialflow-3.2.5/src/celestialflow/web/core_server.py +0 -444
- celestialflow-3.2.5/src/celestialflow/web/routes/__init__.py +0 -33
- celestialflow-3.2.5/src/celestialflow/web/routes/pull_routes.py +0 -149
- celestialflow-3.2.5/src/celestialflow/web/routes/push_routes.py +0 -152
- celestialflow-3.2.5/src/celestialflow/web/static/css/_colors.css +0 -136
- celestialflow-3.2.5/src/celestialflow/web/static/css/base.css +0 -856
- celestialflow-3.2.5/src/celestialflow/web/static/css/dashboard.css +0 -175
- celestialflow-3.2.5/src/celestialflow/web/static/css/dashboard_analysis.css +0 -41
- celestialflow-3.2.5/src/celestialflow/web/static/css/dashboard_error_types.css +0 -100
- celestialflow-3.2.5/src/celestialflow/web/static/css/dashboard_history.css +0 -89
- celestialflow-3.2.5/src/celestialflow/web/static/css/dashboard_statuses.css +0 -225
- celestialflow-3.2.5/src/celestialflow/web/static/css/dashboard_structure.css +0 -27
- celestialflow-3.2.5/src/celestialflow/web/static/css/dashboard_summary.css +0 -136
- celestialflow-3.2.5/src/celestialflow/web/static/css/errors.css +0 -364
- celestialflow-3.2.5/src/celestialflow/web/static/css/injection_editor.css +0 -214
- celestialflow-3.2.5/src/celestialflow/web/static/css/injection_layout.css +0 -82
- celestialflow-3.2.5/src/celestialflow/web/static/css/injection_nodes.css +0 -92
- celestialflow-3.2.5/src/celestialflow/web/static/css/injection_preview.css +0 -140
- celestialflow-3.2.5/src/celestialflow/web/static/favicon.ico +0 -0
- celestialflow-3.2.5/src/celestialflow/web/static/js/dashboard_analysis.js +0 -84
- celestialflow-3.2.5/src/celestialflow/web/static/js/dashboard_error_types.js +0 -223
- celestialflow-3.2.5/src/celestialflow/web/static/js/dashboard_history.js +0 -393
- celestialflow-3.2.5/src/celestialflow/web/static/js/dashboard_statuses.js +0 -252
- celestialflow-3.2.5/src/celestialflow/web/static/js/dashboard_structure.js +0 -186
- celestialflow-3.2.5/src/celestialflow/web/static/js/dashboard_summary.js +0 -44
- celestialflow-3.2.5/src/celestialflow/web/static/js/errors.js +0 -250
- celestialflow-3.2.5/src/celestialflow/web/static/js/i18n.js +0 -477
- celestialflow-3.2.5/src/celestialflow/web/static/js/injection.js +0 -695
- celestialflow-3.2.5/src/celestialflow/web/static/js/layout_editor.js +0 -196
- celestialflow-3.2.5/src/celestialflow/web/static/js/main.js +0 -351
- celestialflow-3.2.5/src/celestialflow/web/static/js/utils.js +0 -177
- celestialflow-3.2.5/src/celestialflow/web/static/js/web_config.js +0 -483
- celestialflow-3.2.5/src/celestialflow/web/static/ts/dashboard_analysis.ts +0 -98
- celestialflow-3.2.5/src/celestialflow/web/static/ts/dashboard_error_types.ts +0 -247
- celestialflow-3.2.5/src/celestialflow/web/static/ts/dashboard_history.ts +0 -478
- celestialflow-3.2.5/src/celestialflow/web/static/ts/dashboard_statuses.ts +0 -360
- celestialflow-3.2.5/src/celestialflow/web/static/ts/dashboard_structure.ts +0 -221
- celestialflow-3.2.5/src/celestialflow/web/static/ts/dashboard_summary.ts +0 -49
- celestialflow-3.2.5/src/celestialflow/web/static/ts/errors.ts +0 -301
- celestialflow-3.2.5/src/celestialflow/web/static/ts/globals.d.ts +0 -166
- celestialflow-3.2.5/src/celestialflow/web/static/ts/i18n.ts +0 -524
- celestialflow-3.2.5/src/celestialflow/web/static/ts/injection.ts +0 -812
- celestialflow-3.2.5/src/celestialflow/web/static/ts/layout_editor.ts +0 -223
- celestialflow-3.2.5/src/celestialflow/web/static/ts/main.ts +0 -394
- celestialflow-3.2.5/src/celestialflow/web/static/ts/utils.ts +0 -205
- celestialflow-3.2.5/src/celestialflow/web/static/ts/web_config.ts +0 -584
- celestialflow-3.2.5/src/celestialflow/web/templates/index.html +0 -738
- celestialflow-3.2.5/src/celestialflow/web/util_cal.py +0 -9
- celestialflow-3.2.5/src/celestialflow/web/util_config.py +0 -38
- celestialflow-3.2.5/src/celestialflow/web/util_error.py +0 -30
- celestialflow-3.2.5/src/celestialflow/web/util_models.py +0 -95
- celestialflow-3.2.5/src/celestialflow.egg-info/SOURCES.txt +0 -103
- celestialflow-3.2.5/src/celestialflow.egg-info/entry_points.txt +0 -2
- celestialflow-3.2.5/src/celestialflow.egg-info/requires.txt +0 -5
- {celestialflow-3.2.5 → celestialflow-3.2.6}/setup.cfg +0 -0
- {celestialflow-3.2.5 → celestialflow-3.2.6}/src/celestialflow/funnel/core_spout.py +0 -0
- {celestialflow-3.2.5 → celestialflow-3.2.6}/src/celestialflow/funnel/util_count.py +0 -0
- {celestialflow-3.2.5 → celestialflow-3.2.6}/src/celestialflow/graph/util_serialize.py +0 -0
- {celestialflow-3.2.5 → celestialflow-3.2.6}/src/celestialflow/observability/__init__.py +0 -0
- {celestialflow-3.2.5 → celestialflow-3.2.6}/src/celestialflow/observability/core_observer.py +0 -0
- {celestialflow-3.2.5 → celestialflow-3.2.6}/src/celestialflow/observability/core_progress.py +0 -0
- {celestialflow-3.2.5 → celestialflow-3.2.6}/src/celestialflow/observability/util_types.py +0 -0
- {celestialflow-3.2.5 → celestialflow-3.2.6}/src/celestialflow/persistence/core_log.py +0 -0
- {celestialflow-3.2.5 → celestialflow-3.2.6}/src/celestialflow/persistence/util_payload.py +0 -0
- {celestialflow-3.2.5 → celestialflow-3.2.6}/src/celestialflow/runtime/core_dispatch.py +0 -0
- {celestialflow-3.2.5 → celestialflow-3.2.6}/src/celestialflow/runtime/core_envelope.py +0 -0
- {celestialflow-3.2.5 → celestialflow-3.2.6}/src/celestialflow/runtime/core_queue.py +0 -0
- {celestialflow-3.2.5 → celestialflow-3.2.6}/src/celestialflow/runtime/util_event.py +0 -0
- {celestialflow-3.2.5 → celestialflow-3.2.6}/src/celestialflow/runtime/util_hash.py +0 -0
- {celestialflow-3.2.5 → celestialflow-3.2.6}/src/celestialflow/runtime/util_types.py +0 -0
- {celestialflow-3.2.5 → celestialflow-3.2.6}/src/celestialflow/stage/core_stage.py +0 -0
- {celestialflow-3.2.5 → celestialflow-3.2.6}/src/celestialflow/stage/core_stages.py +0 -0
- {celestialflow-3.2.5 → celestialflow-3.2.6}/src/celestialflow/stage/util_callable.py +0 -0
- {celestialflow-3.2.5 → celestialflow-3.2.6}/src/celestialflow/stage/util_types.py +0 -0
- {celestialflow-3.2.5 → celestialflow-3.2.6}/src/celestialflow/utils/__init__.py +0 -0
- {celestialflow-3.2.5 → celestialflow-3.2.6}/src/celestialflow/utils/util_benchmark.py +0 -0
- {celestialflow-3.2.5 → celestialflow-3.2.6}/src/celestialflow/utils/util_clone.py +0 -0
- {celestialflow-3.2.5 → celestialflow-3.2.6}/src/celestialflow/utils/util_collections.py +0 -0
- {celestialflow-3.2.5 → celestialflow-3.2.6}/src/celestialflow/utils/util_format.py +0 -0
- {celestialflow-3.2.5 → celestialflow-3.2.6}/src/celestialflow.egg-info/dependency_links.txt +0 -0
- {celestialflow-3.2.5 → 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,15 +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
|
-
|
|
19
|
+
Dynamic: license-file
|
|
22
20
|
|
|
23
21
|
# CelestialFlow ——一个轻量级、可并行、基于图结构的 Python 任务调度框架
|
|
24
22
|
|
|
@@ -37,14 +35,13 @@ Requires-Dist: jinja2
|
|
|
37
35
|
<img src="https://img.shields.io/badge/Task%20Graph-DAG-blueviolet">
|
|
38
36
|
<img src="https://img.shields.io/badge/Workflow-Orchestrator-7c3aed">
|
|
39
37
|
<img src="https://img.shields.io/badge/Event%20Tracing-CelestialTree-0ea5e9">
|
|
40
|
-
<img src="https://img.shields.io/badge/Web-Dashboard-FastAPI-ec4899">
|
|
41
38
|
</p>
|
|
42
39
|
|
|
43
40
|
<p align="center">
|
|
44
|
-
<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>
|
|
45
42
|
</p>
|
|
46
43
|
|
|
47
|
-
**CelestialFlow** 是一个轻量级但功能完全的任务流框架,适合需要
|
|
44
|
+
**CelestialFlow** 是一个轻量级但功能完全的任务流框架,适合需要 **复杂依赖关系**、**灵活执行模型**、**跨设备运行** 与 **可观测执行链路** 的中/大型 Python 任务系统。
|
|
48
45
|
|
|
49
46
|
- 相比 Airflow/Dagster 更轻、更快开始
|
|
50
47
|
- 相比 multiprocessing/threading 更结构化,可直接表达 loop / complete graph 等复杂依赖模式
|
|
@@ -70,7 +67,7 @@ TaskGraph 能构建完整的 **有向图结构(Directed Graph)**,不仅支
|
|
|
70
67
|
|
|
71
68
|
在执行与调度之外,CelestialFlow 进一步引入 **CelestialTree(简称: ctree) 事件追踪系统**,为每一个任务及其衍生行为(成功、失败、重试、拆分、路由等)记录明确的因果关系。借助 ctree,可以从任意一个初始任务出发,完整还原其在 TaskGraph 中的传播路径与执行轨迹,使任务系统可以进行完整的**追溯、分析、解释**。
|
|
72
69
|
|
|
73
|
-
在此基础上,CelestialFlow
|
|
70
|
+
在此基础上,CelestialFlow 提供事件追踪、状态上报、持久化回放,并提供基于 Redis 的 demo 与 Go Worker 外部协作示例,用于展示按需构建跨进程、跨设备任务协作的方式。
|
|
74
71
|
|
|
75
72
|
## 项目结构(Project Structure)
|
|
76
73
|
|
|
@@ -100,24 +97,11 @@ flowchart LR
|
|
|
100
97
|
%% 美化 TaskStages
|
|
101
98
|
class S1,S2,S3,S4 blueNode;
|
|
102
99
|
|
|
103
|
-
%% ===== WebUI =====
|
|
104
|
-
subgraph W[WebUI]
|
|
105
|
-
JS
|
|
106
|
-
HTML
|
|
107
|
-
end
|
|
108
|
-
|
|
109
|
-
style W fill:#ffeaf0,stroke:#d66b8c,stroke-width:2px,rx:10px,ry:10px
|
|
110
|
-
style JS fill:#ffffff,stroke:#d66b8c,rx:5px,ry:5px
|
|
111
|
-
style HTML fill:#ffffff,stroke:#d66b8c,rx:5px,ry:5px
|
|
112
|
-
|
|
113
|
-
R[TaskWeb]
|
|
114
|
-
style R fill:#f0e9ff,stroke:#8a6bc9,stroke-width:2px,rx:8px,ry:8px
|
|
115
|
-
|
|
116
100
|
%% ===== Links =====
|
|
117
|
-
TG -->
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
101
|
+
TG --> CFB[CelestialFlow Web]
|
|
102
|
+
CFB --> TG
|
|
103
|
+
|
|
104
|
+
style CFB fill:#ffeaf0,stroke:#d66b8c,stroke-width:2px,rx:10px,ry:10px
|
|
121
105
|
|
|
122
106
|
```
|
|
123
107
|
|
|
@@ -133,7 +117,7 @@ uv pip install celestialflow
|
|
|
133
117
|
pip install celestialflow
|
|
134
118
|
```
|
|
135
119
|
|
|
136
|
-
如果你只使用 CelestialFlow
|
|
120
|
+
如果你只使用 CelestialFlow 的核心调度、可观测性与持久化能力,上面的安装已经足够。
|
|
137
121
|
|
|
138
122
|
如果你还需要启用 CelestialTree 事件追踪能力,则需要**额外安装** `celestialtree`:
|
|
139
123
|
|
|
@@ -162,7 +146,7 @@ if __name__ == "__main__":
|
|
|
162
146
|
stage2 = TaskStage(name="Squarer", func=square, stage_mode="thread", execution_mode="thread")
|
|
163
147
|
|
|
164
148
|
# 构建任务图结构
|
|
165
|
-
graph = TaskGraph()
|
|
149
|
+
graph = TaskGraph(name="DemoGraph")
|
|
166
150
|
graph.set_stages(stages=[stage1, stage2])
|
|
167
151
|
graph.connect([stage1], [stage2])
|
|
168
152
|
|
|
@@ -178,17 +162,16 @@ if __name__ == "__main__":
|
|
|
178
162
|
|
|
179
163
|
若你想了解框架的整体结构与核心组件,下面的参考文档会对你有帮助:
|
|
180
164
|
|
|
181
|
-
- [
|
|
182
|
-
- [
|
|
183
|
-
- [
|
|
184
|
-
- [
|
|
185
|
-
- [
|
|
186
|
-
- [
|
|
187
|
-
- [
|
|
188
|
-
- [
|
|
189
|
-
- [
|
|
190
|
-
- [
|
|
191
|
-
- [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)
|
|
192
175
|
|
|
193
176
|
推荐阅读顺序:
|
|
194
177
|
|
|
@@ -198,7 +181,6 @@ flowchart TD
|
|
|
198
181
|
classDef runtime fill:#e9f8ef,stroke:#22c55e,color:#14532d;
|
|
199
182
|
classDef structure fill:#fff6e6,stroke:#f59e0b,color:#78350f;
|
|
200
183
|
classDef execution fill:#f3e8ff,stroke:#a855f7,color:#581c87;
|
|
201
|
-
classDef web fill:#ffeaea,stroke:#ef4444,color:#7f1d1d;
|
|
202
184
|
|
|
203
185
|
TM[TaskExecutor.md] --> TS[TaskStage.md] --> TG[TaskGraph.md]
|
|
204
186
|
TM --> TP[TaskProgress.md]
|
|
@@ -209,23 +191,22 @@ flowchart TD
|
|
|
209
191
|
TG --> TR[TaskReport.md]
|
|
210
192
|
TG --> TSR[TaskStructure.md]
|
|
211
193
|
|
|
212
|
-
TR --> TW[TaskWeb.md]
|
|
213
194
|
TN --> GW[Go Worker.md]
|
|
214
195
|
|
|
215
196
|
class TM,TS,TG core;
|
|
216
197
|
class TP,TME runtime;
|
|
217
198
|
class TSR structure;
|
|
218
199
|
class TQ,TN,GW execution;
|
|
219
|
-
class TR
|
|
200
|
+
class TR execution;
|
|
220
201
|
```
|
|
221
202
|
|
|
222
|
-
|
|
203
|
+
以下五篇可以作为补充阅读:
|
|
223
204
|
|
|
224
|
-
- [
|
|
225
|
-
- [
|
|
226
|
-
- [
|
|
227
|
-
- [
|
|
228
|
-
- [
|
|
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)
|
|
229
210
|
|
|
230
211
|
如果你更喜欢通过完整案例理解框架的运行方式,可以参考这篇利用 TaskGraph 从零开始构建项目的教程:
|
|
231
212
|
|
|
@@ -255,43 +236,37 @@ flowchart TD
|
|
|
255
236
|
| 依赖包 | 说明 |
|
|
256
237
|
| ----------------- | ---- |
|
|
257
238
|
| **Python ≥ 3.12** | 运行环境,建议使用 3.12 及以上版本 |
|
|
258
|
-
| **fastapi** | Web 服务接口框架(用于任务可视化与远程控制) |
|
|
259
|
-
| **uvicorn** | FastAPI 的高性能 ASGI 服务器 |
|
|
260
239
|
| **requests** | HTTP 客户端库,用于任务状态上报与远程调用 |
|
|
261
|
-
| **jinja2** | FastAPI 模板引擎,用于 Web 可视化界面渲染 |
|
|
262
240
|
| **tqdm** | 可选组件,进度条显示,用于任务执行可视化 |
|
|
263
241
|
|
|
264
|
-
如需运行 `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`。
|
|
265
245
|
|
|
266
|
-
|
|
246
|
+
- 如需使用可视化的Web服务, 请额外安装 `celestialflow-web` 并运行 `celestialflow-web --host 0.0.0.0 --port 5000`。
|
|
267
247
|
|
|
268
248
|
## 文件结构(File Structure)
|
|
269
249
|
|
|
270
250
|
<p align="center">
|
|
271
251
|
<img src="https://raw.githubusercontent.com/Mr-xiaotian/CelestialFlow/main/img/file_structure.svg" alt="FileStructure" />
|
|
272
252
|
<br/>
|
|
273
|
-
<em>celestial-flow 3.2.
|
|
253
|
+
<em>celestial-flow 3.2.6</em>
|
|
274
254
|
</p>
|
|
275
255
|
|
|
276
256
|
(该视图由我的另一个项目[CelestialVault](https://github.com/Mr-xiaotian/CelestialVault)中inst_file.FileTree.print_tree()生成。转换为图片则借助[Carbon](https://carbon.now.sh)。)
|
|
277
257
|
|
|
278
258
|
## 版本日志(Version Log)
|
|
279
|
-
- 3.2.
|
|
259
|
+
- 3.2.6
|
|
280
260
|
- feat:
|
|
281
|
-
- 在 `
|
|
282
|
-
-
|
|
283
|
-
- 在web端错误日志页面对当前显示的错误数量可能与node_status中的error数量不一致的情况进行说明
|
|
284
|
-
- 在web端仪表盘页面添加错误分类的饼图
|
|
261
|
+
- 在 `graph` 与 `stage` 中添加直接读取db文件并重试/继续任务的方法
|
|
262
|
+
- 分别为 `start_graph_db` 与 `start_db`
|
|
285
263
|
- refactor:
|
|
286
|
-
-
|
|
287
|
-
|
|
288
|
-
-
|
|
289
|
-
- 分离server端的 `push_task` 和 `push_termination`
|
|
290
|
-
- fix:
|
|
291
|
-
- 修复 `UnconsumedError` 在 `drain_task_queue` 中被计算两次的问题
|
|
264
|
+
- **[IMPORTANT]** 将web部分移至单独项目 [celestialflow-web](https://github.com/Mr-xiaotian/celestialflow-web)
|
|
265
|
+
- 考虑许久的决定, 当前的web端代码与项目整体风格差异极大, 已经不再适合继续合并一处
|
|
266
|
+
- 当然这意味着 `celestialflow-web` 命令在当前项目下失效, 需要单独安装 `pip install celestialflow-web`
|
|
292
267
|
- chore:
|
|
293
|
-
-
|
|
294
|
-
-
|
|
268
|
+
- 全量更新文档, 并翻译为en/ja双语言
|
|
269
|
+
- 移除 docs/zh-CN 下的 `README.md`, 现在中文readme只保留根目录下的这一份
|
|
295
270
|
|
|
296
271
|
更多过往日志可看:
|
|
297
272
|
|
|
@@ -15,14 +15,13 @@
|
|
|
15
15
|
<img src="https://img.shields.io/badge/Task%20Graph-DAG-blueviolet">
|
|
16
16
|
<img src="https://img.shields.io/badge/Workflow-Orchestrator-7c3aed">
|
|
17
17
|
<img src="https://img.shields.io/badge/Event%20Tracing-CelestialTree-0ea5e9">
|
|
18
|
-
<img src="https://img.shields.io/badge/Web-Dashboard-FastAPI-ec4899">
|
|
19
18
|
</p>
|
|
20
19
|
|
|
21
20
|
<p align="center">
|
|
22
|
-
<a href="https://github.com/Mr-xiaotian/CelestialFlow/blob/main/
|
|
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>
|
|
23
22
|
</p>
|
|
24
23
|
|
|
25
|
-
**CelestialFlow** 是一个轻量级但功能完全的任务流框架,适合需要
|
|
24
|
+
**CelestialFlow** 是一个轻量级但功能完全的任务流框架,适合需要 **复杂依赖关系**、**灵活执行模型**、**跨设备运行** 与 **可观测执行链路** 的中/大型 Python 任务系统。
|
|
26
25
|
|
|
27
26
|
- 相比 Airflow/Dagster 更轻、更快开始
|
|
28
27
|
- 相比 multiprocessing/threading 更结构化,可直接表达 loop / complete graph 等复杂依赖模式
|
|
@@ -48,7 +47,7 @@ TaskGraph 能构建完整的 **有向图结构(Directed Graph)**,不仅支
|
|
|
48
47
|
|
|
49
48
|
在执行与调度之外,CelestialFlow 进一步引入 **CelestialTree(简称: ctree) 事件追踪系统**,为每一个任务及其衍生行为(成功、失败、重试、拆分、路由等)记录明确的因果关系。借助 ctree,可以从任意一个初始任务出发,完整还原其在 TaskGraph 中的传播路径与执行轨迹,使任务系统可以进行完整的**追溯、分析、解释**。
|
|
50
49
|
|
|
51
|
-
在此基础上,CelestialFlow
|
|
50
|
+
在此基础上,CelestialFlow 提供事件追踪、状态上报、持久化回放,并提供基于 Redis 的 demo 与 Go Worker 外部协作示例,用于展示按需构建跨进程、跨设备任务协作的方式。
|
|
52
51
|
|
|
53
52
|
## 项目结构(Project Structure)
|
|
54
53
|
|
|
@@ -78,24 +77,11 @@ flowchart LR
|
|
|
78
77
|
%% 美化 TaskStages
|
|
79
78
|
class S1,S2,S3,S4 blueNode;
|
|
80
79
|
|
|
81
|
-
%% ===== WebUI =====
|
|
82
|
-
subgraph W[WebUI]
|
|
83
|
-
JS
|
|
84
|
-
HTML
|
|
85
|
-
end
|
|
86
|
-
|
|
87
|
-
style W fill:#ffeaf0,stroke:#d66b8c,stroke-width:2px,rx:10px,ry:10px
|
|
88
|
-
style JS fill:#ffffff,stroke:#d66b8c,rx:5px,ry:5px
|
|
89
|
-
style HTML fill:#ffffff,stroke:#d66b8c,rx:5px,ry:5px
|
|
90
|
-
|
|
91
|
-
R[TaskWeb]
|
|
92
|
-
style R fill:#f0e9ff,stroke:#8a6bc9,stroke-width:2px,rx:8px,ry:8px
|
|
93
|
-
|
|
94
80
|
%% ===== Links =====
|
|
95
|
-
TG -->
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
81
|
+
TG --> CFB[CelestialFlow Web]
|
|
82
|
+
CFB --> TG
|
|
83
|
+
|
|
84
|
+
style CFB fill:#ffeaf0,stroke:#d66b8c,stroke-width:2px,rx:10px,ry:10px
|
|
99
85
|
|
|
100
86
|
```
|
|
101
87
|
|
|
@@ -111,7 +97,7 @@ uv pip install celestialflow
|
|
|
111
97
|
pip install celestialflow
|
|
112
98
|
```
|
|
113
99
|
|
|
114
|
-
如果你只使用 CelestialFlow
|
|
100
|
+
如果你只使用 CelestialFlow 的核心调度、可观测性与持久化能力,上面的安装已经足够。
|
|
115
101
|
|
|
116
102
|
如果你还需要启用 CelestialTree 事件追踪能力,则需要**额外安装** `celestialtree`:
|
|
117
103
|
|
|
@@ -140,7 +126,7 @@ if __name__ == "__main__":
|
|
|
140
126
|
stage2 = TaskStage(name="Squarer", func=square, stage_mode="thread", execution_mode="thread")
|
|
141
127
|
|
|
142
128
|
# 构建任务图结构
|
|
143
|
-
graph = TaskGraph()
|
|
129
|
+
graph = TaskGraph(name="DemoGraph")
|
|
144
130
|
graph.set_stages(stages=[stage1, stage2])
|
|
145
131
|
graph.connect([stage1], [stage2])
|
|
146
132
|
|
|
@@ -156,17 +142,16 @@ if __name__ == "__main__":
|
|
|
156
142
|
|
|
157
143
|
若你想了解框架的整体结构与核心组件,下面的参考文档会对你有帮助:
|
|
158
144
|
|
|
159
|
-
- [
|
|
160
|
-
- [
|
|
161
|
-
- [
|
|
162
|
-
- [
|
|
163
|
-
- [
|
|
164
|
-
- [
|
|
165
|
-
- [
|
|
166
|
-
- [
|
|
167
|
-
- [
|
|
168
|
-
- [
|
|
169
|
-
- [other/go_worker.md](https://github.com/Mr-xiaotian/CelestialFlow/blob/main/docs/zh-CN/other/go_worker.md)
|
|
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)
|
|
170
155
|
|
|
171
156
|
推荐阅读顺序:
|
|
172
157
|
|
|
@@ -176,7 +161,6 @@ flowchart TD
|
|
|
176
161
|
classDef runtime fill:#e9f8ef,stroke:#22c55e,color:#14532d;
|
|
177
162
|
classDef structure fill:#fff6e6,stroke:#f59e0b,color:#78350f;
|
|
178
163
|
classDef execution fill:#f3e8ff,stroke:#a855f7,color:#581c87;
|
|
179
|
-
classDef web fill:#ffeaea,stroke:#ef4444,color:#7f1d1d;
|
|
180
164
|
|
|
181
165
|
TM[TaskExecutor.md] --> TS[TaskStage.md] --> TG[TaskGraph.md]
|
|
182
166
|
TM --> TP[TaskProgress.md]
|
|
@@ -187,23 +171,22 @@ flowchart TD
|
|
|
187
171
|
TG --> TR[TaskReport.md]
|
|
188
172
|
TG --> TSR[TaskStructure.md]
|
|
189
173
|
|
|
190
|
-
TR --> TW[TaskWeb.md]
|
|
191
174
|
TN --> GW[Go Worker.md]
|
|
192
175
|
|
|
193
176
|
class TM,TS,TG core;
|
|
194
177
|
class TP,TME runtime;
|
|
195
178
|
class TSR structure;
|
|
196
179
|
class TQ,TN,GW execution;
|
|
197
|
-
class TR
|
|
180
|
+
class TR execution;
|
|
198
181
|
```
|
|
199
182
|
|
|
200
|
-
|
|
183
|
+
以下五篇可以作为补充阅读:
|
|
201
184
|
|
|
202
|
-
- [
|
|
203
|
-
- [
|
|
204
|
-
- [
|
|
205
|
-
- [
|
|
206
|
-
- [
|
|
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)
|
|
207
190
|
|
|
208
191
|
如果你更喜欢通过完整案例理解框架的运行方式,可以参考这篇利用 TaskGraph 从零开始构建项目的教程:
|
|
209
192
|
|
|
@@ -233,43 +216,37 @@ flowchart TD
|
|
|
233
216
|
| 依赖包 | 说明 |
|
|
234
217
|
| ----------------- | ---- |
|
|
235
218
|
| **Python ≥ 3.12** | 运行环境,建议使用 3.12 及以上版本 |
|
|
236
|
-
| **fastapi** | Web 服务接口框架(用于任务可视化与远程控制) |
|
|
237
|
-
| **uvicorn** | FastAPI 的高性能 ASGI 服务器 |
|
|
238
219
|
| **requests** | HTTP 客户端库,用于任务状态上报与远程调用 |
|
|
239
|
-
| **jinja2** | FastAPI 模板引擎,用于 Web 可视化界面渲染 |
|
|
240
220
|
| **tqdm** | 可选组件,进度条显示,用于任务执行可视化 |
|
|
241
221
|
|
|
242
|
-
如需运行 `demo/demo_redis.py` 或 Go Worker 示例,请额外安装 `redis` 并准备 Redis 服务;这部分不属于默认运行时依赖。
|
|
222
|
+
- 如需运行 `demo/demo_redis.py` 或 Go Worker 示例,请额外安装 `redis` 并准备 Redis 服务;这部分不属于默认运行时依赖。
|
|
223
|
+
|
|
224
|
+
- 如需运行依赖 CelestialTree 的 demo / bench / 追踪查询,请额外安装 `celestialtree`,或直接在源码仓库中执行 `uv sync --group dev`。
|
|
243
225
|
|
|
244
|
-
|
|
226
|
+
- 如需使用可视化的Web服务, 请额外安装 `celestialflow-web` 并运行 `celestialflow-web --host 0.0.0.0 --port 5000`。
|
|
245
227
|
|
|
246
228
|
## 文件结构(File Structure)
|
|
247
229
|
|
|
248
230
|
<p align="center">
|
|
249
231
|
<img src="https://raw.githubusercontent.com/Mr-xiaotian/CelestialFlow/main/img/file_structure.svg" alt="FileStructure" />
|
|
250
232
|
<br/>
|
|
251
|
-
<em>celestial-flow 3.2.
|
|
233
|
+
<em>celestial-flow 3.2.6</em>
|
|
252
234
|
</p>
|
|
253
235
|
|
|
254
236
|
(该视图由我的另一个项目[CelestialVault](https://github.com/Mr-xiaotian/CelestialVault)中inst_file.FileTree.print_tree()生成。转换为图片则借助[Carbon](https://carbon.now.sh)。)
|
|
255
237
|
|
|
256
238
|
## 版本日志(Version Log)
|
|
257
|
-
- 3.2.
|
|
239
|
+
- 3.2.6
|
|
258
240
|
- feat:
|
|
259
|
-
- 在 `
|
|
260
|
-
-
|
|
261
|
-
- 在web端错误日志页面对当前显示的错误数量可能与node_status中的error数量不一致的情况进行说明
|
|
262
|
-
- 在web端仪表盘页面添加错误分类的饼图
|
|
241
|
+
- 在 `graph` 与 `stage` 中添加直接读取db文件并重试/继续任务的方法
|
|
242
|
+
- 分别为 `start_graph_db` 与 `start_db`
|
|
263
243
|
- refactor:
|
|
264
|
-
-
|
|
265
|
-
|
|
266
|
-
-
|
|
267
|
-
- 分离server端的 `push_task` 和 `push_termination`
|
|
268
|
-
- fix:
|
|
269
|
-
- 修复 `UnconsumedError` 在 `drain_task_queue` 中被计算两次的问题
|
|
244
|
+
- **[IMPORTANT]** 将web部分移至单独项目 [celestialflow-web](https://github.com/Mr-xiaotian/celestialflow-web)
|
|
245
|
+
- 考虑许久的决定, 当前的web端代码与项目整体风格差异极大, 已经不再适合继续合并一处
|
|
246
|
+
- 当然这意味着 `celestialflow-web` 命令在当前项目下失效, 需要单独安装 `pip install celestialflow-web`
|
|
270
247
|
- chore:
|
|
271
|
-
-
|
|
272
|
-
-
|
|
248
|
+
- 全量更新文档, 并翻译为en/ja双语言
|
|
249
|
+
- 移除 docs/zh-CN 下的 `README.md`, 现在中文readme只保留根目录下的这一份
|
|
273
250
|
|
|
274
251
|
更多过往日志可看:
|
|
275
252
|
|
|
@@ -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,17 +14,13 @@ requires-python = ">=3.12"
|
|
|
14
14
|
|
|
15
15
|
dependencies = [
|
|
16
16
|
"tqdm",
|
|
17
|
-
"fastapi",
|
|
18
|
-
"uvicorn",
|
|
19
17
|
"requests",
|
|
20
|
-
"jinja2",
|
|
21
18
|
]
|
|
22
19
|
|
|
23
20
|
classifiers = [
|
|
24
21
|
"Programming Language :: Python :: 3",
|
|
25
22
|
"License :: OSI Approved :: MIT License",
|
|
26
23
|
"Operating System :: OS Independent",
|
|
27
|
-
"Framework :: FastAPI",
|
|
28
24
|
"Topic :: Software Development :: Libraries",
|
|
29
25
|
]
|
|
30
26
|
|
|
@@ -32,19 +28,6 @@ classifiers = [
|
|
|
32
28
|
"Homepage" = "https://github.com/Mr-xiaotian/CelestialFlow"
|
|
33
29
|
"Bug Tracker" = "https://github.com/Mr-xiaotian/CelestialFlow/issues"
|
|
34
30
|
|
|
35
|
-
[project.scripts]
|
|
36
|
-
celestialflow-web = "celestialflow.web.core_server:main_entry"
|
|
37
|
-
|
|
38
|
-
[tool.setuptools]
|
|
39
|
-
license-files = []
|
|
40
|
-
|
|
41
|
-
[tool.setuptools.package-data]
|
|
42
|
-
celestialflow = [
|
|
43
|
-
"web/templates/**/*.html",
|
|
44
|
-
"web/static/**/*",
|
|
45
|
-
"web/config.json"
|
|
46
|
-
]
|
|
47
|
-
|
|
48
31
|
[tool.pytest.ini_options]
|
|
49
32
|
addopts = "-s"
|
|
50
33
|
log_cli = true
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# __init__.py
|
|
2
2
|
"""CelestialFlow — 基于图结构的轻量级异步任务编排框架。
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
提供任务图构建、执行调度、实时监控与持久化等核心能力。
|
|
5
5
|
"""
|
|
6
6
|
|
|
7
7
|
from .funnel import BaseInlet, BaseSpout
|
|
@@ -17,7 +17,6 @@ from .graph import (
|
|
|
17
17
|
from .observability import BaseObserver, TaskProgress
|
|
18
18
|
from .persistence.util_sqlite import (
|
|
19
19
|
load_records,
|
|
20
|
-
load_records_grouped_by_stage,
|
|
21
20
|
load_tasks_grouped_by_stage,
|
|
22
21
|
)
|
|
23
22
|
from .runtime.util_hash import make_hashable
|
|
@@ -30,7 +29,6 @@ from .stage import (
|
|
|
30
29
|
)
|
|
31
30
|
from .utils.util_benchmark import benchmark_executor, benchmark_graph
|
|
32
31
|
from .utils.util_format import format_table
|
|
33
|
-
from .web import TaskWebServer
|
|
34
32
|
|
|
35
33
|
__all__ = [
|
|
36
34
|
"BaseInlet",
|
|
@@ -47,14 +45,12 @@ __all__ = [
|
|
|
47
45
|
"TaskRouter",
|
|
48
46
|
"TaskSplitter",
|
|
49
47
|
"TaskStage",
|
|
50
|
-
"TaskWebServer",
|
|
51
48
|
"TaskWheel",
|
|
52
49
|
"TerminationSignal",
|
|
53
50
|
"benchmark_executor",
|
|
54
51
|
"benchmark_graph",
|
|
55
52
|
"format_table",
|
|
56
53
|
"load_records",
|
|
57
|
-
"load_records_grouped_by_stage",
|
|
58
54
|
"load_tasks_grouped_by_stage",
|
|
59
55
|
"make_hashable",
|
|
60
56
|
]
|
|
@@ -36,7 +36,7 @@ class BaseInlet:
|
|
|
36
36
|
:param record: 待发送的记录
|
|
37
37
|
:return: ``None``
|
|
38
38
|
"""
|
|
39
|
-
if not hasattr(self,
|
|
39
|
+
if not hasattr(self, "_queue") or not hasattr(self, "_counter"):
|
|
40
40
|
raise InitializationError("inlet is not bound to spout")
|
|
41
41
|
|
|
42
42
|
# 先增加待处理数量,再入队;若入队失败则立即回滚计数。
|
|
@@ -346,8 +346,7 @@ class TaskGraph:
|
|
|
346
346
|
"some nodes (including source nodes) to shut down as soon as their current "
|
|
347
347
|
"tasks are exhausted, preventing them from consuming tasks that arrive "
|
|
348
348
|
"later from other nodes. It is recommended to set put_termination_signal=False "
|
|
349
|
-
"and manually inject termination signals
|
|
350
|
-
"appropriate time."
|
|
349
|
+
"and manually inject termination signals at an appropriate time."
|
|
351
350
|
),
|
|
352
351
|
RuntimeWarning,
|
|
353
352
|
stacklevel=2,
|
|
@@ -375,17 +374,37 @@ class TaskGraph:
|
|
|
375
374
|
def start_graph_db(
|
|
376
375
|
self,
|
|
377
376
|
db_path: str | Path,
|
|
378
|
-
|
|
377
|
+
statuses: Iterable[str] | None = None,
|
|
378
|
+
*,
|
|
379
|
+
filter_by_error_type: bool = False,
|
|
379
380
|
put_termination_signal: bool = True,
|
|
380
381
|
) -> None:
|
|
381
382
|
"""
|
|
382
|
-
从 sqlite
|
|
383
|
+
从 sqlite 持久化库中读取任务,按 stage 分组后启动任务图。
|
|
383
384
|
|
|
384
385
|
:param db_path: sqlite 数据库文件路径
|
|
385
|
-
:param
|
|
386
|
+
:param statuses: 记录状态过滤列表,默认 ``["failed", "pending"]``
|
|
387
|
+
:param filter_by_error_type: 是否按各 stage 的 ``retry_exceptions`` 过滤
|
|
388
|
+
``error_type``,默认 ``False``
|
|
386
389
|
:param put_termination_signal: 是否注入终止信号,默认 True
|
|
387
390
|
"""
|
|
388
|
-
|
|
391
|
+
statuses = ["failed", "pending"] if statuses is None else statuses
|
|
392
|
+
grouped_records = load_tasks_grouped_by_stage(db_path, statuses)
|
|
393
|
+
grouped_tasks: dict[str, list[Any]] = {}
|
|
394
|
+
|
|
395
|
+
for name, records in grouped_records.items():
|
|
396
|
+
if filter_by_error_type and name in self.stage_dict:
|
|
397
|
+
stage = self.stage_dict[name]
|
|
398
|
+
retry_error_type_names = stage.metrics.get_retry_error_type_names()
|
|
399
|
+
records = [
|
|
400
|
+
record
|
|
401
|
+
for record in records
|
|
402
|
+
if str(record["error_type"]) in retry_error_type_names
|
|
403
|
+
]
|
|
404
|
+
|
|
405
|
+
stage_tasks = [record["task_json"] for record in records]
|
|
406
|
+
if stage_tasks:
|
|
407
|
+
grouped_tasks[name] = stage_tasks
|
|
389
408
|
|
|
390
409
|
self.start_graph(
|
|
391
410
|
grouped_tasks,
|