celestialflow 3.3.3__tar.gz → 3.3.5__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 (78) hide show
  1. {celestialflow-3.3.3/src/celestialflow.egg-info → celestialflow-3.3.5}/PKG-INFO +71 -56
  2. {celestialflow-3.3.3 → celestialflow-3.3.5}/README.md +70 -55
  3. {celestialflow-3.3.3 → celestialflow-3.3.5}/pyproject.toml +1 -1
  4. {celestialflow-3.3.3 → celestialflow-3.3.5}/src/celestialflow/__init__.py +2 -2
  5. celestialflow-3.3.5/src/celestialflow/assembly/__init__.py +13 -0
  6. celestialflow-3.3.5/src/celestialflow/assembly/core_run.py +140 -0
  7. {celestialflow-3.3.3 → celestialflow-3.3.5}/src/celestialflow/benchmark/util_benchmark.py +5 -5
  8. celestialflow-3.3.5/src/celestialflow/benchmark/util_clone.py +127 -0
  9. {celestialflow-3.3.3 → celestialflow-3.3.5}/src/celestialflow/funnel/core_inlet.py +2 -2
  10. {celestialflow-3.3.3 → celestialflow-3.3.5}/src/celestialflow/funnel/core_spout.py +5 -3
  11. {celestialflow-3.3.3 → celestialflow-3.3.5}/src/celestialflow/graph/core_graph.py +104 -45
  12. {celestialflow-3.3.3 → celestialflow-3.3.5}/src/celestialflow/node/core_dispatch.py +1 -1
  13. {celestialflow-3.3.3 → celestialflow-3.3.5}/src/celestialflow/node/core_node.py +89 -38
  14. {celestialflow-3.3.3 → celestialflow-3.3.5}/src/celestialflow/node/core_nodes.py +13 -10
  15. {celestialflow-3.3.3 → celestialflow-3.3.5}/src/celestialflow/observer/__init__.py +3 -1
  16. {celestialflow-3.3.3 → celestialflow-3.3.5}/src/celestialflow/observer/core_event.py +26 -11
  17. celestialflow-3.3.5/src/celestialflow/observer/core_hub.py +166 -0
  18. {celestialflow-3.3.3 → celestialflow-3.3.5}/src/celestialflow/observer/core_metrics.py +56 -82
  19. celestialflow-3.3.5/src/celestialflow/observer/core_observer.py +76 -0
  20. celestialflow-3.3.5/src/celestialflow/observer/core_print.py +79 -0
  21. celestialflow-3.3.5/src/celestialflow/persist/__init__.py +39 -0
  22. celestialflow-3.3.5/src/celestialflow/persist/core_lifecycle.py +495 -0
  23. celestialflow-3.3.5/src/celestialflow/persist/core_log.py +268 -0
  24. {celestialflow-3.3.3 → celestialflow-3.3.5}/src/celestialflow/persist/util_render.py +1 -1
  25. celestialflow-3.3.5/src/celestialflow/persist/util_sqlite.py +624 -0
  26. celestialflow-3.3.5/src/celestialflow/reporter/__init__.py +35 -0
  27. {celestialflow-3.3.3 → celestialflow-3.3.5}/src/celestialflow/reporter/core_inject.py +97 -77
  28. celestialflow-3.3.5/src/celestialflow/reporter/core_push.py +325 -0
  29. celestialflow-3.3.5/src/celestialflow/reporter/core_snapshot.py +52 -0
  30. celestialflow-3.3.5/src/celestialflow/reporter/util_snapshot.py +34 -0
  31. {celestialflow-3.3.3 → celestialflow-3.3.5}/src/celestialflow/runtime/__init__.py +17 -17
  32. {celestialflow-3.3.3 → celestialflow-3.3.5}/src/celestialflow/runtime/util_format.py +17 -6
  33. {celestialflow-3.3.3 → celestialflow-3.3.5}/src/celestialflow/runtime/util_types.py +1 -1
  34. celestialflow-3.3.5/src/celestialflow/ticker/__init__.py +21 -0
  35. celestialflow-3.3.3/src/celestialflow/ticker/core_ticker.py → celestialflow-3.3.5/src/celestialflow/ticker/core_clock.py +59 -79
  36. {celestialflow-3.3.3 → celestialflow-3.3.5}/src/celestialflow/ticker/core_event.py +1 -9
  37. celestialflow-3.3.5/src/celestialflow/ticker/core_hub.py +227 -0
  38. celestialflow-3.3.5/src/celestialflow/ticker/core_ticker.py +108 -0
  39. {celestialflow-3.3.3 → celestialflow-3.3.5/src/celestialflow.egg-info}/PKG-INFO +71 -56
  40. {celestialflow-3.3.3 → celestialflow-3.3.5}/src/celestialflow.egg-info/SOURCES.txt +3 -2
  41. celestialflow-3.3.3/src/celestialflow/assembly/__init__.py +0 -13
  42. celestialflow-3.3.3/src/celestialflow/assembly/core_run.py +0 -147
  43. celestialflow-3.3.3/src/celestialflow/benchmark/util_clone.py +0 -103
  44. celestialflow-3.3.3/src/celestialflow/observer/core_hub.py +0 -260
  45. celestialflow-3.3.3/src/celestialflow/observer/core_observer.py +0 -130
  46. celestialflow-3.3.3/src/celestialflow/observer/core_observer_print.py +0 -98
  47. celestialflow-3.3.3/src/celestialflow/persist/__init__.py +0 -21
  48. celestialflow-3.3.3/src/celestialflow/persist/core_lifecycle.py +0 -213
  49. celestialflow-3.3.3/src/celestialflow/persist/core_log.py +0 -274
  50. celestialflow-3.3.3/src/celestialflow/persist/util_sqlite.py +0 -415
  51. celestialflow-3.3.3/src/celestialflow/reporter/__init__.py +0 -23
  52. celestialflow-3.3.3/src/celestialflow/reporter/core_push.py +0 -259
  53. celestialflow-3.3.3/src/celestialflow/reporter/core_snapshot.py +0 -86
  54. celestialflow-3.3.3/src/celestialflow/ticker/__init__.py +0 -18
  55. celestialflow-3.3.3/src/celestialflow/ticker/core_handler.py +0 -87
  56. celestialflow-3.3.3/src/celestialflow/ticker/core_hub.py +0 -99
  57. {celestialflow-3.3.3 → celestialflow-3.3.5}/LICENSE +0 -0
  58. {celestialflow-3.3.3 → celestialflow-3.3.5}/setup.cfg +0 -0
  59. {celestialflow-3.3.3 → celestialflow-3.3.5}/src/celestialflow/benchmark/__init__.py +0 -0
  60. {celestialflow-3.3.3 → celestialflow-3.3.5}/src/celestialflow/funnel/__init__.py +0 -0
  61. {celestialflow-3.3.3 → celestialflow-3.3.5}/src/celestialflow/funnel/util_count.py +0 -0
  62. {celestialflow-3.3.3 → celestialflow-3.3.5}/src/celestialflow/graph/__init__.py +0 -0
  63. {celestialflow-3.3.3 → celestialflow-3.3.5}/src/celestialflow/graph/core_structure.py +0 -0
  64. {celestialflow-3.3.3 → celestialflow-3.3.5}/src/celestialflow/graph/util_order_graph.py +0 -0
  65. {celestialflow-3.3.3 → celestialflow-3.3.5}/src/celestialflow/node/__init__.py +0 -0
  66. {celestialflow-3.3.3 → celestialflow-3.3.5}/src/celestialflow/node/util_callable.py +0 -0
  67. {celestialflow-3.3.3 → celestialflow-3.3.5}/src/celestialflow/node/util_types.py +0 -0
  68. {celestialflow-3.3.3 → celestialflow-3.3.5}/src/celestialflow/persist/util_payload.py +0 -0
  69. {celestialflow-3.3.3 → celestialflow-3.3.5}/src/celestialflow/runtime/core_config.py +0 -0
  70. {celestialflow-3.3.3 → celestialflow-3.3.5}/src/celestialflow/runtime/core_envelope.py +0 -0
  71. {celestialflow-3.3.3 → celestialflow-3.3.5}/src/celestialflow/runtime/core_queue.py +0 -0
  72. {celestialflow-3.3.3 → celestialflow-3.3.5}/src/celestialflow/runtime/util_constant.py +0 -0
  73. {celestialflow-3.3.3 → celestialflow-3.3.5}/src/celestialflow/runtime/util_errors.py +0 -0
  74. {celestialflow-3.3.3 → celestialflow-3.3.5}/src/celestialflow/runtime/util_event.py +0 -0
  75. {celestialflow-3.3.3 → celestialflow-3.3.5}/src/celestialflow/runtime/util_log_level.py +0 -0
  76. {celestialflow-3.3.3 → celestialflow-3.3.5}/src/celestialflow.egg-info/dependency_links.txt +0 -0
  77. {celestialflow-3.3.3 → celestialflow-3.3.5}/src/celestialflow.egg-info/requires.txt +0 -0
  78. {celestialflow-3.3.3 → celestialflow-3.3.5}/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
