celestialflow 3.3.3__tar.gz → 3.3.4__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 (67) hide show
  1. {celestialflow-3.3.3/src/celestialflow.egg-info → celestialflow-3.3.4}/PKG-INFO +48 -46
  2. {celestialflow-3.3.3 → celestialflow-3.3.4}/README.md +47 -45
  3. {celestialflow-3.3.3 → celestialflow-3.3.4}/pyproject.toml +1 -1
  4. {celestialflow-3.3.3 → celestialflow-3.3.4}/src/celestialflow/assembly/core_run.py +53 -39
  5. {celestialflow-3.3.3 → celestialflow-3.3.4}/src/celestialflow/benchmark/util_benchmark.py +2 -2
  6. {celestialflow-3.3.3 → celestialflow-3.3.4}/src/celestialflow/funnel/core_inlet.py +2 -2
  7. {celestialflow-3.3.3 → celestialflow-3.3.4}/src/celestialflow/funnel/core_spout.py +5 -3
  8. {celestialflow-3.3.3 → celestialflow-3.3.4}/src/celestialflow/graph/core_graph.py +18 -31
  9. {celestialflow-3.3.3 → celestialflow-3.3.4}/src/celestialflow/node/core_dispatch.py +1 -1
  10. {celestialflow-3.3.3 → celestialflow-3.3.4}/src/celestialflow/node/core_node.py +37 -27
  11. {celestialflow-3.3.3 → celestialflow-3.3.4}/src/celestialflow/node/core_nodes.py +9 -9
  12. {celestialflow-3.3.3 → celestialflow-3.3.4}/src/celestialflow/observer/__init__.py +3 -1
  13. {celestialflow-3.3.3 → celestialflow-3.3.4}/src/celestialflow/observer/core_event.py +22 -11
  14. celestialflow-3.3.4/src/celestialflow/observer/core_hub.py +131 -0
  15. {celestialflow-3.3.3 → celestialflow-3.3.4}/src/celestialflow/observer/core_metrics.py +56 -82
  16. celestialflow-3.3.4/src/celestialflow/observer/core_observer.py +50 -0
  17. celestialflow-3.3.4/src/celestialflow/observer/core_print.py +79 -0
  18. celestialflow-3.3.4/src/celestialflow/persist/__init__.py +39 -0
  19. celestialflow-3.3.4/src/celestialflow/persist/core_lifecycle.py +325 -0
  20. celestialflow-3.3.4/src/celestialflow/persist/core_log.py +268 -0
  21. {celestialflow-3.3.3 → celestialflow-3.3.4}/src/celestialflow/reporter/core_inject.py +2 -2
  22. {celestialflow-3.3.3 → celestialflow-3.3.4}/src/celestialflow/reporter/core_push.py +50 -56
  23. {celestialflow-3.3.3 → celestialflow-3.3.4}/src/celestialflow/reporter/core_snapshot.py +15 -9
  24. {celestialflow-3.3.3 → celestialflow-3.3.4/src/celestialflow.egg-info}/PKG-INFO +48 -46
  25. {celestialflow-3.3.3 → celestialflow-3.3.4}/src/celestialflow.egg-info/SOURCES.txt +1 -1
  26. celestialflow-3.3.3/src/celestialflow/observer/core_hub.py +0 -260
  27. celestialflow-3.3.3/src/celestialflow/observer/core_observer.py +0 -130
  28. celestialflow-3.3.3/src/celestialflow/observer/core_observer_print.py +0 -98
  29. celestialflow-3.3.3/src/celestialflow/persist/__init__.py +0 -21
  30. celestialflow-3.3.3/src/celestialflow/persist/core_lifecycle.py +0 -213
  31. celestialflow-3.3.3/src/celestialflow/persist/core_log.py +0 -274
  32. {celestialflow-3.3.3 → celestialflow-3.3.4}/LICENSE +0 -0
  33. {celestialflow-3.3.3 → celestialflow-3.3.4}/setup.cfg +0 -0
  34. {celestialflow-3.3.3 → celestialflow-3.3.4}/src/celestialflow/__init__.py +0 -0
  35. {celestialflow-3.3.3 → celestialflow-3.3.4}/src/celestialflow/assembly/__init__.py +0 -0
  36. {celestialflow-3.3.3 → celestialflow-3.3.4}/src/celestialflow/benchmark/__init__.py +0 -0
  37. {celestialflow-3.3.3 → celestialflow-3.3.4}/src/celestialflow/benchmark/util_clone.py +0 -0
  38. {celestialflow-3.3.3 → celestialflow-3.3.4}/src/celestialflow/funnel/__init__.py +0 -0
  39. {celestialflow-3.3.3 → celestialflow-3.3.4}/src/celestialflow/funnel/util_count.py +0 -0
  40. {celestialflow-3.3.3 → celestialflow-3.3.4}/src/celestialflow/graph/__init__.py +0 -0
  41. {celestialflow-3.3.3 → celestialflow-3.3.4}/src/celestialflow/graph/core_structure.py +0 -0
  42. {celestialflow-3.3.3 → celestialflow-3.3.4}/src/celestialflow/graph/util_order_graph.py +0 -0
  43. {celestialflow-3.3.3 → celestialflow-3.3.4}/src/celestialflow/node/__init__.py +0 -0
  44. {celestialflow-3.3.3 → celestialflow-3.3.4}/src/celestialflow/node/util_callable.py +0 -0
  45. {celestialflow-3.3.3 → celestialflow-3.3.4}/src/celestialflow/node/util_types.py +0 -0
  46. {celestialflow-3.3.3 → celestialflow-3.3.4}/src/celestialflow/persist/util_payload.py +0 -0
  47. {celestialflow-3.3.3 → celestialflow-3.3.4}/src/celestialflow/persist/util_render.py +0 -0
  48. {celestialflow-3.3.3 → celestialflow-3.3.4}/src/celestialflow/persist/util_sqlite.py +0 -0
  49. {celestialflow-3.3.3 → celestialflow-3.3.4}/src/celestialflow/reporter/__init__.py +0 -0
  50. {celestialflow-3.3.3 → celestialflow-3.3.4}/src/celestialflow/runtime/__init__.py +0 -0
  51. {celestialflow-3.3.3 → celestialflow-3.3.4}/src/celestialflow/runtime/core_config.py +0 -0
  52. {celestialflow-3.3.3 → celestialflow-3.3.4}/src/celestialflow/runtime/core_envelope.py +0 -0
  53. {celestialflow-3.3.3 → celestialflow-3.3.4}/src/celestialflow/runtime/core_queue.py +0 -0
  54. {celestialflow-3.3.3 → celestialflow-3.3.4}/src/celestialflow/runtime/util_constant.py +0 -0
  55. {celestialflow-3.3.3 → celestialflow-3.3.4}/src/celestialflow/runtime/util_errors.py +0 -0
  56. {celestialflow-3.3.3 → celestialflow-3.3.4}/src/celestialflow/runtime/util_event.py +0 -0
  57. {celestialflow-3.3.3 → celestialflow-3.3.4}/src/celestialflow/runtime/util_format.py +0 -0
  58. {celestialflow-3.3.3 → celestialflow-3.3.4}/src/celestialflow/runtime/util_log_level.py +0 -0
  59. {celestialflow-3.3.3 → celestialflow-3.3.4}/src/celestialflow/runtime/util_types.py +0 -0
  60. {celestialflow-3.3.3 → celestialflow-3.3.4}/src/celestialflow/ticker/__init__.py +0 -0
  61. {celestialflow-3.3.3 → celestialflow-3.3.4}/src/celestialflow/ticker/core_event.py +0 -0
  62. {celestialflow-3.3.3 → celestialflow-3.3.4}/src/celestialflow/ticker/core_handler.py +0 -0
  63. {celestialflow-3.3.3 → celestialflow-3.3.4}/src/celestialflow/ticker/core_hub.py +0 -0
  64. {celestialflow-3.3.3 → celestialflow-3.3.4}/src/celestialflow/ticker/core_ticker.py +0 -0
  65. {celestialflow-3.3.3 → celestialflow-3.3.4}/src/celestialflow.egg-info/dependency_links.txt +0 -0
  66. {celestialflow-3.3.3 → celestialflow-3.3.4}/src/celestialflow.egg-info/requires.txt +0 -0
  67. {celestialflow-3.3.3 → celestialflow-3.3.4}/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.4
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,12 +269,12 @@ 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 (594MB 775KB 69B)
273
+ 📁 bench (356KB 464B)
274
+ 📁 [1项排除的目录] (233KB 797B)
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
279
  🐍 bench_gil_vs_nogil.py (10KB 552B)
