celestialflow 3.2.8__tar.gz → 3.3.0__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.
Files changed (60) hide show
  1. {celestialflow-3.2.8/src/celestialflow.egg-info → celestialflow-3.3.0}/PKG-INFO +112 -125
  2. {celestialflow-3.2.8 → celestialflow-3.3.0}/README.md +111 -124
  3. {celestialflow-3.2.8 → celestialflow-3.3.0}/pyproject.toml +1 -1
  4. {celestialflow-3.2.8 → celestialflow-3.3.0}/src/celestialflow/__init__.py +5 -7
  5. celestialflow-3.3.0/src/celestialflow/benchmark/util_benchmark.py +129 -0
  6. {celestialflow-3.2.8 → celestialflow-3.3.0}/src/celestialflow/benchmark/util_clone.py +27 -45
  7. celestialflow-3.3.0/src/celestialflow/graph/core_graph.py +659 -0
  8. celestialflow-3.3.0/src/celestialflow/graph/core_structure.py +205 -0
  9. {celestialflow-3.2.8 → celestialflow-3.3.0}/src/celestialflow/graph/util_estimators.py +1 -1
  10. celestialflow-3.2.8/src/celestialflow/graph/util_graph.py → celestialflow-3.3.0/src/celestialflow/graph/util_order_graph.py +58 -75
  11. celestialflow-3.3.0/src/celestialflow/graph/util_render.py +105 -0
  12. celestialflow-3.3.0/src/celestialflow/node/__init__.py +18 -0
  13. {celestialflow-3.2.8/src/celestialflow/stage → celestialflow-3.3.0/src/celestialflow/node}/core_dispatch.py +40 -41
  14. celestialflow-3.2.8/src/celestialflow/stage/core_executor.py → celestialflow-3.3.0/src/celestialflow/node/core_node.py +662 -692
  15. celestialflow-3.2.8/src/celestialflow/stage/core_stages.py → celestialflow-3.3.0/src/celestialflow/node/core_nodes.py +332 -295
  16. {celestialflow-3.2.8/src/celestialflow/stage → celestialflow-3.3.0/src/celestialflow/node}/util_callable.py +1 -1
  17. celestialflow-3.3.0/src/celestialflow/node/util_types.py +6 -0
  18. {celestialflow-3.2.8 → celestialflow-3.3.0}/src/celestialflow/observability/core_report.py +59 -45
  19. {celestialflow-3.2.8 → celestialflow-3.3.0}/src/celestialflow/observability/util_types.py +10 -8
  20. celestialflow-3.3.0/src/celestialflow/persistence/__init__.py +31 -0
  21. celestialflow-3.2.8/src/celestialflow/persistence/core_fallback.py → celestialflow-3.3.0/src/celestialflow/persistence/core_lifecycle.py +28 -56
  22. {celestialflow-3.2.8 → celestialflow-3.3.0}/src/celestialflow/persistence/core_log.py +78 -144
  23. {celestialflow-3.2.8 → celestialflow-3.3.0}/src/celestialflow/persistence/core_scope.py +41 -41
  24. {celestialflow-3.2.8 → celestialflow-3.3.0}/src/celestialflow/persistence/util_payload.py +1 -1
  25. {celestialflow-3.2.8 → celestialflow-3.3.0}/src/celestialflow/persistence/util_sqlite.py +0 -30
  26. {celestialflow-3.2.8 → celestialflow-3.3.0}/src/celestialflow/runtime/core_metrics.py +1 -1
  27. {celestialflow-3.2.8 → celestialflow-3.3.0}/src/celestialflow/runtime/util_constant.py +1 -5
  28. {celestialflow-3.2.8 → celestialflow-3.3.0}/src/celestialflow/runtime/util_errors.py +192 -207
  29. {celestialflow-3.2.8 → celestialflow-3.3.0}/src/celestialflow/runtime/util_event.py +0 -1
  30. {celestialflow-3.2.8 → celestialflow-3.3.0}/src/celestialflow/runtime/util_format.py +0 -28
  31. {celestialflow-3.2.8 → celestialflow-3.3.0/src/celestialflow.egg-info}/PKG-INFO +112 -125
  32. {celestialflow-3.2.8 → celestialflow-3.3.0}/src/celestialflow.egg-info/SOURCES.txt +10 -11
  33. celestialflow-3.2.8/src/celestialflow/benchmark/util_benchmark.py +0 -142
  34. celestialflow-3.2.8/src/celestialflow/graph/core_graph.py +0 -701
  35. celestialflow-3.2.8/src/celestialflow/graph/core_structure.py +0 -228
  36. celestialflow-3.2.8/src/celestialflow/graph/util_serialize.py +0 -150
  37. celestialflow-3.2.8/src/celestialflow/persistence/__init__.py +0 -31
  38. celestialflow-3.2.8/src/celestialflow/stage/__init__.py +0 -20
  39. celestialflow-3.2.8/src/celestialflow/stage/core_stage.py +0 -172
  40. celestialflow-3.2.8/src/celestialflow/stage/util_types.py +0 -6
  41. {celestialflow-3.2.8 → celestialflow-3.3.0}/LICENSE +0 -0
  42. {celestialflow-3.2.8 → celestialflow-3.3.0}/setup.cfg +0 -0
  43. {celestialflow-3.2.8 → celestialflow-3.3.0}/src/celestialflow/benchmark/__init__.py +0 -0
  44. {celestialflow-3.2.8 → celestialflow-3.3.0}/src/celestialflow/funnel/__init__.py +0 -0
  45. {celestialflow-3.2.8 → celestialflow-3.3.0}/src/celestialflow/funnel/core_inlet.py +0 -0
  46. {celestialflow-3.2.8 → celestialflow-3.3.0}/src/celestialflow/funnel/core_spout.py +0 -0
  47. {celestialflow-3.2.8 → celestialflow-3.3.0}/src/celestialflow/funnel/util_count.py +0 -0
  48. {celestialflow-3.2.8 → celestialflow-3.3.0}/src/celestialflow/graph/__init__.py +0 -0
  49. {celestialflow-3.2.8 → celestialflow-3.3.0}/src/celestialflow/observability/__init__.py +0 -0
  50. {celestialflow-3.2.8 → celestialflow-3.3.0}/src/celestialflow/observability/core_observer.py +0 -0
  51. {celestialflow-3.2.8 → celestialflow-3.3.0}/src/celestialflow/runtime/__init__.py +0 -0
  52. {celestialflow-3.2.8 → celestialflow-3.3.0}/src/celestialflow/runtime/core_envelope.py +0 -0
  53. {celestialflow-3.2.8 → celestialflow-3.3.0}/src/celestialflow/runtime/core_queue.py +0 -0
  54. {celestialflow-3.2.8 → celestialflow-3.3.0}/src/celestialflow/runtime/util_config.py +0 -0
  55. {celestialflow-3.2.8 → celestialflow-3.3.0}/src/celestialflow/runtime/util_estimators.py +0 -0
  56. {celestialflow-3.2.8 → celestialflow-3.3.0}/src/celestialflow/runtime/util_hash.py +0 -0
  57. {celestialflow-3.2.8 → celestialflow-3.3.0}/src/celestialflow/runtime/util_types.py +0 -0
  58. {celestialflow-3.2.8 → celestialflow-3.3.0}/src/celestialflow.egg-info/dependency_links.txt +0 -0
  59. {celestialflow-3.2.8 → celestialflow-3.3.0}/src/celestialflow.egg-info/requires.txt +0 -0
  60. {celestialflow-3.2.8 → celestialflow-3.3.0}/src/celestialflow.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: celestialflow