3
+ Version: 3.3.5
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/10/30
22
+ > 📅 最后更新日期: 2026/11/13
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">
@@ -220,13 +220,16 @@ flowchart TD
220
220
  class TRC execution;
221
221
  ```
222
222
 
223
- 以下五篇可以作为补充阅读:
223
+ 以下八篇可以作为补充阅读:
224
224
 
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
227
  - [UtilFormat.md](https://github.com/Mr-xiaotian/CelestialFlow/blob/main/docs/zh-CN/src/runtime/util_format.md)
228
228
  - [Lifecycle.md](https://github.com/Mr-xiaotian/CelestialFlow/blob/main/docs/zh-CN/src/persist/core_lifecycle.md)
229
229
  - [Log.md](https://github.com/Mr-xiaotian/CelestialFlow/blob/main/docs/zh-CN/src/persist/core_log.md)
230
+ - [Ticker.md](https://github.com/Mr-xiaotian/CelestialFlow/blob/main/docs/zh-CN/src/ticker/core_ticker.md)
231
+ - [Reporter.md](https://github.com/Mr-xiaotian/CelestialFlow/blob/main/docs/zh-CN/src/reporter/core_push.md)
232
+ - [Assembly.md](https://github.com/Mr-xiaotian/CelestialFlow/blob/main/docs/zh-CN/src/assembly/core_run.md)
230
233
 
231
234
  如果你更喜欢通过完整案例理解框架的运行方式,可以参考这篇利用 TaskGraph 从零开始构建项目的教程:
232
235
 
@@ -266,46 +269,48 @@ flowchart TD
266
269
  ## 文件结构(File Structure)
267
270
 
268
271
  ```