277
280
  🐍 bench_graph_mode.py (6KB 614B)
@@ -282,29 +285,29 @@ flowchart TD
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 172B)
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 (809KB 719B)
295
+ 📁 [4项排除的目录] (754KB 603B)
293
296
  🐍 demo_executor.py (1KB 557B)
294
- 🐍 demo_funnel.py (2KB 289B)
297
+ 🐍 demo_funnel.py (2KB 286B)
295
298
  🐍 demo_graph.py (2KB 975B)
296
299
  🐍 demo_network.py (3KB 756B)
297
300
  🐍 demo_nodes.py (3KB 915B)
298
- 🐍 demo_observer.py (2KB 1004B)
301
+ 🐍 demo_observer.py (2KB 445B)
299
302
  🐍 demo_redis.py (8KB 595B)
300
303
  🐍 demo_skip_dedup.py (6KB 286B)
301
304
  🐍 demo_structure.py (8KB 448B)
302
305
  🐍 demo_utils.py (6KB 263B)
303
306
  🐍 demo_web.py (8KB 734B)
304
- 📁 docs (2MB 88KB 855B)
305
- 📁 en[已折叠] (678KB 928B)
306
- 📁 ja[已折叠] (778KB 854B)
307
- 📁 zh-CN[已折叠] (679KB 97B)
307
+ 📁 docs (2MB 424KB 355B)
308
+ 📁 en[已折叠] (759KB 226B)
309
+ 📁 ja[已折叠] (874KB 132B)
310
+ 📁 zh-CN[已折叠] (838KB 1021B)
308
311
  📁 experiments (3KB 21B)