3
- Version: 3.2.8
3
+ Version: 3.3.0
4
4
  Summary: A flexible GRAPH-based task orchestration framework.
5
5
  Author-email: Mr-xiaotian <mingxiaomingtian@gmail.com>
6
6
  License: MIT
@@ -45,28 +45,35 @@ Dynamic: license-file
45
45
  - 相比 Airflow/Dagster 更轻、更快开始
46
46
  - 相比 multiprocessing/threading 更结构化,可直接表达 loop / complete graph 等复杂依赖模式
47
47
 
48
- 框架的基本单元为 **TaskExecutor**,可独立运行,并支持三种执行模式:
48
+ 框架的基本单元为 **任务节点**(统一继承自内部基类 `BaseTaskNode`),目前对外暴露三种具体节点实现,可独立运行,也可互相连接成图:
49
+
50
+ * **TaskExecutor** — 通用任务执行器
51
+ * **TaskSplitter** — 将一个输入拆分为多个子任务
52
+ * **TaskRouter** — 根据条件将任务路由到不同下游
53
+
54
+ 三种节点都支持以下执行模式:
49
55
 
50
56
  * **线性(serial)**
51
57
  * **多线程(thread)**
52
58
  * **协程(async)**
53
59
 
54
- TaskExecutor 实现了对任务的结果缓存,任务去重,进度条显示,多执行模式比较等功能,单独使用也很好用。
60
+ `TaskExecutor` 实现了对任务的结果缓存、任务去重、进度条显示、多执行模式比较等功能,单独使用也很好用。
55
61
 