269
- 📁 CelestialFlow (560MB 757KB 428B)
270
- 📁 bench (316KB 409B)
271
- 📁 [1项排除的目录] (193KB 163B)
272
+ 📁 CelestialFlow (769MB 928KB 138B)
273
+ 📁 bench (361KB 634B)
274
+ 📁 [1项排除的目录] (236KB 964B)
272
275
  🐍 bench_datastructures.py (6KB 690B)
273
276
  🐍 bench_execution_mode.py (2KB 707B)
274
- 🐍 bench_funnel_vs_lock.py (21KB 888B)
277
+ 🐍 bench_funnel_vs_lock.py (21KB 885B)
275
278
  🐍 bench_futures_memory.py (2KB 269B)
276
- 🐍 bench_gil_vs_nogil.py (10KB 552B)
277
- 🐍 bench_graph_mode.py (6KB 614B)
279
+ 🐍 bench_gil_vs_nogil.py (10KB 524B)
280
+ 🐍 bench_graph_mode.py (8KB 723B)
278
281
  🐍 bench_hash.py (7KB 67B)
279
282
  🐍 bench_hash_container.py (3KB 1009B)
280
283
  🐍 bench_hash_memory.py (3KB 655B)
281
- 🐍 bench_http_grpc.py (2KB 530B)
284
+ 🐍 bench_http_grpc.py (2KB 515B)
282
285
  🐍 bench_ipc_queue.py (7KB 104B)
283
286
  🐍 bench_lock_overhead.py (9KB 421B)
284
287
  🐍 bench_mpqueue_vs_shared_memory.py (13KB 127B)
285
- 🐍 bench_observer.py (7KB 58B)
286
- 🐍 bench_persist_spout.py (4KB 323B)
288
+ 🐍 bench_observer.py (6KB 657B)
289
+ 🐍 bench_persist_spout.py (4KB 109B)
287
290
  🐍 bench_queue.py (5KB 857B)
288
291
  🐍 bench_requests.py (6KB 813B)
289
292
  🐍 bench_tqdm.py (1KB 235B)
290
293
  🐍 bench_utils.py (543B)
291
- 📁 demo (811KB 650B)
292
- 📁 [4项排除的目录] (755KB 996B)
294
+ 📁 demo (819KB 210B)
295
+ 📁 [4项排除的目录] (759KB 220B)
296
+ 🐍 demo_ctree.py (6KB 985B)
293
297
  🐍 demo_executor.py (1KB 557B)
294
- 🐍 demo_funnel.py (2KB 289B)
295
- 🐍 demo_graph.py (2KB 975B)
298
+ 🐍 demo_funnel.py (2KB 286B)
299
+ 🐍 demo_graph.py (2KB 481B)
296
300
  🐍 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)
308
- 📁 experiments (3KB 21B)
301
+ 🐍 demo_nodes.py (3KB 770B)
302
+ 🐍 demo_observer.py (2KB 445B)
303
+ 🐍 demo_redis.py (8KB 808B)
304
+ 🐍 demo_skip_dedup.py (6KB 271B)
305
+ 🐍 demo_structure.py (8KB 59B)
306
+ 🐍 demo_utils.py (5KB 215B)
307
+ 🐍 demo_web.py (8KB 501B)
308
+ 📁 docs (2MB 875KB 757B)
309
+ 📁 en[已折叠] (936KB 498B)
310
+ 📁 ja[已折叠] (1MB 55KB 767B)
311
+ 📁 zh-CN[已折叠] (907KB 516B)
312
+ 📁 experiments (7KB 677B)
313
+ 📁 [1项排除的目录] (4KB 656B)
309
314
  🐍 experiment_networkx.py (1KB 908B)
310
315
  🐍 experiment_tqdm.py (1KB 137B)
311
316
  📁 img (5MB 871KB 242B)