309
312
  🐍 experiment_networkx.py (1KB 908B)
310
313
  🐍 experiment_tqdm.py (1KB 137B)
@@ -313,50 +316,49 @@ flowchart TD
313
316
  📷 logo(old).png (836KB 542B)
314
317
  📷 logo.png (122KB 747B)
315
318
  📷 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)
319
+ 📁 src (1MB 660KB 11B)
320
+ 📁 celestialflow[已折叠] (1MB 640KB 713B)
321
+ 📁 [1项排除的目录] (19KB 322B)
322
+ 📁 tests (3MB 662KB 157B)
323
+ 📁 assembly[已折叠] (76KB 371B)
324
+ 📁 benchmark[已折叠] (75KB 37B)
325
+ 📁 funnel[已折叠] (119KB 944B)
326
+ 📁 graph[已折叠] (1MB 22KB 263B)
327
+ 📁 node[已折叠] (704KB 568B)
328
+ 📁 observer[已折叠] (229KB 814B)
329
+ 📁 persist[已折叠] (269KB 262B)
330
+ 📁 reporter[已折叠] (248KB 570B)
331
+ 📁 runtime[已折叠] (327KB 569B)
332
+ 📁 ticker[已折叠] (98KB 313B)
333
+ 📁 [3项排除的目录] (536KB 268B)
334
+ 🐍 conftest.py (2KB 298B)
335
+ 📁 [12项排除的目录] (579MB 932KB 150B)
334
336
  ❓ .env (484B)
335
337
  ❓ .gitignore (1KB 315B)
336
338
  📝 AGENTS.md (2KB 800B)
337
339
  ❓ LICENSE (1KB 65B)
338
340
  ❓ Makefile (149B)
339
341
  ⚙️ pyproject.toml (2KB 624B)
