celestialflow 3.3.0__tar.gz → 3.3.1__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 (55) hide show
  1. {celestialflow-3.3.0/src/celestialflow.egg-info → celestialflow-3.3.1}/PKG-INFO +64 -56
  2. {celestialflow-3.3.0 → celestialflow-3.3.1}/README.md +63 -55
  3. {celestialflow-3.3.0 → celestialflow-3.3.1}/pyproject.toml +1 -1
  4. {celestialflow-3.3.0 → celestialflow-3.3.1}/src/celestialflow/__init__.py +2 -3
  5. {celestialflow-3.3.0 → celestialflow-3.3.1}/src/celestialflow/benchmark/util_clone.py +0 -1
  6. {celestialflow-3.3.0 → celestialflow-3.3.1}/src/celestialflow/graph/core_graph.py +13 -71
  7. {celestialflow-3.3.0 → celestialflow-3.3.1}/src/celestialflow/node/core_dispatch.py +21 -28
  8. {celestialflow-3.3.0 → celestialflow-3.3.1}/src/celestialflow/node/core_node.py +52 -99
  9. celestialflow-3.3.1/src/celestialflow/node/core_nodes.py +201 -0
  10. {celestialflow-3.3.0 → celestialflow-3.3.1}/src/celestialflow/node/util_types.py +1 -1
  11. {celestialflow-3.3.0 → celestialflow-3.3.1}/src/celestialflow/observability/__init__.py +2 -0
  12. {celestialflow-3.3.0 → celestialflow-3.3.1}/src/celestialflow/observability/core_observer.py +3 -6
  13. celestialflow-3.3.1/src/celestialflow/observability/core_observer_print.py +86 -0
  14. {celestialflow-3.3.0 → celestialflow-3.3.1}/src/celestialflow/observability/core_report.py +33 -37
  15. {celestialflow-3.3.0 → celestialflow-3.3.1}/src/celestialflow/observability/util_types.py +6 -2
  16. {celestialflow-3.3.0 → celestialflow-3.3.1}/src/celestialflow/persistence/core_lifecycle.py +35 -12
  17. {celestialflow-3.3.0 → celestialflow-3.3.1}/src/celestialflow/persistence/core_log.py +10 -97
  18. {celestialflow-3.3.0 → celestialflow-3.3.1}/src/celestialflow/persistence/util_sqlite.py +53 -5
  19. celestialflow-3.3.1/src/celestialflow/runtime/core_envelope.py +38 -0
  20. {celestialflow-3.3.0 → celestialflow-3.3.1}/src/celestialflow/runtime/core_metrics.py +143 -91
  21. {celestialflow-3.3.0 → celestialflow-3.3.1}/src/celestialflow/runtime/core_queue.py +5 -5
  22. {celestialflow-3.3.0 → celestialflow-3.3.1}/src/celestialflow/runtime/util_types.py +6 -72
  23. {celestialflow-3.3.0 → celestialflow-3.3.1/src/celestialflow.egg-info}/PKG-INFO +64 -56
  24. {celestialflow-3.3.0 → celestialflow-3.3.1}/src/celestialflow.egg-info/SOURCES.txt +1 -3
  25. celestialflow-3.3.0/src/celestialflow/graph/util_estimators.py +0 -94
  26. celestialflow-3.3.0/src/celestialflow/node/core_nodes.py +0 -332
  27. celestialflow-3.3.0/src/celestialflow/runtime/core_envelope.py +0 -60
  28. celestialflow-3.3.0/src/celestialflow/runtime/util_estimators.py +0 -68
  29. celestialflow-3.3.0/src/celestialflow/runtime/util_hash.py +0 -39
  30. {celestialflow-3.3.0 → celestialflow-3.3.1}/LICENSE +0 -0
  31. {celestialflow-3.3.0 → celestialflow-3.3.1}/setup.cfg +0 -0
  32. {celestialflow-3.3.0 → celestialflow-3.3.1}/src/celestialflow/benchmark/__init__.py +0 -0
  33. {celestialflow-3.3.0 → celestialflow-3.3.1}/src/celestialflow/benchmark/util_benchmark.py +0 -0
  34. {celestialflow-3.3.0 → celestialflow-3.3.1}/src/celestialflow/funnel/__init__.py +0 -0
  35. {celestialflow-3.3.0 → celestialflow-3.3.1}/src/celestialflow/funnel/core_inlet.py +0 -0
  36. {celestialflow-3.3.0 → celestialflow-3.3.1}/src/celestialflow/funnel/core_spout.py +0 -0
  37. {celestialflow-3.3.0 → celestialflow-3.3.1}/src/celestialflow/funnel/util_count.py +0 -0
  38. {celestialflow-3.3.0 → celestialflow-3.3.1}/src/celestialflow/graph/__init__.py +0 -0
  39. {celestialflow-3.3.0 → celestialflow-3.3.1}/src/celestialflow/graph/core_structure.py +0 -0
  40. {celestialflow-3.3.0 → celestialflow-3.3.1}/src/celestialflow/graph/util_order_graph.py +0 -0
  41. {celestialflow-3.3.0 → celestialflow-3.3.1}/src/celestialflow/graph/util_render.py +0 -0
  42. {celestialflow-3.3.0 → celestialflow-3.3.1}/src/celestialflow/node/__init__.py +0 -0
  43. {celestialflow-3.3.0 → celestialflow-3.3.1}/src/celestialflow/node/util_callable.py +0 -0
  44. {celestialflow-3.3.0 → celestialflow-3.3.1}/src/celestialflow/persistence/__init__.py +0 -0
  45. {celestialflow-3.3.0 → celestialflow-3.3.1}/src/celestialflow/persistence/core_scope.py +0 -0
  46. {celestialflow-3.3.0 → celestialflow-3.3.1}/src/celestialflow/persistence/util_payload.py +0 -0
  47. {celestialflow-3.3.0 → celestialflow-3.3.1}/src/celestialflow/runtime/__init__.py +0 -0
  48. {celestialflow-3.3.0 → celestialflow-3.3.1}/src/celestialflow/runtime/util_config.py +0 -0
  49. {celestialflow-3.3.0 → celestialflow-3.3.1}/src/celestialflow/runtime/util_constant.py +0 -0
  50. {celestialflow-3.3.0 → celestialflow-3.3.1}/src/celestialflow/runtime/util_errors.py +0 -0
  51. {celestialflow-3.3.0 → celestialflow-3.3.1}/src/celestialflow/runtime/util_event.py +0 -0
  52. {celestialflow-3.3.0 → celestialflow-3.3.1}/src/celestialflow/runtime/util_format.py +0 -0
  53. {celestialflow-3.3.0 → celestialflow-3.3.1}/src/celestialflow.egg-info/dependency_links.txt +0 -0
  54. {celestialflow-3.3.0 → celestialflow-3.3.1}/src/celestialflow.egg-info/requires.txt +0 -0
  55. {celestialflow-3.3.0 → celestialflow-3.3.1}/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.0