@@ -313,50 +318,60 @@ flowchart TD
313
318
  📷 logo(old).png (836KB 542B)
314
319
  📷 logo.png (122KB 747B)
315
320
  📷 scc_condensation.svg (17KB 1B)
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)
321
+ 📁 src (1MB 727KB 802B)
322
+ 📁 celestialflow[已折叠] (1MB 708KB 40B)
323
+ 📁 [1项排除的目录] (19KB 762B)
324
+ 📁 tests (3MB 831KB 542B)
325
+ 📁 assembly[已折叠] (82KB 902B)
326
+ 📁 benchmark[已折叠] (100KB 208B)
327
+ 📁 funnel[已折叠] (119KB 944B)
328
+ 📁 graph[已折叠] (1MB 35KB 294B)
329
+ 📁 node[已折叠] (710KB 500B)
330
+ 📁 observer[已折叠] (242KB 1018B)
331
+ 📁 persist[已折叠] (319KB 306B)
332
+ 📁 reporter[已折叠] (253KB 84B)
333
+ 📁 runtime[已折叠] (328KB 572B)
334
+ 📁 ticker[已折叠] (148KB 268B)
335
+ 📁 [3项排除的目录] (536KB 268B)
336
+ 🐍 conftest.py (2KB 298B)
337
+ 📁 [12项排除的目录] (754MB 376KB 280B)
334
338
  ❓ .env (484B)
335
339
  ❓ .gitignore (1KB 315B)
336
340
  📝 AGENTS.md (2KB 800B)
337
341
  ❓ LICENSE (1KB 65B)
338
342
  ❓ Makefile (149B)
339
343
  ⚙️ pyproject.toml (2KB 624B)
340
- 📝 README.md (16KB 321B)
341
- 🔒 uv.lock (126KB 837B)
344
+ 📝 README.md (17KB 908B)
345
+ 🔒 uv.lock (126KB 841B)
342
346
  ```
343
347
  <p align="center">
344
- <em>celestial-flow 3.3.3</em>
348
+ <em>celestial-flow 3.3.5</em>
345
349
  </p>
346
350
 
347
351
  (该视图由我的另一个项目[CelestialVault](https://github.com/Mr-xiaotian/CelestialVault)中inst_file.FileTree.print_tree()生成。转换为图片则借助[Carbon](https://carbon.now.sh)。)
348
352
 
349
353
  ## 版本日志(Version Log)
350
- - 3.3.3
354
+ - 3.3.5
351
355
  - feat:
352
- - 在 `GraphEndEvent` / `NodeEndEvent` 中添加 `end_time`
353
- - 在 `GraphStartEvent` 中删除 `class_name`
356
+ - [IMPORTANT] 在lifecycle的sqlite中多添加 `event` 与 `parent_evnet` 两张表
357
+ - 用于在无外部 `celestiaftree` 的情况下记录事件因果关系
358
+ - `graph` 和 `node` 中都可以通过 `add_ticker` 来自主添加 `Ticker`, 并且在 `*.run` 中新添 `interval` 用于控制 `TickerClock` 的基本间隔
359
+ - `clone_executor` 改名 `clone_node`, 现在可以克隆任意node
354
360
  - refactor:
355
- - 移除部分无用的observer事件, 如 `on_worker_crash`
356
- - 将log与reporter设置从 `.toml` 中移到运行时配置中
357
- - 删除部分无用的sqlite函数
361
+ - [IMPORTANT] 大幅重构整个 `ticker`
362
+ - 目前 `TickerHub` 继承于 `Ticker`, 两者都不负责计时, 而是由单独的 `TickerClock` 来计时与唤醒 `Ticker`
363
+ - 将两个运行时控制函数 `run_graph_resources/run_node_resources` 改名为 `run_local_resources/run_reporting_resources`, 以更贴合使用场景
364
+ - 在 `observer/ticker` 中添加 `start/end` 方法以控制资源启动与关闭
365
+ - 添加 `PushObserver` 来统一管理相关的 `spout/inlet`
366
+ - 如同上个版本的 `log` 与 `lifecycle`
367
+ - 不再为了处理graph结束时的最后一轮上报snapshot而将snapshot ticker强行添加 `observer` 特性, 而是在push observer中自主调用 `MetricObserver` 来完成上报
368
+ - `TaskInputEvent` 事件中添加 `parent_ids` 属性
369
+ - 将lifecycle中原有 `records` 表改名 `status`, 并将原有的 `event_id` 属性拆为 `input_event_id` 与 `currect_event_id`
358
370
  - fix:
359
- - 修复图分析缓存的问题
371
+ - 修复bench函数因为新加入参数而无法运行的问题
372
+ - chore:
373
+ - 添加 `demo_ctree` 用于展示如何使用 `celestialtree` 库来外部记录事件
374
+ - 在 `bench_graph_mode` 中添加 `bench_graph_3`, 用以展示新 `clone_node`
360
375
 
361
376
  更多过往日志可看:
362
377
 
@@ -1,6 +1,6 @@
1
1
  # CelestialFlow ——一个轻量级、可并行、基于图结构的 Python 任务调度框架
2
2
 
3
- > 📅 最后更新日期: 2026/10/30
3
+ > 📅 最后更新日期: 2026/11/13
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">
@@ -201,13 +201,16 @@ flowchart TD
201
201
  class TRC execution;
202
202
  ```
