celestialflow 3.3.1__tar.gz → 3.3.3__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.3.1/src/celestialflow.egg-info → celestialflow-3.3.3}/PKG-INFO +71 -86
- {celestialflow-3.3.1 → celestialflow-3.3.3}/README.md +70 -85
- {celestialflow-3.3.1 → celestialflow-3.3.3}/pyproject.toml +1 -4
- {celestialflow-3.3.1 → celestialflow-3.3.3}/src/celestialflow/__init__.py +12 -9
- celestialflow-3.3.3/src/celestialflow/assembly/__init__.py +13 -0
- celestialflow-3.3.3/src/celestialflow/assembly/core_run.py +147 -0
- {celestialflow-3.3.1 → celestialflow-3.3.3}/src/celestialflow/benchmark/util_benchmark.py +4 -4
- {celestialflow-3.3.1 → celestialflow-3.3.3}/src/celestialflow/benchmark/util_clone.py +18 -45
- {celestialflow-3.3.1 → celestialflow-3.3.3}/src/celestialflow/funnel/core_spout.py +2 -6
- {celestialflow-3.3.1 → celestialflow-3.3.3}/src/celestialflow/graph/core_graph.py +235 -119
- {celestialflow-3.3.1 → celestialflow-3.3.3}/src/celestialflow/node/core_dispatch.py +37 -26
- {celestialflow-3.3.1 → celestialflow-3.3.3}/src/celestialflow/node/core_node.py +217 -148
- {celestialflow-3.3.1 → celestialflow-3.3.3}/src/celestialflow/node/core_nodes.py +222 -201
- celestialflow-3.3.3/src/celestialflow/observer/__init__.py +41 -0
- celestialflow-3.3.3/src/celestialflow/observer/core_event.py +203 -0
- celestialflow-3.3.3/src/celestialflow/observer/core_hub.py +260 -0
- celestialflow-3.3.3/src/celestialflow/observer/core_metrics.py +202 -0
- celestialflow-3.3.3/src/celestialflow/observer/core_observer.py +130 -0
- celestialflow-3.3.3/src/celestialflow/observer/core_observer_print.py +98 -0
- {celestialflow-3.3.1/src/celestialflow/persistence → celestialflow-3.3.3/src/celestialflow/persist}/__init__.py +1 -11
- {celestialflow-3.3.1/src/celestialflow/persistence → celestialflow-3.3.3/src/celestialflow/persist}/core_lifecycle.py +63 -83
- celestialflow-3.3.3/src/celestialflow/persist/core_log.py +274 -0
- {celestialflow-3.3.1/src/celestialflow/persistence → celestialflow-3.3.3/src/celestialflow/persist}/util_payload.py +1 -1
- {celestialflow-3.3.1/src/celestialflow/persistence → celestialflow-3.3.3/src/celestialflow/persist}/util_sqlite.py +53 -272
- celestialflow-3.3.3/src/celestialflow/reporter/__init__.py +23 -0
- celestialflow-3.3.3/src/celestialflow/reporter/core_inject.py +77 -0
- celestialflow-3.3.3/src/celestialflow/reporter/core_push.py +259 -0
- celestialflow-3.3.3/src/celestialflow/reporter/core_snapshot.py +86 -0
- {celestialflow-3.3.1 → celestialflow-3.3.3}/src/celestialflow/runtime/__init__.py +17 -16
- celestialflow-3.3.3/src/celestialflow/runtime/core_config.py +57 -0
- {celestialflow-3.3.1 → celestialflow-3.3.3}/src/celestialflow/runtime/core_queue.py +238 -238
- celestialflow-3.3.3/src/celestialflow/runtime/util_log_level.py +38 -0
- {celestialflow-3.3.1 → celestialflow-3.3.3}/src/celestialflow/runtime/util_types.py +66 -2
- celestialflow-3.3.3/src/celestialflow/ticker/__init__.py +18 -0
- celestialflow-3.3.3/src/celestialflow/ticker/core_event.py +30 -0
- celestialflow-3.3.3/src/celestialflow/ticker/core_handler.py +87 -0
- celestialflow-3.3.3/src/celestialflow/ticker/core_hub.py +99 -0
- celestialflow-3.3.3/src/celestialflow/ticker/core_ticker.py +204 -0
- {celestialflow-3.3.1 → celestialflow-3.3.3/src/celestialflow.egg-info}/PKG-INFO +71 -86
- {celestialflow-3.3.1 → celestialflow-3.3.3}/src/celestialflow.egg-info/SOURCES.txt +26 -15
- celestialflow-3.3.1/src/celestialflow/observability/__init__.py +0 -17
- celestialflow-3.3.1/src/celestialflow/observability/core_observer.py +0 -109
- celestialflow-3.3.1/src/celestialflow/observability/core_observer_print.py +0 -86
- celestialflow-3.3.1/src/celestialflow/observability/core_report.py +0 -288
- celestialflow-3.3.1/src/celestialflow/observability/util_types.py +0 -41
- celestialflow-3.3.1/src/celestialflow/persistence/core_log.py +0 -430
- celestialflow-3.3.1/src/celestialflow/persistence/core_scope.py +0 -41
- celestialflow-3.3.1/src/celestialflow/runtime/core_metrics.py +0 -361
- celestialflow-3.3.1/src/celestialflow/runtime/util_config.py +0 -40
- {celestialflow-3.3.1 → celestialflow-3.3.3}/LICENSE +0 -0
- {celestialflow-3.3.1 → celestialflow-3.3.3}/setup.cfg +0 -0
- {celestialflow-3.3.1 → celestialflow-3.3.3}/src/celestialflow/benchmark/__init__.py +0 -0
- {celestialflow-3.3.1 → celestialflow-3.3.3}/src/celestialflow/funnel/__init__.py +0 -0
- {celestialflow-3.3.1 → celestialflow-3.3.3}/src/celestialflow/funnel/core_inlet.py +0 -0
- {celestialflow-3.3.1 → celestialflow-3.3.3}/src/celestialflow/funnel/util_count.py +0 -0
- {celestialflow-3.3.1 → celestialflow-3.3.3}/src/celestialflow/graph/__init__.py +0 -0
- {celestialflow-3.3.1 → celestialflow-3.3.3}/src/celestialflow/graph/core_structure.py +0 -0
- {celestialflow-3.3.1 → celestialflow-3.3.3}/src/celestialflow/graph/util_order_graph.py +0 -0
- {celestialflow-3.3.1 → celestialflow-3.3.3}/src/celestialflow/node/__init__.py +0 -0
- {celestialflow-3.3.1 → celestialflow-3.3.3}/src/celestialflow/node/util_callable.py +0 -0
- {celestialflow-3.3.1 → celestialflow-3.3.3}/src/celestialflow/node/util_types.py +0 -0
- {celestialflow-3.3.1/src/celestialflow/graph → celestialflow-3.3.3/src/celestialflow/persist}/util_render.py +0 -0
- {celestialflow-3.3.1 → celestialflow-3.3.3}/src/celestialflow/runtime/core_envelope.py +0 -0
- {celestialflow-3.3.1 → celestialflow-3.3.3}/src/celestialflow/runtime/util_constant.py +0 -0
- {celestialflow-3.3.1 → celestialflow-3.3.3}/src/celestialflow/runtime/util_errors.py +0 -0
- {celestialflow-3.3.1 → celestialflow-3.3.3}/src/celestialflow/runtime/util_event.py +0 -0
- {celestialflow-3.3.1 → celestialflow-3.3.3}/src/celestialflow/runtime/util_format.py +0 -0
- {celestialflow-3.3.1 → celestialflow-3.3.3}/src/celestialflow.egg-info/dependency_links.txt +0 -0
- {celestialflow-3.3.1 → celestialflow-3.3.3}/src/celestialflow.egg-info/requires.txt +0 -0
- {celestialflow-3.3.1 → celestialflow-3.3.3}/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.3.
|
|
3
|
+
Version: 3.3.3
|
|
4
4
|
Summary: A flexible GRAPH-based task orchestration framework.
|
|
5
5
|
Author-email: Mr-xiaotian <mingxiaomingtian@gmail.com>
|
|
6
6
|
License: MIT
|
|
@@ -19,7 +19,7 @@ Dynamic: license-file
|
|
|
19
19
|
|
|
20
20
|
# CelestialFlow ——一个轻量级、可并行、基于图结构的 Python 任务调度框架
|
|
21
21
|
|
|
22
|
-
> 📅 最后更新日期: 2026/
|
|
22
|
+
> 📅 最后更新日期: 2026/10/30
|
|
23
23
|
|
|
24
24
|
<p align="center">
|
|
25
25
|
<img src="https://raw.githubusercontent.com/Mr-xiaotian/CelestialFlow/main/img/logo.png" width="1080" alt="CelestialFlow Logo">
|
|
@@ -42,7 +42,7 @@ Dynamic: license-file
|
|
|
42
42
|
<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>
|
|
43
43
|
</p>
|
|
44
44
|
|
|
45
|
-
**CelestialFlow**
|
|
45
|
+
**CelestialFlow** 是一个轻量级但功能完整、基于图结构的 Python 任务流框架,适合需要 **复杂依赖关系**、**灵活执行模型**、**跨设备运行** 与 **可观测执行链路** 的中/大型 Python 任务系统。
|
|
46
46
|
|
|
47
47
|
- 相比 Airflow/Dagster 更轻、更快开始
|
|
48
48
|
- 相比 multiprocessing/threading 更结构化,可直接表达 loop / complete graph 等复杂依赖模式
|
|
@@ -59,7 +59,7 @@ Dynamic: license-file
|
|
|
59
59
|
* **多线程(thread)**
|
|
60
60
|
* **协程(async)**
|
|
61
61
|
|
|
62
|
-
`TaskExecutor`
|
|
62
|
+
`TaskExecutor` 支持自定义跳过函数(可用作任务去重)、失败重试、队列上限与多执行模式切换,单独使用也很好用。
|
|
63
63
|
|
|
64
64
|
节点之间通过 **TaskGraph** 互相连接,形成具有上游与下游依赖关系的任务图。下游节点会自动接收上游执行完成的结果作为输入,从而形成明确的数据流。TaskGraph 同时提供 `TaskChain` / `TaskCross` / `TaskGrid` / `TaskLoop` / `TaskWheel` / `TaskComplete` 等预置拓扑结构,方便快速搭建常见依赖模式。
|
|
65
65
|
|
|
@@ -143,7 +143,8 @@ uv sync --group dev
|
|
|
143
143
|
from celestialflow import TaskExecutor, TaskGraph
|
|
144
144
|
|
|
145
145
|
|
|
146
|
-
def add(
|
|
146
|
+
def add(task):
|
|
147
|
+
x, y = task
|
|
147
148
|
return x + y
|
|
148
149
|
|
|
149
150
|
|
|
@@ -186,11 +187,11 @@ if __name__ == "__main__":
|
|
|
186
187
|
- [BaseTaskNode.md](https://github.com/Mr-xiaotian/CelestialFlow/blob/main/docs/zh-CN/src/node/core_node.md)
|
|
187
188
|
- [TaskExecutor.md](https://github.com/Mr-xiaotian/CelestialFlow/blob/main/docs/zh-CN/src/node/core_nodes.md)
|
|
188
189
|
- [TaskGraph.md](https://github.com/Mr-xiaotian/CelestialFlow/blob/main/docs/zh-CN/src/graph/core_graph.md)
|
|
189
|
-
- [
|
|
190
|
+
- [MetricsObserver.md](https://github.com/Mr-xiaotian/CelestialFlow/blob/main/docs/zh-CN/src/observer/core_metrics.md)
|
|
190
191
|
- [TaskQueue.md](https://github.com/Mr-xiaotian/CelestialFlow/blob/main/docs/zh-CN/src/runtime/core_queue.md)
|
|
191
|
-
- [
|
|
192
|
+
- [ReportConfig.md](https://github.com/Mr-xiaotian/CelestialFlow/blob/main/docs/zh-CN/src/runtime/core_config.md)
|
|
192
193
|
- [TaskStructure.md](https://github.com/Mr-xiaotian/CelestialFlow/blob/main/docs/zh-CN/src/graph/core_structure.md)
|
|
193
|
-
- [
|
|
194
|
+
- [Observer.md](https://github.com/Mr-xiaotian/CelestialFlow/blob/main/docs/zh-CN/src/observer/core_observer.md)
|
|
194
195
|
- [Go Worker.md](https://github.com/Mr-xiaotian/CelestialFlow/blob/main/docs/zh-CN/other/go_worker.md)
|
|
195
196
|
|
|
196
197
|
推荐阅读顺序:
|
|
@@ -203,11 +204,11 @@ flowchart TD
|
|
|
203
204
|
classDef execution fill:#f3e8ff,stroke:#a855f7,color:#581c87;
|
|
204
205
|
|
|
205
206
|
BTN[BaseTaskNode.md] --> TE[TaskExecutor.md] --> TG[TaskGraph.md]
|
|
206
|
-
TE --> OB[
|
|
207
|
-
TE --> TME[
|
|
207
|
+
TE --> OB[Observer.md]
|
|
208
|
+
TE --> TME[MetricsObserver.md]
|
|
208
209
|
|
|
209
210
|
TG --> TQ[TaskQueue.md]
|
|
210
|
-
TG -->
|
|
211
|
+
TG --> TRC[ReportConfig.md]
|
|
211
212
|
TG --> TSR[TaskStructure.md]
|
|
212
213
|
|
|
213
214
|
TG --> GW[Go Worker.md]
|
|
@@ -216,16 +217,16 @@ flowchart TD
|
|
|
216
217
|
class TME runtime;
|
|
217
218
|
class TSR structure;
|
|
218
219
|
class TQ,GW execution;
|
|
219
|
-
class
|
|
220
|
+
class TRC execution;
|
|
220
221
|
```
|
|
221
222
|
|
|
222
223
|
以下五篇可以作为补充阅读:
|
|
223
224
|
|
|
224
|
-
- [UtilHash.md](https://github.com/Mr-xiaotian/CelestialFlow/blob/main/docs/zh-CN/src/runtime/util_hash.md)
|
|
225
225
|
- [UtilTypes.md](https://github.com/Mr-xiaotian/CelestialFlow/blob/main/docs/zh-CN/src/runtime/util_types.md)
|
|
226
226
|
- [UtilErrors.md](https://github.com/Mr-xiaotian/CelestialFlow/blob/main/docs/zh-CN/src/runtime/util_errors.md)
|
|
227
|
-
- [
|
|
228
|
-
- [
|
|
227
|
+
- [UtilFormat.md](https://github.com/Mr-xiaotian/CelestialFlow/blob/main/docs/zh-CN/src/runtime/util_format.md)
|
|
228
|
+
- [Lifecycle.md](https://github.com/Mr-xiaotian/CelestialFlow/blob/main/docs/zh-CN/src/persist/core_lifecycle.md)
|
|
229
|
+
- [Log.md](https://github.com/Mr-xiaotian/CelestialFlow/blob/main/docs/zh-CN/src/persist/core_log.md)
|
|
229
230
|
|
|
230
231
|
如果你更喜欢通过完整案例理解框架的运行方式,可以参考这篇利用 TaskGraph 从零开始构建项目的教程:
|
|
231
232
|
|
|
@@ -265,44 +266,45 @@ flowchart TD
|
|
|
265
266
|
## 文件结构(File Structure)
|
|
266
267
|
|
|
267
268
|
```
|
|
268
|
-
📁 CelestialFlow (
|
|
269
|
-
📁 bench (316KB
|
|
270
|
-
📁 [1项排除的目录] (
|
|
269
|
+
📁 CelestialFlow (560MB 757KB 428B)
|
|
270
|
+
📁 bench (316KB 409B)
|
|
271
|
+
📁 [1项排除的目录] (193KB 163B)
|
|
271
272
|
🐍 bench_datastructures.py (6KB 690B)
|
|
272
273
|
🐍 bench_execution_mode.py (2KB 707B)
|
|
273
274
|
🐍 bench_funnel_vs_lock.py (21KB 888B)
|
|
274
275
|
🐍 bench_futures_memory.py (2KB 269B)
|
|
275
|
-
🐍 bench_gil_vs_nogil.py (
|
|
276
|
+
🐍 bench_gil_vs_nogil.py (10KB 552B)
|
|
276
277
|
🐍 bench_graph_mode.py (6KB 614B)
|
|
277
278
|
🐍 bench_hash.py (7KB 67B)
|
|
278
279
|
🐍 bench_hash_container.py (3KB 1009B)
|
|
279
280
|
🐍 bench_hash_memory.py (3KB 655B)
|
|
280
|
-
🐍 bench_http_grpc.py (2KB
|
|
281
|
+
🐍 bench_http_grpc.py (2KB 530B)
|
|
281
282
|
🐍 bench_ipc_queue.py (7KB 104B)
|
|
282
283
|
🐍 bench_lock_overhead.py (9KB 421B)
|
|
283
284
|
🐍 bench_mpqueue_vs_shared_memory.py (13KB 127B)
|
|
284
|
-
🐍 bench_observer.py (
|
|
285
|
-
🐍
|
|
285
|
+
🐍 bench_observer.py (7KB 58B)
|
|
286
|
+
🐍 bench_persist_spout.py (4KB 323B)
|
|
286
287
|
🐍 bench_queue.py (5KB 857B)
|
|
287
288
|
🐍 bench_requests.py (6KB 813B)
|
|
288
289
|
🐍 bench_tqdm.py (1KB 235B)
|
|
289
290
|
🐍 bench_utils.py (543B)
|
|
290
|
-
📁 demo (
|
|
291
|
-
📁 [
|
|
292
|
-
🐍 demo_executor.py
|
|
293
|
-
🐍 demo_funnel.py
|
|
294
|
-
🐍 demo_graph.py
|
|
295
|
-
🐍 demo_network.py
|
|
296
|
-
🐍 demo_nodes.py
|
|
297
|
-
🐍 demo_observer.py
|
|
298
|
-
🐍 demo_redis.py
|
|
299
|
-
🐍
|
|
300
|
-
🐍
|
|
301
|
-
🐍
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
📁
|
|
305
|
-
📁
|
|
291
|
+
📁 demo (811KB 650B)
|
|
292
|
+
📁 [4项排除的目录] (755KB 996B)
|
|
293
|
+
🐍 demo_executor.py (1KB 557B)
|
|
294
|
+
🐍 demo_funnel.py (2KB 289B)
|
|
295
|
+
🐍 demo_graph.py (2KB 975B)
|
|
296
|
+
🐍 demo_network.py (3KB 756B)
|
|
297
|
+
🐍 demo_nodes.py (3KB 915B)
|
|
298
|
+
🐍 demo_observer.py (2KB 1004B)
|
|
299
|
+
🐍 demo_redis.py (8KB 595B)
|
|
300
|
+
🐍 demo_skip_dedup.py (6KB 286B)
|
|
301
|
+
🐍 demo_structure.py (8KB 448B)
|
|
302
|
+
🐍 demo_utils.py (6KB 263B)
|
|
303
|
+
🐍 demo_web.py (8KB 734B)
|
|
304
|
+
📁 docs (2MB 88KB 855B)
|
|
305
|
+
📁 en[已折叠] (678KB 928B)
|
|
306
|
+
📁 ja[已折叠] (778KB 854B)
|
|
307
|
+
📁 zh-CN[已折叠] (679KB 97B)
|
|
306
308
|
📁 experiments (3KB 21B)
|
|
307
309
|
🐍 experiment_networkx.py (1KB 908B)
|
|
308
310
|
🐍 experiment_tqdm.py (1KB 137B)
|
|
@@ -311,67 +313,50 @@ flowchart TD
|
|
|
311
313
|
📷 logo(old).png (836KB 542B)
|
|
312
314
|
📷 logo.png (122KB 747B)
|
|
313
315
|
📷 scc_condensation.svg (17KB 1B)
|
|
314
|
-
📁 src (1MB
|
|
315
|
-
📁 celestialflow[已折叠] (1MB
|
|
316
|
-
📁 [1项排除的目录] (
|
|
317
|
-
📁 tests (3MB
|
|
318
|
-
📁
|
|
319
|
-
📁
|
|
320
|
-
📁
|
|
321
|
-
📁
|
|
322
|
-
📁
|
|
323
|
-
📁
|
|
324
|
-
📁
|
|
325
|
-
📁 [
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
316
|
+
📁 src (1MB 661KB 60B)
|
|
317
|
+
📁 celestialflow[已折叠] (1MB 641KB 309B)
|
|
318
|
+
📁 [1项排除的目录] (19KB 775B)
|
|
319
|
+
📁 tests (3MB 65KB 73B)
|
|
320
|
+
📁 assembly[已折叠] (42KB 929B)
|
|
321
|
+
📁 benchmark[已折叠] (41KB 377B)
|
|
322
|
+
📁 funnel[已折叠] (96KB 339B)
|
|
323
|
+
📁 graph[已折叠] (803KB 239B)
|
|
324
|
+
📁 node[已折叠] (510KB 93B)
|
|
325
|
+
📁 observer[已折叠] (122KB 937B)
|
|
326
|
+
📁 persist[已折叠] (186KB 828B)
|
|
327
|
+
📁 persistence[已折叠] (381KB 89B)
|
|
328
|
+
📁 reporter[已折叠] (173KB 986B)
|
|
329
|
+
📁 runtime[已折叠] (189KB 800B)
|
|
330
|
+
📁 ticker[已折叠] (54KB 761B)
|
|
331
|
+
📁 [3项排除的目录] (532KB 170B)
|
|
332
|
+
🐍 conftest.py (1KB 693B)
|
|
333
|
+
📁 [13项排除的目录] (546MB 860KB 667B)
|
|
334
|
+
❓ .env (484B)
|
|
329
335
|
❓ .gitignore (1KB 315B)
|
|
330
|
-
📝 AGENTS.md (
|
|
336
|
+
📝 AGENTS.md (2KB 800B)
|
|
331
337
|
❓ LICENSE (1KB 65B)
|
|
332
338
|
❓ Makefile (149B)
|
|
333
|
-
⚙️ pyproject.toml (2KB
|
|
334
|
-
📝 README.md (
|
|
335
|
-
🔒 uv.lock (
|
|
339
|
+
⚙️ pyproject.toml (2KB 624B)
|
|
340
|
+
📝 README.md (16KB 321B)
|
|
341
|
+
🔒 uv.lock (126KB 837B)
|
|
336
342
|
```
|
|
337
343
|
<p align="center">
|
|
338
|
-
<em>celestial-flow 3.3.
|
|
344
|
+
<em>celestial-flow 3.3.3</em>
|
|
339
345
|
</p>
|
|
340
346
|
|
|
341
347
|
(该视图由我的另一个项目[CelestialVault](https://github.com/Mr-xiaotian/CelestialVault)中inst_file.FileTree.print_tree()生成。转换为图片则借助[Carbon](https://carbon.now.sh)。)
|
|
342
348
|
|
|
343
349
|
## 版本日志(Version Log)
|
|
344
|
-
- 3.3.
|
|
350
|
+
- 3.3.3
|
|
345
351
|
- feat:
|
|
346
|
-
-
|
|
347
|
-
|
|
348
|
-
- 同步更新web端, 现在web端的结构图中可以显示精确的上下游传送任务数量
|
|
349
|
-
- [IMPORTANT] 删除 `duplocate` 机制
|
|
350
|
-
- 这是非常 非常艰难的选择, `duplocate` 机制极其古老, 但在我的仔细评估后我认为问题有三:
|
|
351
|
-
- 1. 传入的任务未必hash able, 现有的hash函数不确定性极大
|
|
352
|
-
- 2. 如果要确保任务可hash, 最好单独传一个处理任务的func, 但这会添加node的参数复杂度
|
|
353
|
-
- 3. 同时duplocate在单node时完全可以被任务输入前的筛选来取代, 而graph时的收益的则非常不明显
|
|
354
|
-
- 反复考虑认为还是遵从简洁的第一性原则
|
|
355
|
-
- 简化 `log.task_success` 输出, 不再显示 `execution_mode`
|
|
356
|
-
- 在 `lifecycle` 中添加 `retry_time` 字段
|
|
357
|
-
- 添加一个开箱即用的 `observer`, `ObserverPrint`
|
|
358
|
-
- 在graph环境下显示的 `total` 会有问题, 下个版本解决
|
|
352
|
+
- 在 `GraphEndEvent` / `NodeEndEvent` 中添加 `end_time`
|
|
353
|
+
- 在 `GraphStartEvent` 中删除 `class_name`
|
|
359
354
|
- refactor:
|
|
360
|
-
-
|
|
361
|
-
-
|
|
362
|
-
-
|
|
363
|
-
- 在 `TaskNode` 中添加新的泛型 `Y`, 表示向下游传输的任务类型
|
|
364
|
-
- 这是为了优化 `splitter` 和 `router`
|
|
365
|
-
- 节点的 `elapsed_time` 现在由 `dispatch` 来自行计算, 保证精准
|
|
366
|
-
- 话说我之前为什么要弄那么一套即麻烦又不准的算法?
|
|
367
|
-
- 在 `reporter` 中为 `status` 添加门控, 如果当前状态与上一次发送状态一致, 则不进行发送
|
|
368
|
-
- 至此 `reporter` 中所有的 `push_*` 都拥有门控, 避免无效的数据发送
|
|
355
|
+
- 移除部分无用的observer事件, 如 `on_worker_crash`
|
|
356
|
+
- 将log与reporter设置从 `.toml` 中移到运行时配置中
|
|
357
|
+
- 删除部分无用的sqlite函数
|
|
369
358
|
- fix:
|
|
370
|
-
|
|
371
|
-
- 添加 `bench_funnel_vs_lock`, 用来测试并发环境下, 使用funnel和使用locl记录数据的性能差
|
|
372
|
-
- 前者发送延迟低, 但内存占用高
|
|
373
|
-
- 
|
|
374
|
-
- 添加 `demo_web`, 用于进行复杂结构的web演示
|
|
359
|
+
- 修复图分析缓存的问题
|
|
375
360
|
|
|
376
361
|
更多过往日志可看:
|
|
377
362
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# CelestialFlow ——一个轻量级、可并行、基于图结构的 Python 任务调度框架
|
|
2
2
|
|
|
3
|
-
> 📅 最后更新日期: 2026/
|
|
3
|
+
> 📅 最后更新日期: 2026/10/30
|
|
4
4
|
|
|
5
5
|
<p align="center">
|
|
6
6
|
<img src="https://raw.githubusercontent.com/Mr-xiaotian/CelestialFlow/main/img/logo.png" width="1080" alt="CelestialFlow Logo">
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
<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>
|
|
24
24
|
</p>
|
|
25
25
|
|
|
26
|
-
**CelestialFlow**
|
|
26
|
+
**CelestialFlow** 是一个轻量级但功能完整、基于图结构的 Python 任务流框架,适合需要 **复杂依赖关系**、**灵活执行模型**、**跨设备运行** 与 **可观测执行链路** 的中/大型 Python 任务系统。
|
|
27
27
|
|
|
28
28
|
- 相比 Airflow/Dagster 更轻、更快开始
|
|
29
29
|
- 相比 multiprocessing/threading 更结构化,可直接表达 loop / complete graph 等复杂依赖模式
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
* **多线程(thread)**
|
|
41
41
|
* **协程(async)**
|
|
42
42
|
|
|
43
|
-
`TaskExecutor`
|
|
43
|
+
`TaskExecutor` 支持自定义跳过函数(可用作任务去重)、失败重试、队列上限与多执行模式切换,单独使用也很好用。
|
|
44
44
|
|
|
45
45
|
节点之间通过 **TaskGraph** 互相连接,形成具有上游与下游依赖关系的任务图。下游节点会自动接收上游执行完成的结果作为输入,从而形成明确的数据流。TaskGraph 同时提供 `TaskChain` / `TaskCross` / `TaskGrid` / `TaskLoop` / `TaskWheel` / `TaskComplete` 等预置拓扑结构,方便快速搭建常见依赖模式。
|
|
46
46
|
|
|
@@ -124,7 +124,8 @@ uv sync --group dev
|
|
|
124
124
|
from celestialflow import TaskExecutor, TaskGraph
|
|
125
125
|
|
|
126
126
|
|
|
127
|
-
def add(
|
|
127
|
+
def add(task):
|
|
128
|
+
x, y = task
|
|
128
129
|
return x + y
|
|
129
130
|
|
|
130
131
|
|
|
@@ -167,11 +168,11 @@ if __name__ == "__main__":
|
|
|
167
168
|
- [BaseTaskNode.md](https://github.com/Mr-xiaotian/CelestialFlow/blob/main/docs/zh-CN/src/node/core_node.md)
|
|
168
169
|
- [TaskExecutor.md](https://github.com/Mr-xiaotian/CelestialFlow/blob/main/docs/zh-CN/src/node/core_nodes.md)
|
|
169
170
|
- [TaskGraph.md](https://github.com/Mr-xiaotian/CelestialFlow/blob/main/docs/zh-CN/src/graph/core_graph.md)
|
|
170
|
-
- [
|
|
171
|
+
- [MetricsObserver.md](https://github.com/Mr-xiaotian/CelestialFlow/blob/main/docs/zh-CN/src/observer/core_metrics.md)
|
|
171
172
|
- [TaskQueue.md](https://github.com/Mr-xiaotian/CelestialFlow/blob/main/docs/zh-CN/src/runtime/core_queue.md)
|
|
172
|
-
- [
|
|
173
|
+
- [ReportConfig.md](https://github.com/Mr-xiaotian/CelestialFlow/blob/main/docs/zh-CN/src/runtime/core_config.md)
|
|
173
174
|
- [TaskStructure.md](https://github.com/Mr-xiaotian/CelestialFlow/blob/main/docs/zh-CN/src/graph/core_structure.md)
|
|
174
|
-
- [
|
|
175
|
+
- [Observer.md](https://github.com/Mr-xiaotian/CelestialFlow/blob/main/docs/zh-CN/src/observer/core_observer.md)
|
|
175
176
|
- [Go Worker.md](https://github.com/Mr-xiaotian/CelestialFlow/blob/main/docs/zh-CN/other/go_worker.md)
|
|
176
177
|
|
|
177
178
|
推荐阅读顺序:
|
|
@@ -184,11 +185,11 @@ flowchart TD
|
|
|
184
185
|
classDef execution fill:#f3e8ff,stroke:#a855f7,color:#581c87;
|
|
185
186
|
|
|
186
187
|
BTN[BaseTaskNode.md] --> TE[TaskExecutor.md] --> TG[TaskGraph.md]
|
|
187
|
-
TE --> OB[
|
|
188
|
-
TE --> TME[
|
|
188
|
+
TE --> OB[Observer.md]
|
|
189
|
+
TE --> TME[MetricsObserver.md]
|
|
189
190
|
|
|
190
191
|
TG --> TQ[TaskQueue.md]
|
|
191
|
-
TG -->
|
|
192
|
+
TG --> TRC[ReportConfig.md]
|
|
192
193
|
TG --> TSR[TaskStructure.md]
|
|
193
194
|
|
|
194
195
|
TG --> GW[Go Worker.md]
|
|
@@ -197,16 +198,16 @@ flowchart TD
|
|
|
197
198
|
class TME runtime;
|
|
198
199
|
class TSR structure;
|
|
199
200
|
class TQ,GW execution;
|
|
200
|
-
class
|
|
201
|
+
class TRC execution;
|
|
201
202
|
```
|
|
202
203
|
|
|
203
204
|
以下五篇可以作为补充阅读:
|
|
204
205
|
|
|
205
|
-
- [UtilHash.md](https://github.com/Mr-xiaotian/CelestialFlow/blob/main/docs/zh-CN/src/runtime/util_hash.md)
|
|
206
206
|
- [UtilTypes.md](https://github.com/Mr-xiaotian/CelestialFlow/blob/main/docs/zh-CN/src/runtime/util_types.md)
|
|
207
207
|
- [UtilErrors.md](https://github.com/Mr-xiaotian/CelestialFlow/blob/main/docs/zh-CN/src/runtime/util_errors.md)
|
|
208
|
-
- [
|
|
209
|
-
- [
|
|
208
|
+
- [UtilFormat.md](https://github.com/Mr-xiaotian/CelestialFlow/blob/main/docs/zh-CN/src/runtime/util_format.md)
|
|
209
|
+
- [Lifecycle.md](https://github.com/Mr-xiaotian/CelestialFlow/blob/main/docs/zh-CN/src/persist/core_lifecycle.md)
|
|
210
|
+
- [Log.md](https://github.com/Mr-xiaotian/CelestialFlow/blob/main/docs/zh-CN/src/persist/core_log.md)
|
|
210
211
|
|
|
211
212
|
如果你更喜欢通过完整案例理解框架的运行方式,可以参考这篇利用 TaskGraph 从零开始构建项目的教程:
|
|
212
213
|
|
|
@@ -246,44 +247,45 @@ flowchart TD
|
|
|
246
247
|
## 文件结构(File Structure)
|
|
247
248
|
|
|
248
249
|
```
|
|
249
|
-
📁 CelestialFlow (
|
|
250
|
-
📁 bench (316KB
|
|
251
|
-
📁 [1项排除的目录] (
|
|
250
|
+
📁 CelestialFlow (560MB 757KB 428B)
|
|
251
|
+
📁 bench (316KB 409B)
|
|
252
|
+
📁 [1项排除的目录] (193KB 163B)
|
|
252
253
|
🐍 bench_datastructures.py (6KB 690B)
|
|
253
254
|
🐍 bench_execution_mode.py (2KB 707B)
|
|
254
255
|
🐍 bench_funnel_vs_lock.py (21KB 888B)
|
|
255
256
|
🐍 bench_futures_memory.py (2KB 269B)
|
|
256
|
-
🐍 bench_gil_vs_nogil.py (
|
|
257
|
+
🐍 bench_gil_vs_nogil.py (10KB 552B)
|
|
257
258
|
🐍 bench_graph_mode.py (6KB 614B)
|
|
258
259
|
🐍 bench_hash.py (7KB 67B)
|
|
259
260
|
🐍 bench_hash_container.py (3KB 1009B)
|
|
260
261
|
🐍 bench_hash_memory.py (3KB 655B)
|
|
261
|
-
🐍 bench_http_grpc.py (2KB
|
|
262
|
+
🐍 bench_http_grpc.py (2KB 530B)
|
|
262
263
|
🐍 bench_ipc_queue.py (7KB 104B)
|
|
263
264
|
🐍 bench_lock_overhead.py (9KB 421B)
|
|
264
265
|
🐍 bench_mpqueue_vs_shared_memory.py (13KB 127B)
|
|
265
|
-
🐍 bench_observer.py (
|
|
266
|
-
🐍
|
|
266
|
+
🐍 bench_observer.py (7KB 58B)
|
|
267
|
+
🐍 bench_persist_spout.py (4KB 323B)
|
|
267
268
|
🐍 bench_queue.py (5KB 857B)
|
|
268
269
|
🐍 bench_requests.py (6KB 813B)
|
|
269
270
|
🐍 bench_tqdm.py (1KB 235B)
|
|
270
271
|
🐍 bench_utils.py (543B)
|
|
271
|
-
📁 demo (
|
|
272
|
-
📁 [
|
|
273
|
-
🐍 demo_executor.py
|
|
274
|
-
🐍 demo_funnel.py
|
|
275
|
-
🐍 demo_graph.py
|
|
276
|
-
🐍 demo_network.py
|
|
277
|
-
🐍 demo_nodes.py
|
|
278
|
-
🐍 demo_observer.py
|
|
279
|
-
🐍 demo_redis.py
|
|
280
|
-
🐍
|
|
281
|
-
🐍
|
|
282
|
-
🐍
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
📁
|
|
286
|
-
📁
|
|
272
|
+
📁 demo (811KB 650B)
|
|
273
|
+
📁 [4项排除的目录] (755KB 996B)
|
|
274
|
+
🐍 demo_executor.py (1KB 557B)
|
|
275
|
+
🐍 demo_funnel.py (2KB 289B)
|
|
276
|
+
🐍 demo_graph.py (2KB 975B)
|
|
277
|
+
🐍 demo_network.py (3KB 756B)
|
|
278
|
+
🐍 demo_nodes.py (3KB 915B)
|
|
279
|
+
🐍 demo_observer.py (2KB 1004B)
|
|
280
|
+
🐍 demo_redis.py (8KB 595B)
|
|
281
|
+
🐍 demo_skip_dedup.py (6KB 286B)
|
|
282
|
+
🐍 demo_structure.py (8KB 448B)
|
|
283
|
+
🐍 demo_utils.py (6KB 263B)
|
|
284
|
+
🐍 demo_web.py (8KB 734B)
|
|
285
|
+
📁 docs (2MB 88KB 855B)
|
|
286
|
+
📁 en[已折叠] (678KB 928B)
|
|
287
|
+
📁 ja[已折叠] (778KB 854B)
|
|
288
|
+
📁 zh-CN[已折叠] (679KB 97B)
|
|
287
289
|
📁 experiments (3KB 21B)
|
|
288
290
|
🐍 experiment_networkx.py (1KB 908B)
|
|
289
291
|
🐍 experiment_tqdm.py (1KB 137B)
|
|
@@ -292,67 +294,50 @@ flowchart TD
|
|
|
292
294
|
📷 logo(old).png (836KB 542B)
|
|
293
295
|
📷 logo.png (122KB 747B)
|
|
294
296
|
📷 scc_condensation.svg (17KB 1B)
|
|
295
|
-
📁 src (1MB
|
|
296
|
-
📁 celestialflow[已折叠] (1MB
|
|
297
|
-
📁 [1项排除的目录] (
|
|
298
|
-
📁 tests (3MB
|
|
299
|
-
📁
|
|
300
|
-
📁
|
|
301
|
-
📁
|
|
302
|
-
📁
|
|
303
|
-
📁
|
|
304
|
-
📁
|
|
305
|
-
📁
|
|
306
|
-
📁 [
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
297
|
+
📁 src (1MB 661KB 60B)
|
|
298
|
+
📁 celestialflow[已折叠] (1MB 641KB 309B)
|
|
299
|
+
📁 [1项排除的目录] (19KB 775B)
|
|
300
|
+
📁 tests (3MB 65KB 73B)
|
|
301
|
+
📁 assembly[已折叠] (42KB 929B)
|
|
302
|
+
📁 benchmark[已折叠] (41KB 377B)
|
|
303
|
+
📁 funnel[已折叠] (96KB 339B)
|
|
304
|
+
📁 graph[已折叠] (803KB 239B)
|
|
305
|
+
📁 node[已折叠] (510KB 93B)
|
|
306
|
+
📁 observer[已折叠] (122KB 937B)
|
|
307
|
+
📁 persist[已折叠] (186KB 828B)
|
|
308
|
+
📁 persistence[已折叠] (381KB 89B)
|
|
309
|
+
📁 reporter[已折叠] (173KB 986B)
|
|
310
|
+
📁 runtime[已折叠] (189KB 800B)
|
|
311
|
+
📁 ticker[已折叠] (54KB 761B)
|
|
312
|
+
📁 [3项排除的目录] (532KB 170B)
|
|
313
|
+
🐍 conftest.py (1KB 693B)
|
|
314
|
+
📁 [13项排除的目录] (546MB 860KB 667B)
|
|
315
|
+
❓ .env (484B)
|
|
310
316
|
❓ .gitignore (1KB 315B)
|
|
311
|
-
📝 AGENTS.md (
|
|
317
|
+
📝 AGENTS.md (2KB 800B)
|
|
312
318
|
❓ LICENSE (1KB 65B)
|
|
313
319
|
❓ Makefile (149B)
|
|
314
|
-
⚙️ pyproject.toml (2KB
|
|
315
|
-
📝 README.md (
|
|
316
|
-
🔒 uv.lock (
|
|
320
|
+
⚙️ pyproject.toml (2KB 624B)
|
|
321
|
+
📝 README.md (16KB 321B)
|
|
322
|
+
🔒 uv.lock (126KB 837B)
|
|
317
323
|
```
|
|
318
324
|
<p align="center">
|
|
319
|
-
<em>celestial-flow 3.3.
|
|
325
|
+
<em>celestial-flow 3.3.3</em>
|
|
320
326
|
</p>
|
|
321
327
|
|
|
322
328
|
(该视图由我的另一个项目[CelestialVault](https://github.com/Mr-xiaotian/CelestialVault)中inst_file.FileTree.print_tree()生成。转换为图片则借助[Carbon](https://carbon.now.sh)。)
|
|
323
329
|
|
|
324
330
|
## 版本日志(Version Log)
|
|
325
|
-
- 3.3.
|
|
331
|
+
- 3.3.3
|
|
326
332
|
- feat:
|
|
327
|
-
-
|
|
328
|
-
|
|
329
|
-
- 同步更新web端, 现在web端的结构图中可以显示精确的上下游传送任务数量
|
|
330
|
-
- [IMPORTANT] 删除 `duplocate` 机制
|
|
331
|
-
- 这是非常 非常艰难的选择, `duplocate` 机制极其古老, 但在我的仔细评估后我认为问题有三:
|
|
332
|
-
- 1. 传入的任务未必hash able, 现有的hash函数不确定性极大
|
|
333
|
-
- 2. 如果要确保任务可hash, 最好单独传一个处理任务的func, 但这会添加node的参数复杂度
|
|
334
|
-
- 3. 同时duplocate在单node时完全可以被任务输入前的筛选来取代, 而graph时的收益的则非常不明显
|
|
335
|
-
- 反复考虑认为还是遵从简洁的第一性原则
|
|
336
|
-
- 简化 `log.task_success` 输出, 不再显示 `execution_mode`
|
|
337
|
-
- 在 `lifecycle` 中添加 `retry_time` 字段
|
|
338
|
-
- 添加一个开箱即用的 `observer`, `ObserverPrint`
|
|
339
|
-
- 在graph环境下显示的 `total` 会有问题, 下个版本解决
|
|
333
|
+
- 在 `GraphEndEvent` / `NodeEndEvent` 中添加 `end_time`
|
|
334
|
+
- 在 `GraphStartEvent` 中删除 `class_name`
|
|
340
335
|
- refactor:
|
|
341
|
-
-
|
|
342
|
-
-
|
|
343
|
-
-
|
|
344
|
-
- 在 `TaskNode` 中添加新的泛型 `Y`, 表示向下游传输的任务类型
|
|
345
|
-
- 这是为了优化 `splitter` 和 `router`
|
|
346
|
-
- 节点的 `elapsed_time` 现在由 `dispatch` 来自行计算, 保证精准
|
|
347
|
-
- 话说我之前为什么要弄那么一套即麻烦又不准的算法?
|
|
348
|
-
- 在 `reporter` 中为 `status` 添加门控, 如果当前状态与上一次发送状态一致, 则不进行发送
|
|
349
|
-
- 至此 `reporter` 中所有的 `push_*` 都拥有门控, 避免无效的数据发送
|
|
336
|
+
- 移除部分无用的observer事件, 如 `on_worker_crash`
|
|
337
|
+
- 将log与reporter设置从 `.toml` 中移到运行时配置中
|
|
338
|
+
- 删除部分无用的sqlite函数
|
|
350
339
|
- fix:
|
|
351
|
-
|
|
352
|
-
- 添加 `bench_funnel_vs_lock`, 用来测试并发环境下, 使用funnel和使用locl记录数据的性能差
|
|
353
|
-
- 前者发送延迟低, 但内存占用高
|
|
354
|
-
- 
|
|
355
|
-
- 添加 `demo_web`, 用于进行复杂结构的web演示
|
|
340
|
+
- 修复图分析缓存的问题
|
|
356
341
|
|
|
357
342
|
更多过往日志可看:
|
|
358
343
|
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "celestialflow"
|
|
7
|
-
version = "3.3.
|
|
7
|
+
version = "3.3.3"
|
|
8
8
|
description = "A flexible GRAPH-based task orchestration framework."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = { text = "MIT" }
|
|
@@ -59,9 +59,6 @@ dev = [
|
|
|
59
59
|
"tqdm",
|
|
60
60
|
]
|
|
61
61
|
|
|
62
|
-
[tool.celestialflow]
|
|
63
|
-
log_level = "INFO"
|
|
64
|
-
|
|
65
62
|
[tool.pyright]
|
|
66
63
|
include = ["src"]
|
|
67
64
|
ignore = ["tests", "**/tests/**", "typings", "demo", "bench", "experiments", "examples", "temp"]
|
|
@@ -20,19 +20,20 @@ from .node import (
|
|
|
20
20
|
TaskRouter,
|
|
21
21
|
TaskSplitter,
|
|
22
22
|
)
|
|
23
|
-
from .
|
|
24
|
-
from .
|
|
25
|
-
|
|
26
|
-
load_tasks_grouped_by_stage,
|
|
27
|
-
)
|
|
23
|
+
from .observer import Observer, ObserverHub, PrintObserver
|
|
24
|
+
from .persist.util_sqlite import load_tasks_grouped_by_node
|
|
25
|
+
from .runtime import ReportConfig
|
|
28
26
|
from .runtime.util_format import format_table
|
|
29
27
|
from .runtime.util_types import TerminationSignal
|
|
28
|
+
from .ticker import Ticker, TickEvent, TickHandler, TickHub
|
|
30
29
|
|
|
31
30
|
__all__ = [
|
|
32
31
|
"BaseInlet",
|
|
33
|
-
"BaseObserver",
|
|
34
32
|
"BaseSpout",
|
|
33
|
+
"Observer",
|
|
34
|
+
"ObserverHub",
|
|
35
35
|
"PrintObserver",
|
|
36
|
+
"ReportConfig",
|
|
36
37
|
"TaskChain",
|
|
37
38
|
"TaskComplete",
|
|
38
39
|
"TaskCross",
|
|
@@ -40,14 +41,16 @@ __all__ = [
|
|
|
40
41
|
"TaskGraph",
|
|
41
42
|
"TaskGrid",
|
|
42
43
|
"TaskLoop",
|
|
43
|
-
"TaskReporter",
|
|
44
44
|
"TaskRouter",
|
|
45
45
|
"TaskSplitter",
|
|
46
46
|
"TaskWheel",
|
|
47
47
|
"TerminationSignal",
|
|
48
|
+
"TickEvent",
|
|
49
|
+
"TickHandler",
|
|
50
|
+
"TickHub",
|
|
51
|
+
"Ticker",
|
|
48
52
|
"benchmark_executor",
|
|
49
53
|
"benchmark_graph",
|
|
50
54
|
"format_table",
|
|
51
|
-
"
|
|
52
|
-
"load_tasks_grouped_by_stage",
|
|
55
|
+
"load_tasks_grouped_by_node",
|
|
53
56
|
]
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# assembly/__init__.py
|
|
2
|
+
"""CelestialFlow 运行期资源装配模块。
|
|
3
|
+
|
|
4
|
+
负责把 lifecycle / log / 上报三类全局 funnel 观察者注册到运行期 hub,
|
|
5
|
+
并统一管理其 spout 的启停。
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from .core_run import run_graph_resources, run_node_resources
|
|
9
|
+
|
|
10
|
+
__all__ = [
|
|
11
|
+
"run_graph_resources",
|
|
12
|
+
"run_node_resources",
|
|
13
|
+
]
|