3
+ Version: 3.3.1
4
4
  Summary: A flexible GRAPH-based task orchestration framework.
5
5
  Author-email: Mr-xiaotian <mingxiaomingtian@gmail.com>
6
6
  License: MIT
@@ -19,6 +19,8 @@ Dynamic: license-file
19
19
 
20
20
  # CelestialFlow ——一个轻量级、可并行、基于图结构的 Python 任务调度框架
21
21
 
22
+ > 📅 最后更新日期: 2026/09/24
23
+
22
24
  <p align="center">
23
25
  <img src="https://raw.githubusercontent.com/Mr-xiaotian/CelestialFlow/main/img/logo.png" width="1080" alt="CelestialFlow Logo">
24
26
  </p>
@@ -263,42 +265,44 @@ flowchart TD
263
265
  ## 文件结构(File Structure)
264
266
 
265
267
  ```
266
- 📁 CelestialFlow (664MB 611KB 462B)
267
- 📁 bench (296KB 101B)
268
+ 📁 CelestialFlow (329MB 507KB 284B)
269
+ 📁 bench (316KB 601B)
268
270
  📁 [1项排除的目录] (194KB 222B)
269
271
  🐍 bench_datastructures.py (6KB 690B)
270
272
  🐍 bench_execution_mode.py (2KB 707B)
273
+ 🐍 bench_funnel_vs_lock.py (21KB 888B)
271
274
  🐍 bench_futures_memory.py (2KB 269B)
272
- 🐍 bench_gil_vs_nogil.py (10KB 101B)
273
- 🐍 bench_graph_mode.py (6KB 774B)
275
+ 🐍 bench_gil_vs_nogil.py (9KB 983B)
276
+ 🐍 bench_graph_mode.py (6KB 614B)
274
277
  🐍 bench_hash.py (7KB 67B)
275
278
  🐍 bench_hash_container.py (3KB 1009B)
276
- 🐍 bench_hash_memory.py (3KB 642B)
279
+ 🐍 bench_hash_memory.py (3KB 655B)
277
280
  🐍 bench_http_grpc.py (2KB 536B)
278
281
  🐍 bench_ipc_queue.py (7KB 104B)
279
282
  🐍 bench_lock_overhead.py (9KB 421B)
280
283
  🐍 bench_mpqueue_vs_shared_memory.py (13KB 127B)
281
- 🐍 bench_observer.py (7KB 860B)
284
+ 🐍 bench_observer.py (6KB 761B)
282
285
  🐍 bench_persistence_spout.py (4KB 340B)
283
286
  🐍 bench_queue.py (5KB 857B)
284
287
  🐍 bench_requests.py (6KB 813B)
285
288
  🐍 bench_tqdm.py (1KB 235B)
286
289
  🐍 bench_utils.py (543B)
287
- 📁 demo (146KB 197B)
288
- 📁 [1项排除的目录] (100KB 9B)
290
+ 📁 demo (353KB 885B)
291
+ 📁 [3项排除的目录] (302KB 399B)
289
292
  🐍 demo_executor.py (1KB 495B)
290
293
  🐍 demo_funnel.py (2KB 289B)
291
294
  🐍 demo_graph.py (3KB 222B)
292
295
  🐍 demo_network.py (3KB 756B)
293
- 🐍 demo_nodes.py (4KB 212B)
294
- 🐍 demo_observer.py (4KB 270B)
295
- 🐍 demo_redis.py (9KB 131B)
296
- 🐍 demo_structure.py (11KB 737B)
297
- 🐍 demo_utils.py (6KB 148B)
298
- 📁 docs (1MB 914KB 89B)
299
- 📁 en[已折叠] (632KB 604B)
300
- 📁 ja[已折叠] (718KB 778B)
301
- 📁 zh-CN[已折叠] (586KB 755B)
296
+ 🐍 demo_nodes.py (4KB 231B)
297
+ 🐍 demo_observer.py (2KB 684B)
298
+ 🐍 demo_redis.py (8KB 999B)
299
+ 🐍 demo_structure.py (9KB 290B)
300
+ 🐍 demo_utils.py (6KB 263B)
301
+ 🐍 demo_web.py (9KB 353B)
302
+ 📁 docs (2MB 52KB 639B)
303
+ 📁 en[已折叠] (689KB 420B)
304
+ 📁 ja[已折叠] (788KB 350B)
305
+ 📁 zh-CN[已折叠] (622KB 893B)
302
306
  📁 experiments (3KB 21B)
303
307
  🐍 experiment_networkx.py (1KB 908B)
304
308
  🐍 experiment_tqdm.py (1KB 137B)
@@ -307,63 +311,67 @@ flowchart TD
307
311
  📷 logo(old).png (836KB 542B)
308
312
  📷 logo.png (122KB 747B)
309
313
  📷 scc_condensation.svg (17KB 1B)
310
- 📁 src (1MB 822KB 642B)
311
- 📁 celestialflow[已折叠] (1MB 822KB 642B)
312
- 📁 tests (4MB 290KB 989B)
314
+ 📁 src (1MB 829KB 441B)
315
+ 📁 celestialflow[已折叠] (1MB 809KB 299B)
316
+ 📁 [1项排除的目录] (20KB 142B)
317
+ 📁 tests (3MB 653KB 168B)
313
318
  📁 benchmark[已折叠] (45KB 270B)
314
319
  📁 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
+ 📁 graph[已折叠] (723KB 325B)
321
+ 📁 node[已折叠] (461KB 925B)
322
+ 📁 observability[已折叠] (221KB 746B)
323
+ 📁 persistence[已折叠] (410KB 135B)
324
+ 📁 runtime[已折叠] (1MB 253KB 849B)
320
325
  📁 [1项排除的目录] (487KB 637B)
321
326
  🐍 conftest.py (1KB 38B)
322
- 📁 [12项排除的目录] (650MB 21KB 212B)
327
+ 📁 [13项排除的目录] (315MB 353KB 422B)
323
328
  ❓ .env (468B)
324
329
  ❓ .gitignore (1KB 315B)
325
- 📝 AGENTS.md (1KB 434B)
330
+ 📝 AGENTS.md (1KB 576B)
326
331
  ❓ LICENSE (1KB 65B)
327
332
  ❓ Makefile (149B)
328
333
  ⚙️ pyproject.toml (2KB 668B)
329
- 📝 README.md (17KB 298B)
330
- 🔒 uv.lock (120KB 752B)
334
+ 📝 README.md (18KB 12B)
335
+ 🔒 uv.lock (120KB 756B)
331
336
  ```