340
- 📝 README.md (16KB 321B)
341
- 🔒 uv.lock (126KB 837B)
342
+ 📝 README.md (16KB 802B)
343
+ 🔒 uv.lock (126KB 855B)
342
344
  ```
343
345
  <p align="center">
344
- <em>celestial-flow 3.3.3</em>
346
+ <em>celestial-flow 3.3.4</em>
345
347
  </p>
346
348
 
347
349
  (该视图由我的另一个项目[CelestialVault](https://github.com/Mr-xiaotian/CelestialVault)中inst_file.FileTree.print_tree()生成。转换为图片则借助[Carbon](https://carbon.now.sh)。)
348
350
 
349
351
  ## 版本日志(Version Log)
350
- - 3.3.3
352
+ - 3.3.4
351
353
  - feat:
352
- - 在 `GraphEndEvent` / `NodeEndEvent` 中添加 `end_time`
353
- - 在 `GraphStartEvent` 中删除 `class_name`
354
+ - 在 `ObserverHub` 中添加 `find` 方法, 用于查找指定类型的observer
354
355
  - refactor:
355
- - 移除部分无用的observer事件, 如 `on_worker_crash`
356
- - 将log与reporter设置从 `.toml` 中移到运行时配置中
357
- - 删除部分无用的sqlite函数
358
- - fix:
359
- - 修复图分析缓存的问题
356
+ - 将observer中各个事件处理方法归于 `on_event`
357
+ - 将 `log` 与 `lifecycle` 中混乱的 `observer/inlet` 拆开
358
+ - 现在建立单独的 `*Observer` 来统筹 `spout/inlet`
359
+ - 在 `lifecycle` 中用明确的dataclass取代 `dict[str, Any]`
360
+ - `graph` 与 `node` 中不再存储 `_lifecycle_db_path`
361
+ - 归一化 `graph.run` 与 `graph.inject_tasks` 的输入参数类型
360
362
 
361
363
  更多过往日志可看:
362
364
 
@@ -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,12 +250,12 @@ 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 (594MB 775KB 69B)
254
+ 📁 bench (356KB 464B)
255
+ 📁 [1项排除的目录] (233KB 797B)
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
260
  🐍 bench_gil_vs_nogil.py (10KB 552B)
258
261
  🐍 bench_graph_mode.py (6KB 614B)
@@ -263,29 +266,29 @@ flowchart TD
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 172B)
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 (809KB 719B)
276
+ 📁 [4项排除的目录] (754KB 603B)
274
277
  🐍 demo_executor.py (1KB 557B)
275
- 🐍 demo_funnel.py (2KB 289B)
278
+ 🐍 demo_funnel.py (2KB 286B)
276
279
  🐍 demo_graph.py (2KB 975B)
277
280
  🐍 demo_network.py (3KB 756B)
278
281
  🐍 demo_nodes.py (3KB 915B)
279
- 🐍 demo_observer.py (2KB 1004B)
282
+ 🐍 demo_observer.py (2KB 445B)
280
283
  🐍 demo_redis.py (8KB 595B)
281
284
  🐍 demo_skip_dedup.py (6KB 286B)
282
285
  🐍 demo_structure.py (8KB 448B)
283
286
  🐍 demo_utils.py (6KB 263B)
284
287
  🐍 demo_web.py (8KB 734B)
285
- 📁 docs (2MB 88KB 855B)
286
- 📁 en[已折叠] (678KB 928B)
287
- 📁 ja[已折叠] (778KB 854B)
288
- 📁 zh-CN[已折叠] (679KB 97B)
288
+ 📁 docs (2MB 424KB 355B)
289
+ 📁 en[已折叠] (759KB 226B)
290
+ 📁 ja[已折叠] (874KB 132B)
291
+ 📁 zh-CN[已折叠] (838KB 1021B)
289
292
  📁 experiments (3KB 21B)
290
293
  🐍 experiment_networkx.py (1KB 908B)
291
294
  🐍 experiment_tqdm.py (1KB 137B)
@@ -294,50 +297,49 @@ flowchart TD
294
297
  📷 logo(old).png (836KB 542B)
295
298
  📷 logo.png (122KB 747B)
296
299
  📷 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)
300
+ 📁 src (1MB 660KB 11B)
301
+ 📁 celestialflow[已折叠] (1MB 640KB 713B)
302
+ 📁 [1项排除的目录] (19KB 322B)
303
+ 📁 tests (3MB 662KB 157B)
304
+ 📁 assembly[已折叠] (76KB 371B)
305
+ 📁 benchmark[已折叠] (75KB 37B)
306
+ 📁 funnel[已折叠] (119KB 944B)
307
+ 📁 graph[已折叠] (1MB 22KB 263B)
308
+ 📁 node[已折叠] (704KB 568B)
309
+ 📁 observer[已折叠] (229KB 814B)
310
+ 📁 persist[已折叠] (269KB 262B)
311
+ 📁 reporter[已折叠] (248KB 570B)
312
+ 📁 runtime[已折叠] (327KB 569B)
313
+ 📁 ticker[已折叠] (98KB 313B)
314
+ 📁 [3项排除的目录] (536KB 268B)
315
+ 🐍 conftest.py (2KB 298B)
316
+ 📁 [12项排除的目录] (579MB 932KB 150B)
315
317
  ❓ .env (484B)
316
318
  ❓ .gitignore (1KB 315B)
317
319
  📝 AGENTS.md (2KB 800B)
318
320
  ❓ LICENSE (1KB 65B)
319
321
  ❓ Makefile (149B)
320
322
  ⚙️ pyproject.toml (2KB 624B)
321
- 📝 README.md (16KB 321B)
322
- 🔒 uv.lock (126KB 837B)
323
+ 📝 README.md (16KB 802B)
324
+ 🔒 uv.lock (126KB 855B)
323
325
  ```