56
- 但除去直接使用 TaskExecutor,更重要的是使用其子类**TaskStage**。TaskStage 可以互相连接,形成具有上游与下游依赖关系的任务图(**TaskGraph**)。下游 stage 会自动接收上游执行完成的结果作为输入,从而形成明确的数据流。
62
+ 节点之间通过 **TaskGraph** 互相连接,形成具有上游与下游依赖关系的任务图。下游节点会自动接收上游执行完成的结果作为输入,从而形成明确的数据流。TaskGraph 同时提供 `TaskChain` / `TaskCross` / `TaskGrid` / `TaskLoop` / `TaskWheel` / `TaskComplete` 等预置拓扑结构,方便快速搭建常见依赖模式。
57
63
 
58
- TaskStage 的任务执行模式同样包含三种,与TaskExecutor中一致。
64
+ 在图级别上,通过 `graph_mode` 统一控制图中所有节点的运行方式:
59
65
 
60
- 在图级别上,每个 Stage 支持两种上下文模式:
66
+ * **线性(serial layout)**:当前节点执行完毕再启动下一节点(下游节点可提前接收任务但不会立即执行)。
67
+ * **多线程(thread layout)**:当前节点在主进程的独立线程中启动,适合 I/O 密集型任务和不可 pickle 的函数(如 lambda)。
68
+ * **协程(async layout)**:当前节点以协程方式启动,适合 I/O 密集型异步任务。
61
69
 
62
- * **线性执行(serial layout)**:当前节点执行完毕再启动下一节点(下游节点可提前接收任务但不会立即执行)。
63
- * **线程执行(thread layout)**:当前节点在主进程的独立线程中启动,适合 I/O 密集型任务和不可 pickle 的函数(如 lambda)。
70
+ `graph_mode` × `execution_mode` 共可组合出 9 种执行模式,覆盖绝大多数场景。
64
71
 
65
72
  TaskGraph 能构建完整的 **有向图结构(Directed Graph)**,不仅支持传统的有向无环图(DAG),也能灵活表达 **树形(Tree)**、**环形(loop)** 乃至于 **完全图(Complete Graph)** 形式的任务依赖。
66
73
 