332
337
  <p align="center">
333
- <em>celestial-flow 3.3.0</em>
338
+ <em>celestial-flow 3.3.1</em>
334
339
  </p>
335
340
 
336
341
  (该视图由我的另一个项目[CelestialVault](https://github.com/Mr-xiaotian/CelestialVault)中inst_file.FileTree.print_tree()生成。转换为图片则借助[Carbon](https://carbon.now.sh)。)
337
342
 
338
343
  ## 版本日志(Version Log)
339
- - 3.3.0
344
+ - 3.3.1
340
345
  - feat:
341
- - 现在 `TaskExecutor` 中完全删除了 `func_name` 参数
342
- - 在有 `executor_name` 表达节点后, 这层暴露是不必要的
343
- - 同时也是为了与 `CelestialGraw` 的状态做统一
344
- - 在向 `reporter` 发送状态时, 包含图的 `class_name` 信息
345
- - 移除 `OrderGraph` 中的 `from_edges` 方法
346
+ - [IMPORTANT] 在 `TaskMetrics` 中添加 `upstream_counter` / `downstream_counter` 细致化记录上下游传输数据量
347
+ - 在 `reporter` 中传送节点的 `upstream_counter` / `downstream_counter`
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` 会有问题, 下个版本解决
346
359
  - refactor:
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 端一致
360
+ - [IMPORTANT] 大幅简化 `reporter` 中的数据, 现在只传输原始状态数据, 具体的分析交给前端完成
361
+ - 移除 `log.split_trace` / `log.split_success` / `log.route_success`, 并统一使用 `log.task_in` 来表达下游任务成功
362
+ - 移除 `node.get_binding_counter` 和 `node.prev_binding`, 并添加 `node.connect_to` 统一负责绑定上下游节点
363
+ - 在 `TaskNode` 中添加新的泛型 `Y`, 表示向下游传输的任务类型
364
+ - 这是为了优化 `splitter` 和 `router`
365
+ - 节点的 `elapsed_time` 现在由 `dispatch` 来自行计算, 保证精准
366
+ - 话说我之前为什么要弄那么一套即麻烦又不准的算法?
367
+ - 在 `reporter` 中为 `status` 添加门控, 如果当前状态与上一次发送状态一致, 则不进行发送
368
+ - 至此 `reporter` 中所有的 `push_*` 都拥有门控, 避免无效的数据发送
362
369
  - fix:
363
- - 修复 `execution_mode = async` 时, worker崩溃被忽略的问题
364
- - 修复任务重试日志中 `retry_times` 的含义模糊, 现在使用 `fail_times`
365
- - 修复 reporter 的 `_push_*` 方法中, 不处理返回值的问题
366
- - 修复 `TaskReporter._pull_injection` 中, 对拉取的任务列表错误 `put_task` 的问题
370
+ - chore:
371
+ - 添加 `bench_funnel_vs_lock`, 用来测试并发环境下, 使用funnel和使用locl记录数据的性能差
372
+ - 前者发送延迟低, 但内存占用高
373
+ - ![bench/bench_funnel_vs_lock.md](https://github.com/Mr-xiaotian/CelestialFlow/blob/main/docs/zh-CN/bench/bench_funnel_vs_lock.md)
374
+ - 添加 `demo_web`, 用于进行复杂结构的web演示
367
375
 
368
376
  更多过往日志可看:
369
377
 
@@ -1,5 +1,7 @@
1
1
  # CelestialFlow ——一个轻量级、可并行、基于图结构的 Python 任务调度框架
2
2
 
3
+ > 📅 最后更新日期: 2026/09/24
4
+
3
5
  <p align="center">
4
6
  <img src="https://raw.githubusercontent.com/Mr-xiaotian/CelestialFlow/main/img/logo.png" width="1080" alt="CelestialFlow Logo">
5
7
  </p>
@@ -244,42 +246,44 @@ flowchart TD
244
246
  ## 文件结构(File Structure)
245
247
 
246
248
  ```
247
- 📁 CelestialFlow (664MB 611KB 462B)
248
- 📁 bench (296KB 101B)
249
+ 📁 CelestialFlow (329MB 507KB 284B)
250
+ 📁 bench (316KB 601B)
249
251
  📁 [1项排除的目录] (194KB 222B)
250
252
  🐍 bench_datastructures.py (6KB 690B)
251
253
  🐍 bench_execution_mode.py (2KB 707B)
254
+ 🐍 bench_funnel_vs_lock.py (21KB 888B)
252
255
  🐍 bench_futures_memory.py (2KB 269B)
253
- 🐍 bench_gil_vs_nogil.py (10KB 101B)
254
- 🐍 bench_graph_mode.py (6KB 774B)
256
+ 🐍 bench_gil_vs_nogil.py (9KB 983B)
257
+ 🐍 bench_graph_mode.py (6KB 614B)
255
258
  🐍 bench_hash.py (7KB 67B)
256
259
  🐍 bench_hash_container.py (3KB 1009B)
257
- 🐍 bench_hash_memory.py (3KB 642B)
260
+ 🐍 bench_hash_memory.py (3KB 655B)
258
261
  🐍 bench_http_grpc.py (2KB 536B)
259
262
  🐍 bench_ipc_queue.py (7KB 104B)
260
263
  🐍 bench_lock_overhead.py (9KB 421B)
261
264
  🐍 bench_mpqueue_vs_shared_memory.py (13KB 127B)
262
- 🐍 bench_observer.py (7KB 860B)
265
+ 🐍 bench_observer.py (6KB 761B)
263
266
  🐍 bench_persistence_spout.py (4KB 340B)
264
267
  🐍 bench_queue.py (5KB 857B)
265
268
  🐍 bench_requests.py (6KB 813B)
266
269
  🐍 bench_tqdm.py (1KB 235B)
267
270
  🐍 bench_utils.py (543B)
268
- 📁 demo (146KB 197B)
269
- 📁 [1项排除的目录] (100KB 9B)
271
+ 📁 demo (353KB 885B)
272
+ 📁 [3项排除的目录] (302KB 399B)
270
273
  🐍 demo_executor.py (1KB 495B)
271
274
  🐍 demo_funnel.py (2KB 289B)
272
275
  🐍 demo_graph.py (3KB 222B)
273
276
  🐍 demo_network.py (3KB 756B)
274
- 🐍 demo_nodes.py (4KB 212B)
275
- 🐍 demo_observer.py (4KB 270B)
276
- 🐍 demo_redis.py (9KB 131B)
277
- 🐍 demo_structure.py (11KB 737B)
278
- 🐍 demo_utils.py (6KB 148B)
279
- 📁 docs (1MB 914KB 89B)
280
- 📁 en[已折叠] (632KB 604B)
281
- 📁 ja[已折叠] (718KB 778B)
282
- 📁 zh-CN[已折叠] (586KB 755B)
277
+ 🐍 demo_nodes.py (4KB 231B)
278
+ 🐍 demo_observer.py (2KB 684B)
279
+ 🐍 demo_redis.py (8KB 999B)
280
+ 🐍 demo_structure.py (9KB 290B)
281
+ 🐍 demo_utils.py (6KB 263B)
282
+ 🐍 demo_web.py (9KB 353B)
283
+ 📁 docs (2MB 52KB 639B)
284
+ 📁 en[已折叠] (689KB 420B)
285
+ 📁 ja[已折叠] (788KB 350B)
286
+ 📁 zh-CN[已折叠] (622KB 893B)
283
287
  📁 experiments (3KB 21B)
284
288
  🐍 experiment_networkx.py (1KB 908B)
285
289
  🐍 experiment_tqdm.py (1KB 137B)
@@ -288,63 +292,67 @@ flowchart TD
288
292
  📷 logo(old).png (836KB 542B)
289
293
  📷 logo.png (122KB 747B)
290
294
  📷 scc_condensation.svg (17KB 1B)
291
- 📁 src (1MB 822KB 642B)
292
- 📁 celestialflow[已折叠] (1MB 822KB 642B)
293
- 📁 tests (4MB 290KB 989B)
295
+ 📁 src (1MB 829KB 441B)
296
+ 📁 celestialflow[已折叠] (1MB 809KB 299B)
297
+ 📁 [1项排除的目录] (20KB 142B)
298
+ 📁 tests (3MB 653KB 168B)
294
299
  📁 benchmark[已折叠] (45KB 270B)
295
300
  📁 funnel[已折叠] (96KB 339B)
296
- 📁 graph[已折叠] (768KB 424B)
297
- 📁 node[已折叠] (451KB 840B)
298
- 📁 observability[已折叠] (188KB 1001B)
299
- 📁 persistence[已折叠] (393KB 151B)
300
- 📁 runtime[已折叠] (1MB 290KB 858B)
301
+ 📁 graph[已折叠] (723KB 325B)
302
+ 📁 node[已折叠] (461KB 925B)
303
+ 📁 observability[已折叠] (221KB 746B)
304
+ 📁 persistence[已折叠] (410KB 135B)
305
+ 📁 runtime[已折叠] (1MB 253KB 849B)
301
306
  📁 [1项排除的目录] (487KB 637B)
302
307
  🐍 conftest.py (1KB 38B)
303
- 📁 [12项排除的目录] (650MB 21KB 212B)
308
+ 📁 [13项排除的目录] (315MB 353KB 422B)
304
309
  ❓ .env (468B)
305
310
  ❓ .gitignore (1KB 315B)
306
- 📝 AGENTS.md (1KB 434B)
311
+ 📝 AGENTS.md (1KB 576B)
307
312
  ❓ LICENSE (1KB 65B)
308
313
  ❓ Makefile (149B)
309
314
  ⚙️ pyproject.toml (2KB 668B)
310
- 📝 README.md (17KB 298B)
311
- 🔒 uv.lock (120KB 752B)
315
+ 📝 README.md (18KB 12B)
316
+ 🔒 uv.lock (120KB 756B)
312
317
  ```
313
318
  <p align="center">
314
- <em>celestial-flow 3.3.0</em>
319
+ <em>celestial-flow 3.3.1</em>
315
320
  </p>
316
321
 
317
322
  (该视图由我的另一个项目[CelestialVault](https://github.com/Mr-xiaotian/CelestialVault)中inst_file.FileTree.print_tree()生成。转换为图片则借助[Carbon](https://carbon.now.sh)。)
318
323
 
319
324
  ## 版本日志(Version Log)
320
- - 3.3.0
325
+ - 3.3.1
321
326
  - feat:
322
- - 现在 `TaskExecutor` 中完全删除了 `func_name` 参数
323
- - 在有 `executor_name` 表达节点后, 这层暴露是不必要的
324
- - 同时也是为了与 `CelestialGraw` 的状态做统一
325
- - 在向 `reporter` 发送状态时, 包含图的 `class_name` 信息
326
- - 移除 `OrderGraph` 中的 `from_edges` 方法
327
+ - [IMPORTANT] 在 `TaskMetrics` 中添加 `upstream_counter` / `downstream_counter` 细致化记录上下游传输数据量
328
+ - 在 `reporter` 中传送节点的 `upstream_counter` / `downstream_counter`
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` 会有问题, 下个版本解决
327
340
  - refactor:
328
- - [IMPORTANT] 重构原有的 `executor/stage` 结构
329
- - 原本为 `executor -> stage -> splitter/router`, 三层结构过于复杂
330
- - 现在删除 `stage` 层, 添加 `BaseTaskNode`, 作为 graph 唯一识别的节点, 而 `executor` 视为与 `splitter/router` 同级别的节点
331
- - 当前结构为 `BaseTaskNode -> executor/splitter/router`
332
- - 重构 `render_structure_list`(原 `format_structure_list_from_graph`) 的实现
333
- - 现在使用广度优先, 而不是原先的递归
334
- - 同时输入参数直接使用 `list[str]` 形式的节点名称列表, 这意味着不再显示 `func_name` `execution_mode` 等信息
335
- - 修改原本对于 `collect_runtime_snapshot` 奇怪的调用方式
336
- - 现在reporter端会在 `_push_status` 中直接调用 `collect_runtime_snapshot`
337
- - 删除 `TaskExecutor` 中的 `get_summary`, 这层包装实际上是多余的
338
- - 同时所有的 `event_client.emit` 也不再附带 `summary` 信息
339
- - 删除 `OrderGraph` 中的 `_node` 参数
340
- - 之前这个参数提供: 所有节点名称; 节点的插入顺序
341
- - 现在前者由 `_out` 提供, 后者不再重视
342
- - `LifecycleInlet` 中的 `task_in` 改名为 `task_input`, 保持与 log 端一致
341
+ - [IMPORTANT] 大幅简化 `reporter` 中的数据, 现在只传输原始状态数据, 具体的分析交给前端完成
342
+ - 移除 `log.split_trace` / `log.split_success` / `log.route_success`, 并统一使用 `log.task_in` 来表达下游任务成功
343
+ - 移除 `node.get_binding_counter` 和 `node.prev_binding`, 并添加 `node.connect_to` 统一负责绑定上下游节点
344
+ - 在 `TaskNode` 中添加新的泛型 `Y`, 表示向下游传输的任务类型
345
+ - 这是为了优化 `splitter` 和 `router`
346
+ - 节点的 `elapsed_time` 现在由 `dispatch` 来自行计算, 保证精准
347
+ - 话说我之前为什么要弄那么一套即麻烦又不准的算法?
348
+ - 在 `reporter` 中为 `status` 添加门控, 如果当前状态与上一次发送状态一致, 则不进行发送
349
+ - 至此 `reporter` 中所有的 `push_*` 都拥有门控, 避免无效的数据发送
343
350
  - fix:
344
- - 修复 `execution_mode = async` 时, worker崩溃被忽略的问题
345
- - 修复任务重试日志中 `retry_times` 的含义模糊, 现在使用 `fail_times`
346
- - 修复 reporter 的 `_push_*` 方法中, 不处理返回值的问题
347
- - 修复 `TaskReporter._pull_injection` 中, 对拉取的任务列表错误 `put_task` 的问题
351
+ - chore:
352
+ - 添加 `bench_funnel_vs_lock`, 用来测试并发环境下, 使用funnel和使用locl记录数据的性能差
353
+ - 前者发送延迟低, 但内存占用高
354
+ - ![bench/bench_funnel_vs_lock.md](https://github.com/Mr-xiaotian/CelestialFlow/blob/main/docs/zh-CN/bench/bench_funnel_vs_lock.md)
355
+ - 添加 `demo_web`, 用于进行复杂结构的web演示
348
356
 
349
357
  更多过往日志可看:
350
358
 
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "celestialflow"
7
- version = "3.3.0"
7
+ version = "3.3.1"
8
8
  description = "A flexible GRAPH-based task orchestration framework."
9
9
  readme = "README.md"
10
10
  license = { text = "MIT" }
@@ -20,19 +20,19 @@ from .node import (
20
20
  TaskRouter,
21
21
  TaskSplitter,
22
22
  )
23
- from .observability import BaseObserver, TaskReporter
23
+ from .observability import BaseObserver, PrintObserver, TaskReporter
24
24
  from .persistence.util_sqlite import (
25
25
  load_records,
26
26
  load_tasks_grouped_by_stage,
27
27
  )
28
28
  from .runtime.util_format import format_table
29
- from .runtime.util_hash import make_hashable
30
29
  from .runtime.util_types import TerminationSignal
31
30
 
32
31
  __all__ = [
33
32
  "BaseInlet",
34
33
  "BaseObserver",
35
34
  "BaseSpout",
35
+ "PrintObserver",
36
36
  "TaskChain",
37
37
  "TaskComplete",
38
38
  "TaskCross",
@@ -50,5 +50,4 @@ __all__ = [
50
50
  "format_table",
51
51
  "load_records",
52
52
  "load_tasks_grouped_by_stage",
53
- "make_hashable",
54
53
  ]
@@ -29,7 +29,6 @@ def _get_clone_init_kwargs[T, R](
29
29
  "max_workers": executor.max_workers,
30
30
  "max_retries": executor.max_retries,
31
31
  "max_info": executor.max_info,
32
- "enable_duplicate_check": executor.enable_duplicate_check,
33
32
  }
34
33
 
35
34
 
@@ -18,10 +18,8 @@ from ..runtime.util_errors import (
18
18
  InvalidOptionError,
19
19
  NodeNotFoundError,
20
20
  )
21
- from ..runtime.util_estimators import calc_remaining
22
21
  from ..runtime.util_event import EventClient, LocalEventClient
23
22
  from ..runtime.util_format import cluster_by_value_sorted
24
- from .util_estimators import calc_global_pending
25
23
  from .util_order_graph import OrderGraph, compute_node_levels, is_dag, source_nodes
26
24
  from .util_render import render_structure_list
27
25
 
@@ -134,21 +132,15 @@ class TaskGraph:
134
132
  """
135
133
  for from_node in from_nodes:
136
134
  from_name = from_node.get_name()
137
- from_out_queue = from_node.result_queue
138
-
139
135
  if from_name not in self.node_dict:
140
136
  raise NodeNotFoundError(f"from node not found: {from_name}")
141
137
 
142
138
  for to_node in to_nodes:
143
139
  to_name = to_node.get_name()
144
- to_in_queue = to_node.task_queue
145
-
146
140
  if to_name not in self.node_dict:
147
141
  raise NodeNotFoundError(f"to node not found: {to_name}")
148
142
 
149
- to_node.prev_binding(from_node)
150
- from_out_queue.add_queue(to_in_queue, to_name)
151
- to_in_queue.add_source_name(from_name)
143
+ from_node.connect_to(to_node)
152
144
  self.order_graph.add_edge(from_name, to_name)
153
145
 
154
146
  self._analysis_dirty = True
@@ -510,68 +502,6 @@ class TaskGraph:
510
502
  else:
511
503
  await asyncio.to_thread(node.start)
512
504
 
513
- # ==== 运行时监控 ====
514
-
515
- def _calc_graph_pending(
516
- self,
517
- running_processed_map: dict[str, int],
518
- running_pending_map: dict[str, int],
519
- ) -> dict[str, int]:
520
- """
521
- 根据 DAG/非 DAG 策略计算全局预计待处理任务数量。
522
-
523
- :param running_processed_map: 各节点已处理任务数
524
- :param running_pending_map: 各节点待处理任务数
525
- :return: 全局预计待处理任务数量
526
- """
527
- if not self.is_dag:
528
- return running_pending_map
529
-
530
- total_pending_map = calc_global_pending(
531
- self.order_graph,
532
- running_processed_map,
533
- running_pending_map,
534
- )
535
- return total_pending_map
536
-
537
- def collect_runtime_snapshot(self) -> tuple[dict[str, Any], float]:
538
- """
539
- 采集一次运行时快照并返回。
540
-
541
- 遍历所有节点采集运行时快照,然后计算 DAG 感知的全局 pending 估算值,
542
- 并补充到每个节点的快照(``total_tasks_pending`` / ``total_remaining_time``)中。
543
-
544
- :return: ``(status_dict, status_timestamp)`` —— 各节点快照字典与统一采集时间戳
545
- """
546
- status_dict: dict[str, dict[str, Any]] = {}
547
- now = time.time()
548
- interval = self.reporter.interval
549
-
550
- # 为全局预计待处理任务数收集数据
551
- running_processed_map: dict[str, int] = {}
552
- running_pending_map: dict[str, int] = {}
553
-
554
- for node_name, node in self.node_dict.items():
555
- snapshot = node.snapshot(interval)
556
- status_dict[node_name] = snapshot
557
-
558
- running_processed_map[node_name] = int(snapshot["tasks_processed"] or 0)
559
- running_pending_map[node_name] = int(snapshot["tasks_pending"] or 0)
560
-
561
- total_pending_map = self._calc_graph_pending(
562
- running_processed_map,
563
- running_pending_map,
564
- )
565
- for node_name, node_status in status_dict.items():
566
- node_status["total_tasks_pending"] = total_pending_map[node_name]
567
- node_status["total_remaining_time"] = calc_remaining(
568
- node_status["tasks_processed"],
569
- node_status["total_tasks_pending"],
570
- node_status["elapsed_time"],
571
- )
572
-
573
- return status_dict, now
574
-
575
505
  # ==== 查询接口 ====
576
506
 
577
507
  def get_graph_id(self) -> str:
@@ -599,6 +529,18 @@ class TaskGraph:
599
529
  """
600
530
  return self.order_graph.out_edges
601
531
 
532
+ def get_node_meta(self) -> dict[str, dict[str, Any]]:
533
+ """
534
+ 获取各节点的构建期元信息。
535
+
536
+ 这些字段在 reporter 启动前已冻结,因此随图结构一次性上报,不进每轮状态推送。
537
+
538
+ :return: ``{node_name: {"class_name": ..., "execution_mode": ..., "max_workers": ...}}``
539
+ """
540
+ return {
541
+ node_name: node.get_meta() for node_name, node in self.node_dict.items()
542
+ }
543
+
602
544
  def get_source_nodes(self) -> list[str]:
603
545
  """
604
546
  获取源节点列表