324
326
  <p align="center">
325
- <em>celestial-flow 3.3.3</em>
327
+ <em>celestial-flow 3.3.4</em>
326
328
  </p>
327
329
 
328
330
  (该视图由我的另一个项目[CelestialVault](https://github.com/Mr-xiaotian/CelestialVault)中inst_file.FileTree.print_tree()生成。转换为图片则借助[Carbon](https://carbon.now.sh)。)
329
331
 
330
332
  ## 版本日志(Version Log)
331
- - 3.3.3
333
+ - 3.3.4
332
334
  - feat:
333
- - 在 `GraphEndEvent` / `NodeEndEvent` 中添加 `end_time`
334
- - 在 `GraphStartEvent` 中删除 `class_name`
335
+ - 在 `ObserverHub` 中添加 `find` 方法, 用于查找指定类型的observer
335
336
  - refactor:
336
- - 移除部分无用的observer事件, 如 `on_worker_crash`
337
- - 将log与reporter设置从 `.toml` 中移到运行时配置中
338
- - 删除部分无用的sqlite函数
339
- - fix:
340
- - 修复图分析缓存的问题
337
+ - 将observer中各个事件处理方法归于 `on_event`
338
+ - 将 `log` 与 `lifecycle` 中混乱的 `observer/inlet` 拆开
339
+ - 现在建立单独的 `*Observer` 来统筹 `spout/inlet`
340
+ - 在 `lifecycle` 中用明确的dataclass取代 `dict[str, Any]`
341
+ - `graph` 与 `node` 中不再存储 `_lifecycle_db_path`
342
+ - 归一化 `graph.run` 与 `graph.inject_tasks` 的输入参数类型
341
343
 
342
344
  更多过往日志可看:
343
345
 
@@ -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.4"
8
8
  description = "A flexible GRAPH-based task orchestration framework."
9
9
  readme = "README.md"
10
10
  license = { text = "MIT" }
@@ -9,7 +9,7 @@ from pathlib import Path
9
9
  import requests
10
10
 
11
11
  from ..observer import MetricsObserver, ObserverHub
12
- from ..persist import LifecycleInlet, LifecycleSpout, LogInlet, LogSpout
12
+ from ..persist import LifecycleObserver, LogObserver
13
13
  from ..reporter import (
14
14
  InjectionHandler,
15
15
  InjectionTarget,
@@ -25,6 +25,34 @@ _TICK_INTERVAL: float = 1.0
25
25
  """节拍器基准周期(秒)。各处理器以自己的 ``tick_period`` 缩放出实际周期。"""
26
26
 
27
27
 
28
+ @contextmanager
29
+ def _persistence_resources(
30
+ observers: ObserverHub,
31
+ metrics_view: MetricsObserver,
32
+ log_level: str,
33
+ ) -> Generator[Path | None, None, None]:
34
+ """
35
+ 装配并运行 lifecycle 与 log 观察者。
36
+
37
+ :param observers: 目标观察者 hub
38
+ :param metrics_view: 指标只读视图,供日志记录节点汇总
39
+ :param log_level: 日志过滤级别(已规范化)
40
+ :return: 进入时产出 lifecycle 数据库路径,未就绪时为 ``None``
41
+ """
42
+ lifecycle = LifecycleObserver()
43
+ log = LogObserver(metrics_view, log_level)
44
+ observers.add_observer(lifecycle)
45
+ observers.add_observer(log)
46
+
47
+ try:
48
+ lifecycle.start()
49
+ log.start()
50
+ yield lifecycle.db_path
51
+ finally:
52
+ lifecycle.stop()
53
+ log.stop()
54
+
55
+
28
56
  @contextmanager
29
57
  def run_graph_resources(
30
58
  observers: ObserverHub,
@@ -37,19 +65,20 @@ def run_graph_resources(
37
65
  任务图运行期资源:``metrics`` + ``lifecycle`` + ``log``,并按 ``report``
38
66
  决定是否追加远程上报与注入。
39
67
 
40
- 指标写模型由本入口创建并注册到 ``observers``,其只读视图交给 ``LogInlet``
41
- 与快照处理器。上报配置由调用方显式传入:``report is None`` 时不上报;
42
- 否则本入口自行生成一个不透明的上报会话标识,注册 :class:`PushInlet` 与
43
- :class:`PushSnapshotHandler`、启动 :class:`PushSpout` 并启动一个以
44
- :data:`_TICK_INTERVAL` 为基准周期的节拍器,按拍把状态快照推送到
45
- ``report.url``(并在图结束时补推一次终态快照),同时按拍从远端拉取任务
46
- 注入到 ``injection_target``。
68
+ 指标写模型由本入口创建并注册到 ``observers``,其只读视图交给
69
+ :class:`LogObserver` 与快照处理器。上报配置由调用方显式传入:
70
+ ``report is None`` 时不上报;否则本入口自行生成一个不透明的上报会话标识,
71
+ 注册 :class:`PushInlet` 与 :class:`PushSnapshotHandler`、启动
72
+ :class:`PushSpout` 并启动一个以 :data:`_TICK_INTERVAL` 为基准周期的节拍器,
73
+ 按拍把状态快照推送到 ``report.url``(并在图结束时补推一次终态快照),
74
+ 同时按拍从远端拉取任务注入到 ``injection_target``。
47
75
 
48
76
  退出时先停节拍器再统一停止 spout,保证运行期即使抛出异常也能完成回收。
49
77
 
50
78
  :param observers: 任务图自身的观察者 hub
51
79
  :param injection_target: 任务注入目标,通常是任务图自身
52
- :param log_level: ``LogInlet`` 的日志过滤级别,默认 ``DEFAULT_LOG_LEVEL``
80
+ :param log_level: :class:`LogObserver` 的日志过滤级别,默认
81
+ ``DEFAULT_LOG_LEVEL``
53
82
  :param report: 远程上报配置;``None`` 表示不上报,默认 ``None``
54
83
  :return: 进入时产出 lifecycle 数据库路径,未就绪时为 ``None``
55
84
  :raises InvalidOptionError: ``log_level`` 不在允许的级别集合中时
@@ -59,11 +88,6 @@ def run_graph_resources(
59
88
  metrics_view = MetricsObserver()
60
89
  observers.add_observer(metrics_view)
61
90
 
62
- lifecycle_spout = LifecycleSpout()
63
- log_spout = LogSpout()
64
- observers.add_observer(LifecycleInlet().bind_spout(lifecycle_spout))
65
- observers.add_observer(LogInlet(metrics_view, log_level).bind_spout(log_spout))
66
-
67
91
  push_spout: PushSpout | None = None
68
92
  session: requests.Session | None = None
69
93
  ticker: Ticker | None = None
@@ -86,24 +110,23 @@ def run_graph_resources(
86
110
  )
87
111
  ticker = Ticker(_TICK_INTERVAL, hub, name="report")
88
112
 
89
- # 快照处理器同时观察 on_graph_end 补推终态快照;注册在 PushInlet 之前,
113
+ # 快照处理器同时观察 GraphEndEvent 补推终态快照;注册在 PushInlet 之前,
90
114
  # 保证终态快照先于 shutdown_session 入队。
91
115
  observers.add_observer(snapshot_handler)
92
116
  observers.add_observer(push_inlet)
93
117
 
94
118
  try:
95
- lifecycle_spout.start()
96
- log_spout.start()
97
- if push_spout is not None:
98
- push_spout.start()
99
- if ticker is not None:
100
- ticker.start()
101
- yield lifecycle_spout.db_path
119
+ with _persistence_resources(observers, metrics_view, log_level) as db_path:
120
+ if push_spout is not None:
121
+ push_spout.start()
122
+ if ticker is not None:
123
+ ticker.start()
124
+ try:
125
+ yield db_path
126
+ finally:
127
+ if ticker is not None:
128
+ ticker.stop()
102
129
  finally:
103
- if ticker is not None:
104
- ticker.stop()
105
- lifecycle_spout.stop()
106
- log_spout.stop()
107
130
  if push_spout is not None:
108
131
  push_spout.stop()
109
132
  if session is not None:
@@ -124,7 +147,8 @@ def run_node_resources(
124
147
  无需外部持有。退出时统一停止 spout,保证运行期即使抛出异常也能完成回收。
125
148
 
126
149
  :param observers: 节点自身的观察者 hub
127
- :param log_level: ``LogInlet`` 的日志过滤级别,默认 ``DEFAULT_LOG_LEVEL``
150
+ :param log_level: :class:`LogObserver` 的日志过滤级别,默认
151
+ ``DEFAULT_LOG_LEVEL``
128
152
  :return: 进入时产出 lifecycle 数据库路径,未就绪时为 ``None``
129
153
  :raises InvalidOptionError: ``log_level`` 不在允许的级别集合中时
130
154
  """
@@ -133,15 +157,5 @@ def run_node_resources(
133
157
  metrics_view = MetricsObserver()
134
158
  observers.add_observer(metrics_view)
135
159
 
136
- lifecycle_spout = LifecycleSpout()
137
- log_spout = LogSpout()
138
- observers.add_observer(LifecycleInlet().bind_spout(lifecycle_spout))
139
- observers.add_observer(LogInlet(metrics_view, log_level).bind_spout(log_spout))
140
-
141
- try:
142
- lifecycle_spout.start()
143
- log_spout.start()
144
- yield lifecycle_spout.db_path
145
- finally:
146
- lifecycle_spout.stop()
147
- log_spout.stop()
160
+ with _persistence_resources(observers, metrics_view, log_level) as db_path:
161
+ yield db_path
@@ -40,12 +40,12 @@ async def benchmark_executor(
40
40
  cloned_executor = clone_executor(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")
@@ -29,9 +29,9 @@ class BaseInlet:
29
29
  self._counter = spout.get_counter()
30
30
  return self
31
31
 
32
- def _funnel(self, record: Any) -> None:
32
+ def send(self, record: Any) -> None:
33
33
  """
34
- 将记录放入队列。
34
+ 将记录送入绑定 spout 的队列。
35
35
 
36
36
  :param record: 待发送的记录
37
37
  :return: ``None``
@@ -24,10 +24,12 @@ class BaseSpout:
24
24
 
25
25
  def start(self) -> None:
26
26
  """启动后台监听线程(若未运行)。"""
27
+ if self._thread is not None and self._thread.is_alive():
28
+ return
29
+
27
30
  self._before_start()
28
- if self._thread is None or not self._thread.is_alive():
29
- self._thread = Thread(target=self._spout, daemon=True)
30
- self._thread.start()
31
+ self._thread = Thread(target=self._spout, daemon=True)
32
+ self._thread.start()
31
33
 
32
34
  def _spout(self) -> None:
33
35
  """