67
- 在执行与调度之外,CelestialFlow 进一步引入 **CelestialTree(简称: ctree 事件追踪系统**,为每一个任务及其衍生行为(成功、失败、重试、拆分、路由等)记录明确的因果关系。借助 ctree,可以从任意一个初始任务出发,完整还原其在 TaskGraph 中的传播路径与执行轨迹,使任务系统可以进行完整的**追溯、分析、解释**。
74
+ 在执行与调度之外,CelestialFlow 进一步引入 **CelestialTree(简称: ctree)事件追踪系统**,为每一个任务及其衍生行为(成功、失败、重试、拆分、路由等)记录明确的因果关系。借助 ctree,可以从任意一个初始任务出发,完整还原其在 TaskGraph 中的传播路径与执行轨迹,使任务系统可以进行完整的**追溯、分析、解释**。自 3.2.4 起,`ctree` 默认使用本地超简化实现,不强制依赖 `celestialtree` 外部包;如需 gRPC 远程追踪能力,可再额外安装。
68
75
 
69
- 在此基础上,CelestialFlow 提供事件追踪、状态上报、持久化回放,并提供基于 Redis demo Go Worker 外部协作示例,用于展示按需构建跨进程、跨设备任务协作的方式。
76
+ 在此基础上,CelestialFlow 提供事件追踪、状态上报、持久化回放等功能。Web 可视化界面由独立项目 [celestialflow-web](https://github.com/Mr-xiaotian/celestialflow-web) 提供,二者通过 HTTP 协议协作。
70
77
 
71
78
  ## 项目结构(Project Structure)
72
79
 
@@ -77,10 +84,10 @@ flowchart LR
77
84
  subgraph TG[TaskGraph]
78
85
  direction LR
79
86
 
80
- S1[TaskStage A]
81
- S2[TaskStage B]
82
- S3[TaskStage C]
83
- S4[TaskStage D]
87
+ S1[TaskExecutor A]
88
+ S2[TaskSplitter B]
89
+ S3[TaskExecutor C]
90
+ S4[TaskRouter D]
84
91
 
85
92
  S1 --> S2 --> S3 --> S1
86
93
  S1 --> S4
@@ -93,12 +100,12 @@ flowchart LR
93
100
  %% 统一美化格式
94
101
  classDef blueNode fill:#ffffff,stroke:#6b93d6,rx:6px,ry:6px;
95
102
 
96
- %% 美化 TaskStages
103
+ %% 美化 TaskNodes
97
104
  class S1,S2,S3,S4 blueNode;
98
105
 
99
106
  %% ===== Links =====
100
107
  TG --> CFB[CelestialFlow Web]
101
- CFB --> TG
108
+ CFB --> TG
102
109
 
103
110
  style CFB fill:#ffeaf0,stroke:#d66b8c,stroke-width:2px,rx:10px,ry:10px
104
111
 
@@ -131,7 +138,7 @@ uv sync --group dev
131
138
  一个简单的可运行代码:
132
139
 
133
140
  ```python
134
- from celestialflow import TaskStage, TaskGraph
141
+ from celestialflow import TaskExecutor, TaskGraph
135
142
 
136
143
 
137
144
  def add(x, y):
@@ -144,24 +151,26 @@ def square(x):
144
151
 
145
152
  if __name__ == "__main__":
146
153
  # 定义两个任务节点
147
- stage1 = TaskStage(
154
+ executor_1 = TaskExecutor(
148
155
  name="Adder",
149
156
  func=add,
150
- stage_mode="thread",
151
157
  execution_mode="thread",
152
- unpack_task_args=True,
158
+ max_workers=4,
153
159
  )
154
- stage2 = TaskStage(
155
- name="Squarer", func=square, stage_mode="thread", execution_mode="thread"
160
+ executor_2 = TaskExecutor(
161
+ name="Squarer",
162
+ func=square,
163
+ execution_mode="thread",
164
+ max_workers=4,
156
165
  )
157
166
 
158
167
  # 构建任务图结构
159
- graph = TaskGraph(name="DemoGraph")
160
- graph.set_stages(stages=[stage1, stage2])
161
- graph.connect([stage1], [stage2])
168
+ graph = TaskGraph(name="DemoGraph", graph_mode="thread")
169
+ graph.set_nodes(nodes=[executor_1, executor_2])
170
+ graph.connect([executor_1], [executor_2])
162
171
 
163
172
  # 初始化任务并启动
164
- graph.start_graph({stage1.get_name(): [(1, 2), (3, 4), (5, 6)]})
173
+ graph.run({"Adder": [(1, 2), (3, 4), (5, 6)]})
165
174
  ```
166
175
 
167
176
  注意不要在.ipynb中运行。
@@ -172,12 +181,11 @@ if __name__ == "__main__":
172
181
 
173
182
  若你想了解框架的整体结构与核心组件,下面的参考文档会对你有帮助:
174
183
 
175
- - [TaskExecutor.md](https://github.com/Mr-xiaotian/CelestialFlow/blob/main/docs/zh-CN/src/stage/core_executor.md)
176
- - [TaskStage.md](https://github.com/Mr-xiaotian/CelestialFlow/blob/main/docs/zh-CN/src/stage/core_stage.md)
184
+ - [BaseTaskNode.md](https://github.com/Mr-xiaotian/CelestialFlow/blob/main/docs/zh-CN/src/node/core_node.md)
185
+ - [TaskExecutor.md](https://github.com/Mr-xiaotian/CelestialFlow/blob/main/docs/zh-CN/src/node/core_nodes.md)
177
186
  - [TaskGraph.md](https://github.com/Mr-xiaotian/CelestialFlow/blob/main/docs/zh-CN/src/graph/core_graph.md)
178
187
  - [TaskMetrics.md](https://github.com/Mr-xiaotian/CelestialFlow/blob/main/docs/zh-CN/src/runtime/core_metrics.md)
179
188
  - [TaskQueue.md](https://github.com/Mr-xiaotian/CelestialFlow/blob/main/docs/zh-CN/src/runtime/core_queue.md)
180
- - [TaskStages.md](https://github.com/Mr-xiaotian/CelestialFlow/blob/main/docs/zh-CN/src/stage/core_stages.md)
181
189
  - [TaskReport.md](https://github.com/Mr-xiaotian/CelestialFlow/blob/main/docs/zh-CN/src/observability/core_report.md)
182
190
  - [TaskStructure.md](https://github.com/Mr-xiaotian/CelestialFlow/blob/main/docs/zh-CN/src/graph/core_structure.md)
183
191
  - [BaseObserver.md](https://github.com/Mr-xiaotian/CelestialFlow/blob/main/docs/zh-CN/src/observability/core_observer.md)
@@ -192,21 +200,20 @@ flowchart TD
192
200
  classDef structure fill:#fff6e6,stroke:#f59e0b,color:#78350f;
193
201
  classDef execution fill:#f3e8ff,stroke:#a855f7,color:#581c87;
194
202
 
195
- TM[TaskExecutor.md] --> TS[TaskStage.md] --> TG[TaskGraph.md]
196
- TM --> OB[BaseObserver.md]
197
- TM --> TME[TaskMetrics.md]
203
+ BTN[BaseTaskNode.md] --> TE[TaskExecutor.md] --> TG[TaskGraph.md]
204
+ TE --> OB[BaseObserver.md]
205
+ TE --> TME[TaskMetrics.md]
198
206
 
199
207
  TG --> TQ[TaskQueue.md]
200
- TG --> TN[TaskStages.md]
201
208
  TG --> TR[TaskReport.md]
202
209
  TG --> TSR[TaskStructure.md]
203
210
 
204
- TN --> GW[Go Worker.md]
211
+ TG --> GW[Go Worker.md]
205
212
 
206
- class TM,TS,TG core;
207
- class TP,TME runtime;
213
+ class BTN,TE,TG core;
214
+ class TME runtime;
208
215
  class TSR structure;
209
- class TQ,TN,GW execution;
216
+ class TQ,GW execution;
210
217
  class TR execution;
211
218
  ```
212
219
 
@@ -215,7 +222,7 @@ flowchart TD
215
222
  - [UtilHash.md](https://github.com/Mr-xiaotian/CelestialFlow/blob/main/docs/zh-CN/src/runtime/util_hash.md)
216
223
  - [UtilTypes.md](https://github.com/Mr-xiaotian/CelestialFlow/blob/main/docs/zh-CN/src/runtime/util_types.md)
217
224
  - [UtilErrors.md](https://github.com/Mr-xiaotian/CelestialFlow/blob/main/docs/zh-CN/src/runtime/util_errors.md)
218
- - [Fallback.md](https://github.com/Mr-xiaotian/CelestialFlow/blob/main/docs/zh-CN/src/persistence/core_fallback.md)
225
+ - [Lifecycle.md](https://github.com/Mr-xiaotian/CelestialFlow/blob/main/docs/zh-CN/src/persistence/core_lifecycle.md)
219
226
  - [Log.md](https://github.com/Mr-xiaotian/CelestialFlow/blob/main/docs/zh-CN/src/persistence/core_log.md)
220
227
 
221
228
  如果你更喜欢通过完整案例理解框架的运行方式,可以参考这篇利用 TaskGraph 从零开始构建项目的教程:
@@ -240,143 +247,123 @@ flowchart TD
240
247
 
241
248
  ## 环境要求(Requirements)
242
249
 
243
- **CelestialFlow** 基于 Python 3.12+,默认运行时依赖以下核心组件。
244
- 其中 `celestialtree` 不再属于默认运行时依赖,而是额外安装的可选组件。
250
+ **CelestialFlow** 基于 Python 3.12+,默认运行时仅依赖极简的核心组件。
245
251
 
246
252
  | 依赖包 | 说明 |
247
253
  | ----------------- | ---- |
248
254
  | **Python ≥ 3.12** | 运行环境,建议使用 3.12 及以上版本 |
249
255
  | **requests** | HTTP 客户端库,用于任务状态上报与远程调用 |
250
- | **tqdm** | 可选组件,进度条显示,用于任务执行可视化 |
251
-
252
- - 如需运行 `demo/demo_redis.py` 或 Go Worker 示例,请额外安装 `redis` 并准备 Redis 服务;这部分不属于默认运行时依赖。
253
256
 
254
- - 如需运行依赖 CelestialTree demo / bench / 追踪查询,请额外安装 `celestialtree`,或直接在源码仓库中执行 `uv sync --group dev`。
257
+ - `tqdm` 已不再是默认运行时依赖(自 3.2.7 起移除)。如需在 demo 中体验 `TaskProgress` 进度条,可自行 `uv pip install tqdm`。
258
+ - `celestialtree` 也**不再是必需依赖**(自 3.2.4 起):事件追踪默认使用本地超简化实现,可零外部依赖运行。如需 gRPC 远程追踪能力,请额外安装 `celestialtree`,或在源码仓库中执行 `uv sync --group dev`。
259
+ - 旧版 demo / bench 中的 Redis 节点已在 3.2.4 移除,本项目运行时不再依赖 Redis。
255
260
 
256
- - 如需使用可视化的Web服务, 请额外安装 `celestialflow-web` 并运行 `celestialflow-web --host 0.0.0.0 --port 5000`。
261
+ - 如需使用可视化的 Web 服务,请前往独立项目 [celestialflow-web](https://github.com/Mr-xiaotian/celestialflow-web) 安装并运行 `celestialflow-web --host 0.0.0.0 --port 5000`。
257
262
 
258
263
  ## 文件结构(File Structure)
259
264
 
260
265
  ```
261
- 📁 CelestialFlow (587MB 684KB 313B)
262
- 📁 bench (296KB 842B)
266
+ 📁 CelestialFlow (664MB 611KB 462B)
267
+ 📁 bench (296KB 101B)
263
268
  📁 [1项排除的目录] (194KB 222B)
264
269
  🐍 bench_datastructures.py (6KB 690B)
265
- 🐍 bench_execution_mode.py (2KB 831B)
270
+ 🐍 bench_execution_mode.py (2KB 707B)
266
271
  🐍 bench_futures_memory.py (2KB 269B)
267
- 🐍 bench_gil_vs_nogil.py (10KB 7B)
268
- 🐍 bench_graph_mode.py (7KB 450B)
272
+ 🐍 bench_gil_vs_nogil.py (10KB 101B)
273
+ 🐍 bench_graph_mode.py (6KB 774B)
269
274
  🐍 bench_hash.py (7KB 67B)
270
275
  🐍 bench_hash_container.py (3KB 1009B)
271
276
  🐍 bench_hash_memory.py (3KB 642B)
272
- 🐍 bench_http_grpc.py (2KB 608B)
277
+ 🐍 bench_http_grpc.py (2KB 536B)
273
278
  🐍 bench_ipc_queue.py (7KB 104B)
274
279
  🐍 bench_lock_overhead.py (9KB 421B)
275
280
  🐍 bench_mpqueue_vs_shared_memory.py (13KB 127B)
276
281
  🐍 bench_observer.py (7KB 860B)
277
- 🐍 bench_persistence_spout.py (4KB 279B)
282
+ 🐍 bench_persistence_spout.py (4KB 340B)
278
283
  🐍 bench_queue.py (5KB 857B)
279
284
  🐍 bench_requests.py (6KB 813B)
280
285
  🐍 bench_tqdm.py (1KB 235B)
281
286
  🐍 bench_utils.py (543B)
282
- 📁 demo (147KB 87B)
287
+ 📁 demo (146KB 197B)
283
288
  📁 [1项排除的目录] (100KB 9B)
284
289
  🐍 demo_executor.py (1KB 495B)
285
290
  🐍 demo_funnel.py (2KB 289B)
286
- 🐍 demo_graph.py (3KB 565B)
287
- 🐍 demo_network.py (3KB 879B)
291
+ 🐍 demo_graph.py (3KB 222B)
292
+ 🐍 demo_network.py (3KB 756B)
293
+ 🐍 demo_nodes.py (4KB 212B)
288
294
  🐍 demo_observer.py (4KB 270B)
289
- 🐍 demo_redis.py (9KB 144B)
290
- 🐍 demo_stages.py (4KB 336B)
291
- 🐍 demo_structure.py (12KB 24B)
295
+ 🐍 demo_redis.py (9KB 131B)
296
+ 🐍 demo_structure.py (11KB 737B)
292
297
  🐍 demo_utils.py (6KB 148B)
293
- 📁 dist (147KB 48B)
294
- .gitignore (1B)
295
- celestialflow-3.2.7-py3-none-any.whl (79KB 235B)
296
- 📦 celestialflow-3.2.7.tar.gz (67KB 836B)
297
- 📁 docs (1MB 722KB 21B)
298
- 📁 en[已折叠] (568KB 991B)
299
- 📁 ja[已折叠] (642KB 383B)
300
- 📁 zh-CN[已折叠] (534KB 695B)
301
- 📁 experiments (2KB 1015B)
302
- 🐍 experiment_networkx.py (1KB 878B)
298
+ 📁 docs (1MB 914KB 89B)
299
+ 📁 en[已折叠] (632KB 604B)
300
+ 📁 ja[已折叠] (718KB 778B)
301
+ 📁 zh-CN[已折叠] (586KB 755B)
302
+ 📁 experiments (3KB 21B)
303
+ 🐍 experiment_networkx.py (1KB 908B)
303
304
  🐍 experiment_tqdm.py (1KB 137B)
304
305
  📁 img (5MB 871KB 242B)
305
306
  📷 file_structure.svg (4MB 918KB 1000B)
306
307
  📷 logo(old).png (836KB 542B)
307
308
  📷 logo.png (122KB 747B)
308
309
  📷 scc_condensation.svg (17KB 1B)
309
- 📁 src (1MB 858KB 89B)
310
- 📁 celestialflow[已折叠] (1MB 839KB 629B)
311
- 📁 celestialflow.egg-info[已折叠] (18KB 484B)
312
- 📁 tests (4MB 167KB 552B)
313
- 📁 benchmark[已折叠] (38KB 197B)
314
- 📁 funnel[已折叠] (96KB 363B)
315
- 📁 graph[已折叠] (721KB 564B)
316
- 📁 observability[已折叠] (189KB 236B)
317
- 📁 persistence[已折叠] (388KB 426B)
318
- 📁 runtime[已折叠] (1MB 295KB 529B)
319
- 📁 stage[已折叠] (382KB 155B)
320
- 📁 utils[已折叠] (639KB 527B)
321
- 📁 [1项排除的目录] (487KB 589B)
310
+ 📁 src (1MB 822KB 642B)
311
+ 📁 celestialflow[已折叠] (1MB 822KB 642B)
312
+ 📁 tests (4MB 290KB 989B)
313
+ 📁 benchmark[已折叠] (45KB 270B)
314
+ 📁 funnel[已折叠] (96KB 339B)
315
+ 📁 graph[已折叠] (768KB 424B)
316
+ 📁 node[已折叠] (451KB 840B)
317
+ 📁 observability[已折叠] (188KB 1001B)
318
+ 📁 persistence[已折叠] (393KB 151B)
319
+ 📁 runtime[已折叠] (1MB 290KB 858B)
320
+ 📁 [1项排除的目录] (487KB 637B)
322
321
  🐍 conftest.py (1KB 38B)
323
- 🐍 __init__.py (0B)
324
- 📁 [12项排除的目录] (573MB 420KB 160B)
322
+ 📁 [12项排除的目录] (650MB 21KB 212B)
325
323
  ❓ .env (468B)
326
- ❓ .gitignore (1KB 314B)
327
- 📝 AGENTS.md (1KB 173B)
324
+ ❓ .gitignore (1KB 315B)
325
+ 📝 AGENTS.md (1KB 434B)
328
326
  ❓ LICENSE (1KB 65B)
329
- ❓ Makefile (155B)
327
+ ❓ Makefile (149B)
330
328
  ⚙️ pyproject.toml (2KB 668B)
331
- 📝 README.md (19KB 24B)
332
- 🔒 uv.lock (97KB 510B)
329
+ 📝 README.md (17KB 298B)
330
+ 🔒 uv.lock (120KB 752B)
333
331
  ```
334
332
  <p align="center">
335
- <em>celestial-flow 3.2.8</em>
333
+ <em>celestial-flow 3.3.0</em>
336
334
  </p>
337
335
 
338
336
  (该视图由我的另一个项目[CelestialVault](https://github.com/Mr-xiaotian/CelestialVault)中inst_file.FileTree.print_tree()生成。转换为图片则借助[Carbon](https://carbon.now.sh)。)
339
337
 
340
338
  ## 版本日志(Version Log)
341
- - 3.2.8
339
+ - 3.3.0
342
340
  - feat:
343
- - [IMPORTANT] 添加 `TaskGraph.run_async`, 现在可以直接进行图级别的异步
344
- - 根据 `bench_graph_mode.py` 最新测试, 在I/O密集型任务中, `serial`+`async`(6.05s),比 `serial`+`serial`(69.04s)快 **11.4x**
345
- - `core_structure` 中添加报错校验
346
- - 不再允许设置 `execution_mode=async` 时调用 `TashExecutor.start`(如今的`TashExecutor.run`), 只能调用 `TashExecutor.run_async`
347
- - 另外调用 `TashExecutor.run_async` 时也会进行模式检查, 不是 `execution_mode=async` 就会抛出异常
348
- - 在 `BaseObserver` 中添加 `observer_error`, 用于处理 `BaseObserver.on_*` 函数的报错
349
- - 在 `TaskGraph._finish_start_graph` `TaskExecutor._finish_start` 中对所有执行步骤进行 `try-except`, 以使收尾步骤尽量全部完成
350
- - 添加 `core_scope`, 用于独立控制 `funnel` 的生命周期, 并用于 `TaskGraph.run/run_async` `TaskExecutor.run/run_async`
341
+ - 现在 `TaskExecutor` 中完全删除了 `func_name` 参数
342
+ - 在有 `executor_name` 表达节点后, 这层暴露是不必要的
343
+ - 同时也是为了与 `CelestialGraw` 的状态做统一
344
+ - 在向 `reporter` 发送状态时, 包含图的 `class_name` 信息
345
+ - 移除 `OrderGraph` 中的 `from_edges` 方法
351
346
  - refactor:
352
- - [IMPORTANT] `TaskGraph.start_graph/start_graph_async` `TaskExecutor.start/start_async` 已被重命名为 `TaskGraph.run/run_async` `TaskExecutor.run/run_async`
353
- - 破坏性更新
354
- - 其底层缘由是为了合并 `TaskStage.start_stage/start_stage_async` `TaskExecutor.start/start_async` 而做出的一系列重构之一
355
- - 现在的 `TaskGraph.start/start_async` `TaskExecutor.start/start_async` 不再接受任务, 而是专注于处理现有任务列表中的任务
356
- - [IMPORTANT] 将funnel从 `TaskGraph` `TaskExecutor` 中的显性调用与显性传递, 改为所有使用端均从独立文件中import
357
- - 一来是因为原先的传递链太丑了, 二来是为了简化 `TaskExecutor.start/start_async` 逻辑, 为其与 `TaskStage.start_stage/start_stage_async` 的合并做准备
358
- - 移动部分文件以解决部分模块级的循环引用问题
359
- - 原先并非文件级循环引用, 在使用上并无问题
360
- - 修改 `TaskDispatch.dispatch_thread` 中处理已完成future的逻辑, 避免cpu浪费
361
- - 删除 `util_errors` 中一些不必要的错误类
362
- - `TaskGraph._finalize_stages` 进行拆分, 删除不必要的机制, 将剩余机制移至其他方法
363
- - 修改 `TaskGraph.set_reporter` 的逻辑, 使其与 `set_ctree` 保持一致
364
- - `TaskOutQueue` 中的 `queue_list|target_name|_name_to_idx` 改为 `_queues`, 并删除 `put_channel`
365
- - 我有些困惑为什么最初我没有这么做
366
- - `TaskExecutor` 中合并 `_get_task_repr` and `_get_result_repr`
367
- - 这两个方法原先差异巨大, 但后来经过多次其他部分的重构, 现在逻辑已经一致
368
- - 将 `TaskStage` 中的 `_status` 交给 `TaskMetrics` 维护
369
- - 依旧是为了合并 `TaskExecutor.start/start_async` 与 `TaskStage.start_stage/start_stage_async`
370
- - 移除 `TaskGraph` 中的 `put_stage_queue`
371
- - 任务输入完全使用 `TaskExecutor` 中的 `put_task` `put_signal` 方法
347
+ - [IMPORTANT] 重构原有的 `executor/stage` 结构
348
+ - 原本为 `executor -> stage -> splitter/router`, 三层结构过于复杂
349
+ - 现在删除 `stage` 层, 添加 `BaseTaskNode`, 作为 graph 唯一识别的节点, 而 `executor` 视为与 `splitter/router` 同级别的节点
350
+ - 当前结构为 `BaseTaskNode -> executor/splitter/router`
351
+ - 重构 `render_structure_list`(原 `format_structure_list_from_graph`) 的实现
352
+ - 现在使用广度优先, 而不是原先的递归
353
+ - 同时输入参数直接使用 `list[str]` 形式的节点名称列表, 这意味着不再显示 `func_name` `execution_mode` 等信息
354
+ - 修改原本对于 `collect_runtime_snapshot` 奇怪的调用方式
355
+ - 现在reporter端会在 `_push_status` 中直接调用 `collect_runtime_snapshot`
356
+ - 删除 `TaskExecutor` 中的 `get_summary`, 这层包装实际上是多余的
357
+ - 同时所有的 `event_client.emit` 也不再附带 `summary` 信息
358
+ - 删除 `OrderGraph` 中的 `_node` 参数
359
+ - 之前这个参数提供: 所有节点名称; 节点的插入顺序
360
+ - 现在前者由 `_out` 提供, 后者不再重视
361
+ - `LifecycleInlet` 中的 `task_in` 改名为 `task_input`, 保持与 log 端一致
372
362
  - fix:
373
- - `TaskDispatch.worker/worker_async` 中添加错误捕捉, 捕捉为 `CRITICAL` 级错误
374
- - 避免 `worker` 级出错导致计数错误, 永远无法退出
375
- - `spout` 与 `reporter` 的 `stop` 操作中添加对于线程没有成功 `join` 的报错
376
- - 修复 `TaskGraph.restore_db` `TaskExecutor.restore_db` 中开启 `filter_by_error_type=Ture` 时跳过 `status=pending` 任务记录的问题
377
- - 修复 `TaskGraph` 中部分 `get_*` 方法依赖 `_build_analysis` 的产物, 但 `_build_analysis` 未执行导致的问题
378
- - 修复 `TaskMetrics` 中 `get_counts` 与 `is_tasks_finished` 中可能导致死锁的问题
379
- - 修复 `TaskReporter` 中 `stop` 里进行的最后一次 `_refresh_all` 没有错误捕捉, 导致后续收尾未完成的问题
363
+ - 修复 `execution_mode = async` 时, worker崩溃被忽略的问题
364
+ - 修复任务重试日志中 `retry_times` 的含义模糊, 现在使用 `fail_times`
365
+ - 修复 reporter 的 `_push_*` 方法中, 不处理返回值的问题
366
+ - 修复 `TaskReporter._pull_injection` 中, 对拉取的任务列表错误 `put_task` 的问题
380
367
 
381
368
  更多过往日志可看:
382
369