203
203
 
204
- 以下五篇可以作为补充阅读:
204
+ 以下八篇可以作为补充阅读:
205
205
 
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
208
  - [UtilFormat.md](https://github.com/Mr-xiaotian/CelestialFlow/blob/main/docs/zh-CN/src/runtime/util_format.md)
209
209
  - [Lifecycle.md](https://github.com/Mr-xiaotian/CelestialFlow/blob/main/docs/zh-CN/src/persist/core_lifecycle.md)
210
210
  - [Log.md](https://github.com/Mr-xiaotian/CelestialFlow/blob/main/docs/zh-CN/src/persist/core_log.md)
211
+ - [Ticker.md](https://github.com/Mr-xiaotian/CelestialFlow/blob/main/docs/zh-CN/src/ticker/core_ticker.md)
212
+ - [Reporter.md](https://github.com/Mr-xiaotian/CelestialFlow/blob/main/docs/zh-CN/src/reporter/core_push.md)
213
+ - [Assembly.md](https://github.com/Mr-xiaotian/CelestialFlow/blob/main/docs/zh-CN/src/assembly/core_run.md)
211
214
 
212
215
  如果你更喜欢通过完整案例理解框架的运行方式,可以参考这篇利用 TaskGraph 从零开始构建项目的教程:
213
216
 
@@ -247,46 +250,48 @@ flowchart TD
247
250
  ## 文件结构(File Structure)
248
251
 
249
252
  ```
250
- 📁 CelestialFlow (560MB 757KB 428B)
251
- 📁 bench (316KB 409B)
252
- 📁 [1项排除的目录] (193KB 163B)
253
+ 📁 CelestialFlow (769MB 928KB 138B)
254
+ 📁 bench (361KB 634B)
255
+ 📁 [1项排除的目录] (236KB 964B)
253
256
  🐍 bench_datastructures.py (6KB 690B)
254
257
  🐍 bench_execution_mode.py (2KB 707B)
255
- 🐍 bench_funnel_vs_lock.py (21KB 888B)
258
+ 🐍 bench_funnel_vs_lock.py (21KB 885B)
256
259
  🐍 bench_futures_memory.py (2KB 269B)
257
- 🐍 bench_gil_vs_nogil.py (10KB 552B)
258
- 🐍 bench_graph_mode.py (6KB 614B)
260
+ 🐍 bench_gil_vs_nogil.py (10KB 524B)
261
+ 🐍 bench_graph_mode.py (8KB 723B)
259
262
  🐍 bench_hash.py (7KB 67B)
260
263
  🐍 bench_hash_container.py (3KB 1009B)
261
264
  🐍 bench_hash_memory.py (3KB 655B)
262
- 🐍 bench_http_grpc.py (2KB 530B)
265
+ 🐍 bench_http_grpc.py (2KB 515B)
263
266
  🐍 bench_ipc_queue.py (7KB 104B)
264
267
  🐍 bench_lock_overhead.py (9KB 421B)
265
268
  🐍 bench_mpqueue_vs_shared_memory.py (13KB 127B)
266
- 🐍 bench_observer.py (7KB 58B)
267
- 🐍 bench_persist_spout.py (4KB 323B)
269
+ 🐍 bench_observer.py (6KB 657B)
270
+ 🐍 bench_persist_spout.py (4KB 109B)
268
271
  🐍 bench_queue.py (5KB 857B)
269
272
  🐍 bench_requests.py (6KB 813B)
270
273
  🐍 bench_tqdm.py (1KB 235B)
271
274
  🐍 bench_utils.py (543B)
272
- 📁 demo (811KB 650B)
273
- 📁 [4项排除的目录] (755KB 996B)
275
+ 📁 demo (819KB 210B)
276
+ 📁 [4项排除的目录] (759KB 220B)
277
+ 🐍 demo_ctree.py (6KB 985B)
274
278
  🐍 demo_executor.py (1KB 557B)
275
- 🐍 demo_funnel.py (2KB 289B)
276
- 🐍 demo_graph.py (2KB 975B)
279
+ 🐍 demo_funnel.py (2KB 286B)
280
+ 🐍 demo_graph.py (2KB 481B)
277
281
  🐍 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)
289
- 📁 experiments (3KB 21B)
282
+ 🐍 demo_nodes.py (3KB 770B)
283
+ 🐍 demo_observer.py (2KB 445B)
284
+ 🐍 demo_redis.py (8KB 808B)
285
+ 🐍 demo_skip_dedup.py (6KB 271B)
286
+ 🐍 demo_structure.py (8KB 59B)
287
+ 🐍 demo_utils.py (5KB 215B)
288
+ 🐍 demo_web.py (8KB 501B)
289
+ 📁 docs (2MB 875KB 757B)
290
+ 📁 en[已折叠] (936KB 498B)
291
+ 📁 ja[已折叠] (1MB 55KB 767B)
292
+ 📁 zh-CN[已折叠] (907KB 516B)
293
+ 📁 experiments (7KB 677B)
294
+ 📁 [1项排除的目录] (4KB 656B)
290
295
  🐍 experiment_networkx.py (1KB 908B)
291
296
  🐍 experiment_tqdm.py (1KB 137B)
292
297
  📁 img (5MB 871KB 242B)
@@ -294,50 +299,60 @@ flowchart TD
294
299
  📷 logo(old).png (836KB 542B)
295
300
  📷 logo.png (122KB 747B)
296
301
  📷 scc_condensation.svg (17KB 1B)
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)
302
+ 📁 src (1MB 727KB 802B)
303
+ 📁 celestialflow[已折叠] (1MB 708KB 40B)
304
+ 📁 [1项排除的目录] (19KB 762B)
305
+ 📁 tests (3MB 831KB 542B)
306
+ 📁 assembly[已折叠] (82KB 902B)
307
+ 📁 benchmark[已折叠] (100KB 208B)
308
+ 📁 funnel[已折叠] (119KB 944B)
309
+ 📁 graph[已折叠] (1MB 35KB 294B)
310
+ 📁 node[已折叠] (710KB 500B)
311
+ 📁 observer[已折叠] (242KB 1018B)
312
+ 📁 persist[已折叠] (319KB 306B)
313
+ 📁 reporter[已折叠] (253KB 84B)
314
+ 📁 runtime[已折叠] (328KB 572B)
315
+ 📁 ticker[已折叠] (148KB 268B)
316
+ 📁 [3项排除的目录] (536KB 268B)
317
+ 🐍 conftest.py (2KB 298B)
318
+ 📁 [12项排除的目录] (754MB 376KB 280B)
315
319
  ❓ .env (484B)
316
320
  ❓ .gitignore (1KB 315B)
317
321
  📝 AGENTS.md (2KB 800B)
318
322
  ❓ LICENSE (1KB 65B)
319
323
  ❓ Makefile (149B)
320
324
  ⚙️ pyproject.toml (2KB 624B)
321
- 📝 README.md (16KB 321B)
322
- 🔒 uv.lock (126KB 837B)
325
+ 📝 README.md (17KB 908B)
326
+ 🔒 uv.lock (126KB 841B)
323
327
  ```
324
328
  <p align="center">
325
- <em>celestial-flow 3.3.3</em>
329
+ <em>celestial-flow 3.3.5</em>
326
330
  </p>
327
331
 
328
332
  (该视图由我的另一个项目[CelestialVault](https://github.com/Mr-xiaotian/CelestialVault)中inst_file.FileTree.print_tree()生成。转换为图片则借助[Carbon](https://carbon.now.sh)。)
329
333
 
330
334
  ## 版本日志(Version Log)
331
- - 3.3.3
335
+ - 3.3.5
332
336
  - feat:
333
- - 在 `GraphEndEvent` / `NodeEndEvent` 中添加 `end_time`
334
- - 在 `GraphStartEvent` 中删除 `class_name`
337
+ - [IMPORTANT] 在lifecycle的sqlite中多添加 `event` 与 `parent_evnet` 两张表
338
+ - 用于在无外部 `celestiaftree` 的情况下记录事件因果关系
339
+ - `graph` 和 `node` 中都可以通过 `add_ticker` 来自主添加 `Ticker`, 并且在 `*.run` 中新添 `interval` 用于控制 `TickerClock` 的基本间隔
340
+ - `clone_executor` 改名 `clone_node`, 现在可以克隆任意node
335
341
  - refactor:
336
- - 移除部分无用的observer事件, 如 `on_worker_crash`
337
- - 将log与reporter设置从 `.toml` 中移到运行时配置中
338
- - 删除部分无用的sqlite函数
342
+ - [IMPORTANT] 大幅重构整个 `ticker`
343
+ - 目前 `TickerHub` 继承于 `Ticker`, 两者都不负责计时, 而是由单独的 `TickerClock` 来计时与唤醒 `Ticker`
344
+ - 将两个运行时控制函数 `run_graph_resources/run_node_resources` 改名为 `run_local_resources/run_reporting_resources`, 以更贴合使用场景
345
+ - 在 `observer/ticker` 中添加 `start/end` 方法以控制资源启动与关闭
346
+ - 添加 `PushObserver` 来统一管理相关的 `spout/inlet`
347
+ - 如同上个版本的 `log` 与 `lifecycle`
348
+ - 不再为了处理graph结束时的最后一轮上报snapshot而将snapshot ticker强行添加 `observer` 特性, 而是在push observer中自主调用 `MetricObserver` 来完成上报
349
+ - `TaskInputEvent` 事件中添加 `parent_ids` 属性
350
+ - 将lifecycle中原有 `records` 表改名 `status`, 并将原有的 `event_id` 属性拆为 `input_event_id` 与 `currect_event_id`
339
351
  - fix:
340
- - 修复图分析缓存的问题
352
+ - 修复bench函数因为新加入参数而无法运行的问题
353
+ - chore:
354
+ - 添加 `demo_ctree` 用于展示如何使用 `celestialtree` 库来外部记录事件
355
+ - 在 `bench_graph_mode` 中添加 `bench_graph_3`, 用以展示新 `clone_node`
341
356
 
342
357
  更多过往日志可看:
343
358
 
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "celestialflow"
7
- version = "3.3.3"
7
+ version = "3.3.5"
8
8
  description = "A flexible GRAPH-based task orchestration framework."
9
9
  readme = "README.md"
10
10
  license = { text = "MIT" }
@@ -25,7 +25,7 @@ from .persist.util_sqlite import load_tasks_grouped_by_node
25
25
  from .runtime import ReportConfig
26
26
  from .runtime.util_format import format_table
27
27
  from .runtime.util_types import TerminationSignal
28
- from .ticker import Ticker, TickEvent, TickHandler, TickHub
28
+ from .ticker import TickClock, Ticker, TickEvent, TickHub
29
29
 
30
30
  __all__ = [
31
31
  "BaseInlet",
@@ -45,8 +45,8 @@ __all__ = [
45
45
  "TaskSplitter",
46
46
  "TaskWheel",
47
47
  "TerminationSignal",
48
+ "TickClock",
48
49
  "TickEvent",
49
- "TickHandler",
50
50
  "TickHub",
51
51
  "Ticker",
52
52
  "benchmark_executor",
@@ -0,0 +1,13 @@
1
+ # assembly/__init__.py
2
+ """CelestialFlow 运行期资源装配模块。
3
+
4
+ 负责把 lifecycle / log / 上报三类全局 funnel 观察者注册到运行期 hub,
5
+ 并统一管理其 spout 的启停;同时按需装配节拍时钟并驱动运行主体的 ticker hub。
6
+ """
7
+
8
+ from .core_run import run_local_resources, run_reporting_resources
9
+
10
+ __all__ = [
11
+ "run_local_resources",
12
+ "run_reporting_resources",
13
+ ]
@@ -0,0 +1,140 @@
1
+ # assembly/core_run.py
2
+ from __future__ import annotations
3
+
4
+ import uuid
5
+ from collections.abc import Generator
6
+ from contextlib import contextmanager
7
+
8
+ from ..observer import MetricsObserver, ObserverHub
9
+ from ..persist import LifecycleObserver, LogObserver
10
+ from ..reporter import (
11
+ InjectionTarget,
12
+ InjectionTicker,
13
+ PushObserver,
14
+ SnapshotTicker,
15
+ )
16
+ from ..runtime import ReportConfig
17
+ from ..runtime.util_log_level import normalize_log_level
18
+ from ..ticker import TickClock, TickHub
19
+
20
+
21
+ @contextmanager
22
+ def run_reporting_resources(
23
+ observers: ObserverHub,
24
+ tickers: TickHub,
25
+ injection_target: InjectionTarget,
26
+ *,
27
+ log_level: str,
28
+ interval: float,
29
+ report: ReportConfig,
30
+ ) -> Generator[None, None, None]:
31
+ """
32
+ 带远程上报的任务图运行期资源:``metrics`` + ``lifecycle`` + ``log``,
33
+ 外加 ``report`` 驱动的状态快照上报、任务注入与节拍时钟。
34
+
35
+ 指标写模型由本入口创建并注册到 ``observers``,其只读视图交给
36
+ :class:`LogObserver` 与快照 ticker。本入口自行生成一个不透明的上报会话标识,
37
+ 注册 :class:`PushObserver`,并把 :class:`SnapshotTicker` 与
38
+ :class:`InjectionTicker` 注册进 ``tickers``。
39
+
40
+ 进入时依次启动观察者、ticker 资源与时钟,保证第一拍到达时上报通道与各 ticker
41
+ 均已就绪;退出时按 ``clock.stop()`` → ``tickers.stop()`` → ``observers.stop()``
42
+ 的逆序回收,避免推送通道关闭后仍有快照入队。
43
+
44
+ :param observers: 运行主体自身的观察者 hub
45
+ :param tickers: 运行主体自身的节拍 hub,上报用的 ticker 会注册到这里
46
+ :param injection_target: 任务注入目标,通常是任务图自身
47
+ :param log_level: :class:`LogObserver` 的日志过滤级别,必填;默认值由
48
+ 上层运行入口提供
49
+ :param report: 远程上报配置,必填
50
+ :param interval: 时钟基准周期(秒),必填;各 ticker 以 ``tick_period`` 缩放
51
+ :return: ``None``
52
+ :raises InvalidOptionError: ``log_level`` 不在允许的级别集合中时
53
+ """
54
+ log_level = normalize_log_level(log_level)
55
+ session_id = uuid.uuid4().hex
56
+
57
+ metrics = MetricsObserver()
58
+ lifecycle = LifecycleObserver()
59
+ log = LogObserver(metrics, log_level)
60
+ push = PushObserver(session_id, report.url, metrics)
61
+
62
+ observers.add_observer(metrics)
63
+ observers.add_observer(lifecycle)
64
+ observers.add_observer(log)
65
+ observers.add_observer(push)
66
+
67
+ tickers.add_ticker(SnapshotTicker(metrics, push))
68
+ tickers.add_ticker(
69
+ InjectionTicker(
70
+ report.url,
71
+ session_id,
72
+ injection_target,
73
+ )
74
+ )
75
+
76
+ clock = TickClock(interval, tickers)
77
+ try:
78
+ observers.start()
79
+ tickers.start()
80
+ clock.start()
81
+ yield None
82
+ finally:
83
+ try:
84
+ clock.stop()
85
+ finally:
86
+ try:
87
+ tickers.stop()
88
+ finally:
89
+ observers.stop()
90
+
91
+
92
+ @contextmanager
93
+ def run_local_resources(
94
+ observers: ObserverHub,
95
+ tickers: TickHub,
96
+ *,
97
+ log_level: str,
98
+ interval: float,
99
+ ) -> Generator[None, None, None]:
100
+ """
101
+ 本地运行期资源:内部创建并注册指标观察者,仅装配 ``lifecycle`` + ``log``,
102
+ 并驱动运行主体自身的节拍 hub。
103
+
104
+ 适用于独立运行的节点与未启用上报的任务图:这类运行不产生跨进程上报,
105
+ 因此本入口既不接收上报配置,也不装配推送通道或注入目标;指标观察者
106
+ 由本入口创建并注册,运行结束后无需外部持有。节拍部分与上报入口一致:
107
+ 启动 ticker 资源后由时钟驱动,退出时逆序回收。
108
+
109
+ :param observers: 运行主体自身的观察者 hub
110
+ :param tickers: 运行主体自身的节拍 hub
111
+ :param log_level: :class:`LogObserver` 的日志过滤级别,必填;默认值由
112
+ 上层运行入口提供
113
+ :param interval: 时钟基准周期(秒),必填;各 ticker 以 ``tick_period`` 缩放
114
+ :return: ``None``
115
+ :raises InvalidOptionError: ``log_level`` 不在允许的级别集合中时
116
+ """
117
+ log_level = normalize_log_level(log_level)
118
+
119
+ metrics_view = MetricsObserver()
120
+ lifecycle = LifecycleObserver()
121
+ log = LogObserver(metrics_view, log_level)
122
+
123
+ observers.add_observer(metrics_view)
124
+ observers.add_observer(lifecycle)
125
+ observers.add_observer(log)
126
+
127
+ clock = TickClock(interval, tickers)
128
+ try:
129
+ observers.start()
130
+ tickers.start()
131
+ clock.start()
132
+ yield None
133
+ finally:
134
+ try:
135
+ clock.stop()
136
+ finally:
137
+ try:
138
+ tickers.stop()
139
+ finally:
140
+ observers.stop()
@@ -9,7 +9,7 @@ from typing import Any
9
9
  from ..graph import TaskGraph
10
10
  from ..node import TaskExecutor
11
11
  from ..runtime.util_format import format_table
12
- from .util_clone import clone_executor, clone_graph
12
+ from .util_clone import clone_graph, clone_node
13
13
 
14
14
  type AnyTaskExecutor = TaskExecutor[Any, Any]
15
15
 
@@ -35,17 +35,17 @@ async def benchmark_executor(
35
35
  use_time: list[list[float]] = []
36
36
  for mode in execution_modes:
37
37
  if mode == "async":
38
- cloned_executor = clone_executor(async_executor)
38
+ cloned_executor = clone_node(async_executor)
39
39
  else:
40
- cloned_executor = clone_executor(sync_executor)
40
+ cloned_executor = clone_node(sync_executor)
41
41
  cloned_executor.set_execution_mode(mode)
42
42
 
43
- start = time.perf_counter()
43
+ start_perf = time.perf_counter()
44
44
  if mode == "async":
45
45
  await cloned_executor.run_async(task_list)
46
46
  else:
47
47
  cloned_executor.run(task_list)
48
- use_time.append([time.perf_counter() - start])
48
+ use_time.append([time.perf_counter() - start_perf])
49
49
 
50
50
  use_time_table: str = format_table(use_time, execution_modes, ["Time"])
51
51
  print(f"Use time:\n{use_time_table}\n")