celestialflow 3.3.1__tar.gz → 3.3.2__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.2}/PKG-INFO +61 -72
- {celestialflow-3.3.1 → celestialflow-3.3.2}/README.md +60 -71
- {celestialflow-3.3.1 → celestialflow-3.3.2}/pyproject.toml +5 -1
- {celestialflow-3.3.1 → celestialflow-3.3.2}/src/celestialflow/__init__.py +11 -6
- celestialflow-3.3.2/src/celestialflow/assembly/__init__.py +13 -0
- celestialflow-3.3.2/src/celestialflow/assembly/core_run.py +143 -0
- {celestialflow-3.3.1 → celestialflow-3.3.2}/src/celestialflow/benchmark/util_benchmark.py +2 -2
- {celestialflow-3.3.1 → celestialflow-3.3.2}/src/celestialflow/benchmark/util_clone.py +18 -45
- {celestialflow-3.3.1 → celestialflow-3.3.2}/src/celestialflow/funnel/core_spout.py +2 -6
- {celestialflow-3.3.1 → celestialflow-3.3.2}/src/celestialflow/graph/core_graph.py +167 -97
- {celestialflow-3.3.1 → celestialflow-3.3.2}/src/celestialflow/node/core_dispatch.py +27 -17
- {celestialflow-3.3.1 → celestialflow-3.3.2}/src/celestialflow/node/core_node.py +198 -146
- {celestialflow-3.3.1 → celestialflow-3.3.2}/src/celestialflow/node/core_nodes.py +222 -201
- celestialflow-3.3.2/src/celestialflow/observer/__init__.py +43 -0
- celestialflow-3.3.2/src/celestialflow/observer/core_event.py +211 -0
- celestialflow-3.3.2/src/celestialflow/observer/core_hub.py +276 -0
- celestialflow-3.3.2/src/celestialflow/observer/core_metrics.py +198 -0
- celestialflow-3.3.2/src/celestialflow/observer/core_observer.py +139 -0
- celestialflow-3.3.2/src/celestialflow/observer/core_observer_print.py +98 -0
- {celestialflow-3.3.1/src/celestialflow/persistence → celestialflow-3.3.2/src/celestialflow/persist}/__init__.py +1 -11
- {celestialflow-3.3.1/src/celestialflow/persistence → celestialflow-3.3.2/src/celestialflow/persist}/core_lifecycle.py +63 -83
- celestialflow-3.3.2/src/celestialflow/persist/core_log.py +285 -0
- {celestialflow-3.3.1/src/celestialflow/persistence → celestialflow-3.3.2/src/celestialflow/persist}/util_payload.py +1 -1
- {celestialflow-3.3.1/src/celestialflow/persistence → celestialflow-3.3.2/src/celestialflow/persist}/util_sqlite.py +58 -30
- celestialflow-3.3.2/src/celestialflow/reporter/__init__.py +23 -0
- celestialflow-3.3.2/src/celestialflow/reporter/core_inject.py +77 -0
- celestialflow-3.3.2/src/celestialflow/reporter/core_push.py +251 -0
- celestialflow-3.3.2/src/celestialflow/reporter/core_snapshot.py +85 -0
- {celestialflow-3.3.1 → celestialflow-3.3.2}/src/celestialflow/runtime/__init__.py +14 -16
- {celestialflow-3.3.1 → celestialflow-3.3.2}/src/celestialflow/runtime/core_queue.py +238 -238
- celestialflow-3.3.2/src/celestialflow/runtime/util_config.py +100 -0
- {celestialflow-3.3.1 → celestialflow-3.3.2}/src/celestialflow/runtime/util_types.py +64 -2
- celestialflow-3.3.2/src/celestialflow/ticker/__init__.py +18 -0
- celestialflow-3.3.2/src/celestialflow/ticker/core_event.py +30 -0
- celestialflow-3.3.2/src/celestialflow/ticker/core_handler.py +87 -0
- celestialflow-3.3.2/src/celestialflow/ticker/core_hub.py +99 -0
- celestialflow-3.3.2/src/celestialflow/ticker/core_ticker.py +204 -0
- {celestialflow-3.3.1 → celestialflow-3.3.2/src/celestialflow.egg-info}/PKG-INFO +61 -72
- {celestialflow-3.3.1 → celestialflow-3.3.2}/src/celestialflow.egg-info/SOURCES.txt +24 -14
- 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.2}/LICENSE +0 -0
- {celestialflow-3.3.1 → celestialflow-3.3.2}/setup.cfg +0 -0
- {celestialflow-3.3.1 → celestialflow-3.3.2}/src/celestialflow/benchmark/__init__.py +0 -0
- {celestialflow-3.3.1 → celestialflow-3.3.2}/src/celestialflow/funnel/__init__.py +0 -0
- {celestialflow-3.3.1 → celestialflow-3.3.2}/src/celestialflow/funnel/core_inlet.py +0 -0
- {celestialflow-3.3.1 → celestialflow-3.3.2}/src/celestialflow/funnel/util_count.py +0 -0
- {celestialflow-3.3.1 → celestialflow-3.3.2}/src/celestialflow/graph/__init__.py +0 -0
- {celestialflow-3.3.1 → celestialflow-3.3.2}/src/celestialflow/graph/core_structure.py +0 -0
- {celestialflow-3.3.1 → celestialflow-3.3.2}/src/celestialflow/graph/util_order_graph.py +0 -0
- {celestialflow-3.3.1 → celestialflow-3.3.2}/src/celestialflow/node/__init__.py +0 -0
- {celestialflow-3.3.1 → celestialflow-3.3.2}/src/celestialflow/node/util_callable.py +0 -0
- {celestialflow-3.3.1 → celestialflow-3.3.2}/src/celestialflow/node/util_types.py +0 -0
- {celestialflow-3.3.1/src/celestialflow/graph → celestialflow-3.3.2/src/celestialflow/persist}/util_render.py +0 -0
- {celestialflow-3.3.1 → celestialflow-3.3.2}/src/celestialflow/runtime/core_envelope.py +0 -0
- {celestialflow-3.3.1 → celestialflow-3.3.2}/src/celestialflow/runtime/util_constant.py +0 -0
- {celestialflow-3.3.1 → celestialflow-3.3.2}/src/celestialflow/runtime/util_errors.py +0 -0
- {celestialflow-3.3.1 → celestialflow-3.3.2}/src/celestialflow/runtime/util_event.py +0 -0
- {celestialflow-3.3.1 → celestialflow-3.3.2}/src/celestialflow/runtime/util_format.py +0 -0
- {celestialflow-3.3.1 → celestialflow-3.3.2}/src/celestialflow.egg-info/dependency_links.txt +0 -0
- {celestialflow-3.3.1 → celestialflow-3.3.2}/src/celestialflow.egg-info/requires.txt +0 -0
- {celestialflow-3.3.1 → celestialflow-3.3.2}/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.2
|
|
4
4
|
Summary: A flexible GRAPH-based task orchestration framework.
|
|
5
5
|
Author-email: Mr-xiaotian <mingxiaomingtian@gmail.com>
|
|
6
6
|
License: MIT
|
|
@@ -265,44 +265,45 @@ flowchart TD
|
|
|
265
265
|
## 文件结构(File Structure)
|
|
266
266
|
|
|
267
267
|
```
|
|
268
|
-
📁 CelestialFlow (
|
|
269
|
-
📁 bench (316KB
|
|
270
|
-
📁 [1项排除的目录] (
|
|
268
|
+
📁 CelestialFlow (539MB 107KB 283B)
|
|
269
|
+
📁 bench (316KB 409B)
|
|
270
|
+
📁 [1项排除的目录] (193KB 163B)
|
|
271
271
|
🐍 bench_datastructures.py (6KB 690B)
|
|
272
272
|
🐍 bench_execution_mode.py (2KB 707B)
|
|
273
273
|
🐍 bench_funnel_vs_lock.py (21KB 888B)
|
|
274
274
|
🐍 bench_futures_memory.py (2KB 269B)
|
|
275
|
-
🐍 bench_gil_vs_nogil.py (
|
|
275
|
+
🐍 bench_gil_vs_nogil.py (10KB 552B)
|
|
276
276
|
🐍 bench_graph_mode.py (6KB 614B)
|
|
277
277
|
🐍 bench_hash.py (7KB 67B)
|
|
278
278
|
🐍 bench_hash_container.py (3KB 1009B)
|
|
279
279
|
🐍 bench_hash_memory.py (3KB 655B)
|
|
280
|
-
🐍 bench_http_grpc.py (2KB
|
|
280
|
+
🐍 bench_http_grpc.py (2KB 530B)
|
|
281
281
|
🐍 bench_ipc_queue.py (7KB 104B)
|
|
282
282
|
🐍 bench_lock_overhead.py (9KB 421B)
|
|
283
283
|
🐍 bench_mpqueue_vs_shared_memory.py (13KB 127B)
|
|
284
|
-
🐍 bench_observer.py (
|
|
285
|
-
🐍
|
|
284
|
+
🐍 bench_observer.py (7KB 58B)
|
|
285
|
+
🐍 bench_persist_spout.py (4KB 323B)
|
|
286
286
|
🐍 bench_queue.py (5KB 857B)
|
|
287
287
|
🐍 bench_requests.py (6KB 813B)
|
|
288
288
|
🐍 bench_tqdm.py (1KB 235B)
|
|
289
289
|
🐍 bench_utils.py (543B)
|
|
290
|
-
📁 demo (
|
|
291
|
-
📁 [3项排除的目录]
|
|
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
|
-
📁
|
|
290
|
+
📁 demo (604KB 612B)
|
|
291
|
+
📁 [3项排除的目录] (548KB 510B)
|
|
292
|
+
🐍 demo_executor.py (1KB 557B)
|
|
293
|
+
🐍 demo_funnel.py (2KB 289B)
|
|
294
|
+
🐍 demo_graph.py (2KB 975B)
|
|
295
|
+
🐍 demo_network.py (3KB 756B)
|
|
296
|
+
🐍 demo_nodes.py (3KB 915B)
|
|
297
|
+
🐍 demo_observer.py (2KB 1004B)
|
|
298
|
+
🐍 demo_redis.py (8KB 595B)
|
|
299
|
+
🐍 demo_skip_dedup.py (6KB 286B)
|
|
300
|
+
🐍 demo_structure.py (8KB 448B)
|
|
301
|
+
🐍 demo_utils.py (6KB 263B)
|
|
302
|
+
🐍 demo_web.py (9KB 158B)
|
|
303
|
+
📁 docs (2MB 40KB 774B)
|
|
304
|
+
📁 en[已折叠] (689KB 413B)
|
|
305
|
+
📁 ja[已折叠] (788KB 343B)
|
|
306
|
+
📁 zh-CN[已折叠] (611KB 18B)
|
|
306
307
|
📁 experiments (3KB 21B)
|
|
307
308
|
🐍 experiment_networkx.py (1KB 908B)
|
|
308
309
|
🐍 experiment_tqdm.py (1KB 137B)
|
|
@@ -311,67 +312,55 @@ flowchart TD
|
|
|
311
312
|
📷 logo(old).png (836KB 542B)
|
|
312
313
|
📷 logo.png (122KB 747B)
|
|
313
314
|
📷 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
|
-
|
|
315
|
+
📁 src (1MB 670KB 974B)
|
|
316
|
+
📁 celestialflow[已折叠] (1MB 651KB 430B)
|
|
317
|
+
📁 [1项排除的目录] (19KB 544B)
|
|
318
|
+
📁 tests (3MB 34KB 484B)
|
|
319
|
+
📁 assembly[已折叠] (38KB 341B)
|
|
320
|
+
📁 benchmark[已折叠] (41KB 377B)
|
|
321
|
+
📁 funnel[已折叠] (96KB 339B)
|
|
322
|
+
📁 graph[已折叠] (801KB 83B)
|
|
323
|
+
📁 node[已折叠] (512KB 601B)
|
|
324
|
+
📁 observer[已折叠] (121KB 111B)
|
|
325
|
+
📁 persist[已折叠] (207KB 907B)
|
|
326
|
+
📁 persistence[已折叠] (381KB 89B)
|
|
327
|
+
📁 reporter[已折叠] (171KB 861B)
|
|
328
|
+
📁 runtime[已折叠] (189KB 873B)
|
|
329
|
+
📁 ticker[已折叠] (54KB 761B)
|
|
330
|
+
📁 [1项排除的目录] (488KB 592B)
|
|
331
|
+
🐍 conftest.py (1KB 693B)
|
|
332
|
+
📁 [13项排除的目录] (525MB 488KB 753B)
|
|
328
333
|
❓ .env (468B)
|
|
329
334
|
❓ .gitignore (1KB 315B)
|
|
330
|
-
📝 AGENTS.md (1KB
|
|
335
|
+
📝 AGENTS.md (1KB 1003B)
|
|
331
336
|
❓ LICENSE (1KB 65B)
|
|
332
337
|
❓ Makefile (149B)
|
|
333
|
-
⚙️ pyproject.toml (2KB
|
|
334
|
-
📝 README.md (
|
|
335
|
-
🔒 uv.lock (
|
|
338
|
+
⚙️ pyproject.toml (2KB 858B)
|
|
339
|
+
📝 README.md (16KB 619B)
|
|
340
|
+
🔒 uv.lock (124KB 729B)
|
|
336
341
|
```
|
|
337
342
|
<p align="center">
|
|
338
|
-
<em>celestial-flow 3.3.
|
|
343
|
+
<em>celestial-flow 3.3.2</em>
|
|
339
344
|
</p>
|
|
340
345
|
|
|
341
346
|
(该视图由我的另一个项目[CelestialVault](https://github.com/Mr-xiaotian/CelestialVault)中inst_file.FileTree.print_tree()生成。转换为图片则借助[Carbon](https://carbon.now.sh)。)
|
|
342
347
|
|
|
343
348
|
## 版本日志(Version Log)
|
|
344
|
-
- 3.3.
|
|
349
|
+
- 3.3.2
|
|
345
350
|
- feat:
|
|
346
|
-
- [IMPORTANT]
|
|
347
|
-
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
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` 会有问题, 下个版本解决
|
|
351
|
+
- [IMPORTANT] 大幅扩充 `observer` 机制, 添加更多钩子
|
|
352
|
+
- 添加 `ObserverHub` 进行管理, 其本身也是 `observer`
|
|
353
|
+
- [IMPORTANT] 添加 `ticker` 机制, 以周期性的时间为驱动
|
|
354
|
+
- 作为纯事件驱动的 `observer` 的补充
|
|
355
|
+
- 由于 `reprter` 机制的完全重构, 其开启与使用方法也有所变化
|
|
356
|
+
- 改为在 `.pyproject` 中进行设置
|
|
359
357
|
- refactor:
|
|
360
|
-
- [IMPORTANT]
|
|
361
|
-
|
|
362
|
-
-
|
|
363
|
-
|
|
364
|
-
-
|
|
365
|
-
-
|
|
366
|
-
- 话说我之前为什么要弄那么一套即麻烦又不准的算法?
|
|
367
|
-
- 在 `reporter` 中为 `status` 添加门控, 如果当前状态与上一次发送状态一致, 则不进行发送
|
|
368
|
-
- 至此 `reporter` 中所有的 `push_*` 都拥有门控, 避免无效的数据发送
|
|
369
|
-
- fix:
|
|
370
|
-
- chore:
|
|
371
|
-
- 添加 `bench_funnel_vs_lock`, 用来测试并发环境下, 使用funnel和使用locl记录数据的性能差
|
|
372
|
-
- 前者发送延迟低, 但内存占用高
|
|
373
|
-
- 
|
|
374
|
-
- 添加 `demo_web`, 用于进行复杂结构的web演示
|
|
358
|
+
- [IMPORTANT] 将 `log` / `lifecycle` 归并入新的 `observer` 体系
|
|
359
|
+
- 结构更加简洁高效
|
|
360
|
+
- [IMPORTANT] 将 `reporter` 拆为 完全分离的 `push` 与 `pull`
|
|
361
|
+
- 前者由 `PushInlet` 进行事件化收集 `error` `meta` 数据, 并由 `PushSnapshotHandler` 周期化收集状态信息
|
|
362
|
+
- 后者由 `InjectionHandler` 周期化从服务端收集注入任务与注入终止符
|
|
363
|
+
- 将 `metric` 机制归入 `observer` 体系
|
|
375
364
|
|
|
376
365
|
更多过往日志可看:
|
|
377
366
|
|
|
@@ -246,44 +246,45 @@ flowchart TD
|
|
|
246
246
|
## 文件结构(File Structure)
|
|
247
247
|
|
|
248
248
|
```
|
|
249
|
-
📁 CelestialFlow (
|
|
250
|
-
📁 bench (316KB
|
|
251
|
-
📁 [1项排除的目录] (
|
|
249
|
+
📁 CelestialFlow (539MB 107KB 283B)
|
|
250
|
+
📁 bench (316KB 409B)
|
|
251
|
+
📁 [1项排除的目录] (193KB 163B)
|
|
252
252
|
🐍 bench_datastructures.py (6KB 690B)
|
|
253
253
|
🐍 bench_execution_mode.py (2KB 707B)
|
|
254
254
|
🐍 bench_funnel_vs_lock.py (21KB 888B)
|
|
255
255
|
🐍 bench_futures_memory.py (2KB 269B)
|
|
256
|
-
🐍 bench_gil_vs_nogil.py (
|
|
256
|
+
🐍 bench_gil_vs_nogil.py (10KB 552B)
|
|
257
257
|
🐍 bench_graph_mode.py (6KB 614B)
|
|
258
258
|
🐍 bench_hash.py (7KB 67B)
|
|
259
259
|
🐍 bench_hash_container.py (3KB 1009B)
|
|
260
260
|
🐍 bench_hash_memory.py (3KB 655B)
|
|
261
|
-
🐍 bench_http_grpc.py (2KB
|
|
261
|
+
🐍 bench_http_grpc.py (2KB 530B)
|
|
262
262
|
🐍 bench_ipc_queue.py (7KB 104B)
|
|
263
263
|
🐍 bench_lock_overhead.py (9KB 421B)
|
|
264
264
|
🐍 bench_mpqueue_vs_shared_memory.py (13KB 127B)
|
|
265
|
-
🐍 bench_observer.py (
|
|
266
|
-
🐍
|
|
265
|
+
🐍 bench_observer.py (7KB 58B)
|
|
266
|
+
🐍 bench_persist_spout.py (4KB 323B)
|
|
267
267
|
🐍 bench_queue.py (5KB 857B)
|
|
268
268
|
🐍 bench_requests.py (6KB 813B)
|
|
269
269
|
🐍 bench_tqdm.py (1KB 235B)
|
|
270
270
|
🐍 bench_utils.py (543B)
|
|
271
|
-
📁 demo (
|
|
272
|
-
📁 [3项排除的目录]
|
|
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
|
-
📁
|
|
271
|
+
📁 demo (604KB 612B)
|
|
272
|
+
📁 [3项排除的目录] (548KB 510B)
|
|
273
|
+
🐍 demo_executor.py (1KB 557B)
|
|
274
|
+
🐍 demo_funnel.py (2KB 289B)
|
|
275
|
+
🐍 demo_graph.py (2KB 975B)
|
|
276
|
+
🐍 demo_network.py (3KB 756B)
|
|
277
|
+
🐍 demo_nodes.py (3KB 915B)
|
|
278
|
+
🐍 demo_observer.py (2KB 1004B)
|
|
279
|
+
🐍 demo_redis.py (8KB 595B)
|
|
280
|
+
🐍 demo_skip_dedup.py (6KB 286B)
|
|
281
|
+
🐍 demo_structure.py (8KB 448B)
|
|
282
|
+
🐍 demo_utils.py (6KB 263B)
|
|
283
|
+
🐍 demo_web.py (9KB 158B)
|
|
284
|
+
📁 docs (2MB 40KB 774B)
|
|
285
|
+
📁 en[已折叠] (689KB 413B)
|
|
286
|
+
📁 ja[已折叠] (788KB 343B)
|
|
287
|
+
📁 zh-CN[已折叠] (611KB 18B)
|
|
287
288
|
📁 experiments (3KB 21B)
|
|
288
289
|
🐍 experiment_networkx.py (1KB 908B)
|
|
289
290
|
🐍 experiment_tqdm.py (1KB 137B)
|
|
@@ -292,67 +293,55 @@ flowchart TD
|
|
|
292
293
|
📷 logo(old).png (836KB 542B)
|
|
293
294
|
📷 logo.png (122KB 747B)
|
|
294
295
|
📷 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
|
-
|
|
296
|
+
📁 src (1MB 670KB 974B)
|
|
297
|
+
📁 celestialflow[已折叠] (1MB 651KB 430B)
|
|
298
|
+
📁 [1项排除的目录] (19KB 544B)
|
|
299
|
+
📁 tests (3MB 34KB 484B)
|
|
300
|
+
📁 assembly[已折叠] (38KB 341B)
|
|
301
|
+
📁 benchmark[已折叠] (41KB 377B)
|
|
302
|
+
📁 funnel[已折叠] (96KB 339B)
|
|
303
|
+
📁 graph[已折叠] (801KB 83B)
|
|
304
|
+
📁 node[已折叠] (512KB 601B)
|
|
305
|
+
📁 observer[已折叠] (121KB 111B)
|
|
306
|
+
📁 persist[已折叠] (207KB 907B)
|
|
307
|
+
📁 persistence[已折叠] (381KB 89B)
|
|
308
|
+
📁 reporter[已折叠] (171KB 861B)
|
|
309
|
+
📁 runtime[已折叠] (189KB 873B)
|
|
310
|
+
📁 ticker[已折叠] (54KB 761B)
|
|
311
|
+
📁 [1项排除的目录] (488KB 592B)
|
|
312
|
+
🐍 conftest.py (1KB 693B)
|
|
313
|
+
📁 [13项排除的目录] (525MB 488KB 753B)
|
|
309
314
|
❓ .env (468B)
|
|
310
315
|
❓ .gitignore (1KB 315B)
|
|
311
|
-
📝 AGENTS.md (1KB
|
|
316
|
+
📝 AGENTS.md (1KB 1003B)
|
|
312
317
|
❓ LICENSE (1KB 65B)
|
|
313
318
|
❓ Makefile (149B)
|
|
314
|
-
⚙️ pyproject.toml (2KB
|
|
315
|
-
📝 README.md (
|
|
316
|
-
🔒 uv.lock (
|
|
319
|
+
⚙️ pyproject.toml (2KB 858B)
|
|
320
|
+
📝 README.md (16KB 619B)
|
|
321
|
+
🔒 uv.lock (124KB 729B)
|
|
317
322
|
```
|
|
318
323
|
<p align="center">
|
|
319
|
-
<em>celestial-flow 3.3.
|
|
324
|
+
<em>celestial-flow 3.3.2</em>
|
|
320
325
|
</p>
|
|
321
326
|
|
|
322
327
|
(该视图由我的另一个项目[CelestialVault](https://github.com/Mr-xiaotian/CelestialVault)中inst_file.FileTree.print_tree()生成。转换为图片则借助[Carbon](https://carbon.now.sh)。)
|
|
323
328
|
|
|
324
329
|
## 版本日志(Version Log)
|
|
325
|
-
- 3.3.
|
|
330
|
+
- 3.3.2
|
|
326
331
|
- feat:
|
|
327
|
-
- [IMPORTANT]
|
|
328
|
-
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
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` 会有问题, 下个版本解决
|
|
332
|
+
- [IMPORTANT] 大幅扩充 `observer` 机制, 添加更多钩子
|
|
333
|
+
- 添加 `ObserverHub` 进行管理, 其本身也是 `observer`
|
|
334
|
+
- [IMPORTANT] 添加 `ticker` 机制, 以周期性的时间为驱动
|
|
335
|
+
- 作为纯事件驱动的 `observer` 的补充
|
|
336
|
+
- 由于 `reprter` 机制的完全重构, 其开启与使用方法也有所变化
|
|
337
|
+
- 改为在 `.pyproject` 中进行设置
|
|
340
338
|
- refactor:
|
|
341
|
-
- [IMPORTANT]
|
|
342
|
-
|
|
343
|
-
-
|
|
344
|
-
|
|
345
|
-
-
|
|
346
|
-
-
|
|
347
|
-
- 话说我之前为什么要弄那么一套即麻烦又不准的算法?
|
|
348
|
-
- 在 `reporter` 中为 `status` 添加门控, 如果当前状态与上一次发送状态一致, 则不进行发送
|
|
349
|
-
- 至此 `reporter` 中所有的 `push_*` 都拥有门控, 避免无效的数据发送
|
|
350
|
-
- fix:
|
|
351
|
-
- chore:
|
|
352
|
-
- 添加 `bench_funnel_vs_lock`, 用来测试并发环境下, 使用funnel和使用locl记录数据的性能差
|
|
353
|
-
- 前者发送延迟低, 但内存占用高
|
|
354
|
-
- 
|
|
355
|
-
- 添加 `demo_web`, 用于进行复杂结构的web演示
|
|
339
|
+
- [IMPORTANT] 将 `log` / `lifecycle` 归并入新的 `observer` 体系
|
|
340
|
+
- 结构更加简洁高效
|
|
341
|
+
- [IMPORTANT] 将 `reporter` 拆为 完全分离的 `push` 与 `pull`
|
|
342
|
+
- 前者由 `PushInlet` 进行事件化收集 `error` `meta` 数据, 并由 `PushSnapshotHandler` 周期化收集状态信息
|
|
343
|
+
- 后者由 `InjectionHandler` 周期化从服务端收集注入任务与注入终止符
|
|
344
|
+
- 将 `metric` 机制归入 `observer` 体系
|
|
356
345
|
|
|
357
346
|
更多过往日志可看:
|
|
358
347
|
|
|
@@ -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.2"
|
|
8
8
|
description = "A flexible GRAPH-based task orchestration framework."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = { text = "MIT" }
|
|
@@ -61,6 +61,10 @@ dev = [
|
|
|
61
61
|
|
|
62
62
|
[tool.celestialflow]
|
|
63
63
|
log_level = "INFO"
|
|
64
|
+
# 是否启用上报;默认关闭,需显式开启(开启时 report_url 必填)
|
|
65
|
+
if_report = false
|
|
66
|
+
# 上报服务地址(CelestialFlow Web)
|
|
67
|
+
report_url = "http://127.0.0.1:5005"
|
|
64
68
|
|
|
65
69
|
[tool.pyright]
|
|
66
70
|
include = ["src"]
|
|
@@ -20,18 +20,20 @@ from .node import (
|
|
|
20
20
|
TaskRouter,
|
|
21
21
|
TaskSplitter,
|
|
22
22
|
)
|
|
23
|
-
from .
|
|
24
|
-
from .
|
|
23
|
+
from .observer import Observer, ObserverHub, PrintObserver
|
|
24
|
+
from .persist.util_sqlite import (
|
|
25
25
|
load_records,
|
|
26
|
-
|
|
26
|
+
load_tasks_grouped_by_node,
|
|
27
27
|
)
|
|
28
28
|
from .runtime.util_format import format_table
|
|
29
29
|
from .runtime.util_types import TerminationSignal
|
|
30
|
+
from .ticker import Ticker, TickEvent, TickHandler, TickHub
|
|
30
31
|
|
|
31
32
|
__all__ = [
|
|
32
33
|
"BaseInlet",
|
|
33
|
-
"BaseObserver",
|
|
34
34
|
"BaseSpout",
|
|
35
|
+
"Observer",
|
|
36
|
+
"ObserverHub",
|
|
35
37
|
"PrintObserver",
|
|
36
38
|
"TaskChain",
|
|
37
39
|
"TaskComplete",
|
|
@@ -40,14 +42,17 @@ __all__ = [
|
|
|
40
42
|
"TaskGraph",
|
|
41
43
|
"TaskGrid",
|
|
42
44
|
"TaskLoop",
|
|
43
|
-
"TaskReporter",
|
|
44
45
|
"TaskRouter",
|
|
45
46
|
"TaskSplitter",
|
|
46
47
|
"TaskWheel",
|
|
47
48
|
"TerminationSignal",
|
|
49
|
+
"TickEvent",
|
|
50
|
+
"TickHandler",
|
|
51
|
+
"TickHub",
|
|
52
|
+
"Ticker",
|
|
48
53
|
"benchmark_executor",
|
|
49
54
|
"benchmark_graph",
|
|
50
55
|
"format_table",
|
|
51
56
|
"load_records",
|
|
52
|
-
"
|
|
57
|
+
"load_tasks_grouped_by_node",
|
|
53
58
|
]
|
|
@@ -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
|
+
]
|
|
@@ -0,0 +1,143 @@
|
|
|
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
|
+
from pathlib import Path
|
|
8
|
+
|
|
9
|
+
import requests
|
|
10
|
+
|
|
11
|
+
from ..observer import MetricsObserver, ObserverHub
|
|
12
|
+
from ..persist.core_lifecycle import LifecycleInlet, LifecycleSpout
|
|
13
|
+
from ..persist.core_log import LogInlet, LogSpout
|
|
14
|
+
from ..reporter import (
|
|
15
|
+
InjectionHandler,
|
|
16
|
+
InjectionTarget,
|
|
17
|
+
PushInlet,
|
|
18
|
+
PushSnapshotHandler,
|
|
19
|
+
PushSpout,
|
|
20
|
+
)
|
|
21
|
+
from ..runtime.util_config import (
|
|
22
|
+
load_if_report_from_pyproject,
|
|
23
|
+
load_log_level_from_pyproject,
|
|
24
|
+
load_report_url_from_pyproject,
|
|
25
|
+
)
|
|
26
|
+
from ..ticker import Ticker, TickHub
|
|
27
|
+
|
|
28
|
+
_TICK_INTERVAL: float = 1.0
|
|
29
|
+
"""节拍器基准周期(秒)。各处理器以自己的 ``tick_period`` 缩放出实际周期。"""
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
@contextmanager
|
|
33
|
+
def run_graph_resources(
|
|
34
|
+
observers: ObserverHub,
|
|
35
|
+
injection_target: InjectionTarget,
|
|
36
|
+
) -> Generator[Path | None, None, None]:
|
|
37
|
+
"""
|
|
38
|
+
任务图运行期资源:``metrics`` + ``lifecycle`` + ``log``,并按 ``if_report``
|
|
39
|
+
决定是否追加远程上报与注入。
|
|
40
|
+
|
|
41
|
+
指标写模型由本入口创建并注册到 ``observers``,其只读视图交给 ``LogInlet``
|
|
42
|
+
与快照处理器。上报开关从项目级 ``pyproject.toml`` 的
|
|
43
|
+
``[tool.celestialflow]`` 节读取:仅当 ``if_report`` 显式配置为 ``true`` 时启用
|
|
44
|
+
上报,此时本入口自行生成一个不透明的上报会话标识,注册 :class:`PushInlet` 与
|
|
45
|
+
:class:`PushSnapshotHandler`、启动 :class:`PushSpout` 并启动一个以
|
|
46
|
+
:data:`_TICK_INTERVAL` 为基准周期的节拍器,按拍把状态快照推送到远端(并在图
|
|
47
|
+
结束时补推一次终态快照),同时按拍从远端拉取任务注入到 ``injection_target``
|
|
48
|
+
(``report_url`` 未配置时回退到
|
|
49
|
+
:data:`~celestialflow.runtime.util_config.DEFAULT_REPORT_URL`)。
|
|
50
|
+
|
|
51
|
+
退出时先停节拍器再统一停止 spout,保证运行期即使抛出异常也能完成回收。
|
|
52
|
+
|
|
53
|
+
:param observers: 任务图自身的观察者 hub
|
|
54
|
+
:param injection_target: 任务注入目标,通常是任务图自身
|
|
55
|
+
:return: 进入时产出 lifecycle 数据库路径,未就绪时为 ``None``
|
|
56
|
+
"""
|
|
57
|
+
log_level = load_log_level_from_pyproject()
|
|
58
|
+
|
|
59
|
+
metrics_view = MetricsObserver()
|
|
60
|
+
observers.add_observer(metrics_view)
|
|
61
|
+
|
|
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
|
+
push_spout: PushSpout | None = None
|
|
68
|
+
session: requests.Session | None = None
|
|
69
|
+
ticker: Ticker | None = None
|
|
70
|
+
if load_if_report_from_pyproject():
|
|
71
|
+
session_id = uuid.uuid4().hex
|
|
72
|
+
push_spout = PushSpout(session_id, load_report_url_from_pyproject())
|
|
73
|
+
push_inlet = PushInlet().bind_spout(push_spout)
|
|
74
|
+
|
|
75
|
+
session = requests.Session()
|
|
76
|
+
hub = TickHub()
|
|
77
|
+
snapshot_handler = PushSnapshotHandler(metrics_view, push_inlet)
|
|
78
|
+
hub.add_handler(snapshot_handler)
|
|
79
|
+
hub.add_handler(
|
|
80
|
+
InjectionHandler(
|
|
81
|
+
push_spout.base_url,
|
|
82
|
+
session_id,
|
|
83
|
+
injection_target,
|
|
84
|
+
session,
|
|
85
|
+
)
|
|
86
|
+
)
|
|
87
|
+
ticker = Ticker(_TICK_INTERVAL, hub, name="report")
|
|
88
|
+
|
|
89
|
+
# 快照处理器同时观察 on_graph_end 补推终态快照;注册在 PushInlet 之前,
|
|
90
|
+
# 保证终态快照先于 shutdown_session 入队。
|
|
91
|
+
observers.add_observer(snapshot_handler)
|
|
92
|
+
observers.add_observer(push_inlet)
|
|
93
|
+
|
|
94
|
+
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
|
|
102
|
+
finally:
|
|
103
|
+
if ticker is not None:
|
|
104
|
+
ticker.stop()
|
|
105
|
+
lifecycle_spout.stop()
|
|
106
|
+
log_spout.stop()
|
|
107
|
+
if push_spout is not None:
|
|
108
|
+
push_spout.stop()
|
|
109
|
+
if session is not None:
|
|
110
|
+
session.close()
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
@contextmanager
|
|
114
|
+
def run_node_resources(
|
|
115
|
+
observers: ObserverHub,
|
|
116
|
+
) -> Generator[Path | None, None, None]:
|
|
117
|
+
"""
|
|
118
|
+
单节点运行期资源:内部创建并注册指标观察者,仅装配 ``lifecycle`` + ``log``。
|
|
119
|
+
|
|
120
|
+
独立运行的节点不产生图结构、也不参与图级上报,因此本入口既不接收会话标识,
|
|
121
|
+
也不装配推送通道、节拍器或注入目标;指标观察者由本入口创建并注册,运行结束后
|
|
122
|
+
无需外部持有。退出时统一停止 spout,保证运行期即使抛出异常也能完成回收。
|
|
123
|
+
|
|
124
|
+
:param observers: 节点自身的观察者 hub
|
|
125
|
+
:return: 进入时产出 lifecycle 数据库路径,未就绪时为 ``None``
|
|
126
|
+
"""
|
|
127
|
+
log_level = load_log_level_from_pyproject()
|
|
128
|
+
|
|
129
|
+
metrics_view = MetricsObserver()
|
|
130
|
+
observers.add_observer(metrics_view)
|
|
131
|
+
|
|
132
|
+
lifecycle_spout = LifecycleSpout()
|
|
133
|
+
log_spout = LogSpout()
|
|
134
|
+
observers.add_observer(LifecycleInlet().bind_spout(lifecycle_spout))
|
|
135
|
+
observers.add_observer(LogInlet(metrics_view, log_level).bind_spout(log_spout))
|
|
136
|
+
|
|
137
|
+
try:
|
|
138
|
+
lifecycle_spout.start()
|
|
139
|
+
log_spout.start()
|
|
140
|
+
yield lifecycle_spout.db_path
|
|
141
|
+
finally:
|
|
142
|
+
lifecycle_spout.stop()
|
|
143
|
+
log_spout.stop()
|
|
@@ -82,7 +82,7 @@ async def benchmark_graph(
|
|
|
82
82
|
execution_modes = execution_modes or ["serial", "thread", "async"]
|
|
83
83
|
|
|
84
84
|
base_tasks: dict[str, list[Any]] = {
|
|
85
|
-
|
|
85
|
+
node_name: list(tasks) for node_name, tasks in init_tasks_dict.items()
|
|
86
86
|
}
|
|
87
87
|
|
|
88
88
|
test_table_list: list[list[float]] = []
|
|
@@ -100,7 +100,7 @@ async def benchmark_graph(
|
|
|
100
100
|
cloned_graph.set_node_execution_mode(execution_mode)
|
|
101
101
|
|
|
102
102
|
run_tasks: dict[str, Iterable[Any]] = {
|
|
103
|
-
|
|
103
|
+
node_name: list(tasks) for node_name, tasks in base_tasks.items()
|
|
104
104
|
}
|
|
105
105
|
start_time = time.perf_counter()
|
|
106
106
|
if graph_mode == "async":
|