celestialflow 3.3.4__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.
- {celestialflow-3.3.4/src/celestialflow.egg-info → celestialflow-3.3.5}/PKG-INFO +63 -50
- {celestialflow-3.3.4 → celestialflow-3.3.5}/README.md +62 -49
- {celestialflow-3.3.4 → celestialflow-3.3.5}/pyproject.toml +1 -1
- {celestialflow-3.3.4 → celestialflow-3.3.5}/src/celestialflow/__init__.py +2 -2
- celestialflow-3.3.5/src/celestialflow/assembly/__init__.py +13 -0
- celestialflow-3.3.5/src/celestialflow/assembly/core_run.py +140 -0
- {celestialflow-3.3.4 → celestialflow-3.3.5}/src/celestialflow/benchmark/util_benchmark.py +3 -3
- celestialflow-3.3.5/src/celestialflow/benchmark/util_clone.py +127 -0
- {celestialflow-3.3.4 → celestialflow-3.3.5}/src/celestialflow/graph/core_graph.py +90 -18
- {celestialflow-3.3.4 → celestialflow-3.3.5}/src/celestialflow/node/core_node.py +52 -11
- {celestialflow-3.3.4 → celestialflow-3.3.5}/src/celestialflow/node/core_nodes.py +4 -1
- {celestialflow-3.3.4 → celestialflow-3.3.5}/src/celestialflow/observer/core_event.py +4 -0
- {celestialflow-3.3.4 → celestialflow-3.3.5}/src/celestialflow/observer/core_hub.py +35 -0
- {celestialflow-3.3.4 → celestialflow-3.3.5}/src/celestialflow/observer/core_observer.py +26 -0
- {celestialflow-3.3.4 → celestialflow-3.3.5}/src/celestialflow/observer/core_print.py +1 -1
- celestialflow-3.3.5/src/celestialflow/persist/core_lifecycle.py +495 -0
- {celestialflow-3.3.4 → celestialflow-3.3.5}/src/celestialflow/persist/core_log.py +1 -1
- {celestialflow-3.3.4 → celestialflow-3.3.5}/src/celestialflow/persist/util_render.py +1 -1
- celestialflow-3.3.5/src/celestialflow/persist/util_sqlite.py +624 -0
- celestialflow-3.3.5/src/celestialflow/reporter/__init__.py +35 -0
- {celestialflow-3.3.4 → celestialflow-3.3.5}/src/celestialflow/reporter/core_inject.py +97 -77
- celestialflow-3.3.5/src/celestialflow/reporter/core_push.py +325 -0
- celestialflow-3.3.5/src/celestialflow/reporter/core_snapshot.py +52 -0
- celestialflow-3.3.5/src/celestialflow/reporter/util_snapshot.py +34 -0
- {celestialflow-3.3.4 → celestialflow-3.3.5}/src/celestialflow/runtime/__init__.py +17 -17
- {celestialflow-3.3.4 → celestialflow-3.3.5}/src/celestialflow/runtime/util_format.py +17 -6
- {celestialflow-3.3.4 → celestialflow-3.3.5}/src/celestialflow/runtime/util_types.py +1 -1
- celestialflow-3.3.5/src/celestialflow/ticker/__init__.py +21 -0
- celestialflow-3.3.4/src/celestialflow/ticker/core_ticker.py → celestialflow-3.3.5/src/celestialflow/ticker/core_clock.py +59 -79
- {celestialflow-3.3.4 → celestialflow-3.3.5}/src/celestialflow/ticker/core_event.py +1 -9
- celestialflow-3.3.5/src/celestialflow/ticker/core_hub.py +227 -0
- celestialflow-3.3.5/src/celestialflow/ticker/core_ticker.py +108 -0
- {celestialflow-3.3.4 → celestialflow-3.3.5/src/celestialflow.egg-info}/PKG-INFO +63 -50
- {celestialflow-3.3.4 → celestialflow-3.3.5}/src/celestialflow.egg-info/SOURCES.txt +2 -1
- celestialflow-3.3.4/src/celestialflow/assembly/__init__.py +0 -13
- celestialflow-3.3.4/src/celestialflow/assembly/core_run.py +0 -161
- celestialflow-3.3.4/src/celestialflow/benchmark/util_clone.py +0 -103
- celestialflow-3.3.4/src/celestialflow/persist/core_lifecycle.py +0 -325
- celestialflow-3.3.4/src/celestialflow/persist/util_sqlite.py +0 -415
- celestialflow-3.3.4/src/celestialflow/reporter/__init__.py +0 -23
- celestialflow-3.3.4/src/celestialflow/reporter/core_push.py +0 -253
- celestialflow-3.3.4/src/celestialflow/reporter/core_snapshot.py +0 -92
- celestialflow-3.3.4/src/celestialflow/ticker/__init__.py +0 -18
- celestialflow-3.3.4/src/celestialflow/ticker/core_handler.py +0 -87
- celestialflow-3.3.4/src/celestialflow/ticker/core_hub.py +0 -99
- {celestialflow-3.3.4 → celestialflow-3.3.5}/LICENSE +0 -0
- {celestialflow-3.3.4 → celestialflow-3.3.5}/setup.cfg +0 -0
- {celestialflow-3.3.4 → celestialflow-3.3.5}/src/celestialflow/benchmark/__init__.py +0 -0
- {celestialflow-3.3.4 → celestialflow-3.3.5}/src/celestialflow/funnel/__init__.py +0 -0
- {celestialflow-3.3.4 → celestialflow-3.3.5}/src/celestialflow/funnel/core_inlet.py +0 -0
- {celestialflow-3.3.4 → celestialflow-3.3.5}/src/celestialflow/funnel/core_spout.py +0 -0
- {celestialflow-3.3.4 → celestialflow-3.3.5}/src/celestialflow/funnel/util_count.py +0 -0
- {celestialflow-3.3.4 → celestialflow-3.3.5}/src/celestialflow/graph/__init__.py +0 -0
- {celestialflow-3.3.4 → celestialflow-3.3.5}/src/celestialflow/graph/core_structure.py +0 -0
- {celestialflow-3.3.4 → celestialflow-3.3.5}/src/celestialflow/graph/util_order_graph.py +0 -0
- {celestialflow-3.3.4 → celestialflow-3.3.5}/src/celestialflow/node/__init__.py +0 -0
- {celestialflow-3.3.4 → celestialflow-3.3.5}/src/celestialflow/node/core_dispatch.py +0 -0
- {celestialflow-3.3.4 → celestialflow-3.3.5}/src/celestialflow/node/util_callable.py +0 -0
- {celestialflow-3.3.4 → celestialflow-3.3.5}/src/celestialflow/node/util_types.py +0 -0
- {celestialflow-3.3.4 → celestialflow-3.3.5}/src/celestialflow/observer/__init__.py +0 -0
- {celestialflow-3.3.4 → celestialflow-3.3.5}/src/celestialflow/observer/core_metrics.py +0 -0
- {celestialflow-3.3.4 → celestialflow-3.3.5}/src/celestialflow/persist/__init__.py +0 -0
- {celestialflow-3.3.4 → celestialflow-3.3.5}/src/celestialflow/persist/util_payload.py +0 -0
- {celestialflow-3.3.4 → celestialflow-3.3.5}/src/celestialflow/runtime/core_config.py +0 -0
- {celestialflow-3.3.4 → celestialflow-3.3.5}/src/celestialflow/runtime/core_envelope.py +0 -0
- {celestialflow-3.3.4 → celestialflow-3.3.5}/src/celestialflow/runtime/core_queue.py +0 -0
- {celestialflow-3.3.4 → celestialflow-3.3.5}/src/celestialflow/runtime/util_constant.py +0 -0
- {celestialflow-3.3.4 → celestialflow-3.3.5}/src/celestialflow/runtime/util_errors.py +0 -0
- {celestialflow-3.3.4 → celestialflow-3.3.5}/src/celestialflow/runtime/util_event.py +0 -0
- {celestialflow-3.3.4 → celestialflow-3.3.5}/src/celestialflow/runtime/util_log_level.py +0 -0
- {celestialflow-3.3.4 → celestialflow-3.3.5}/src/celestialflow.egg-info/dependency_links.txt +0 -0
- {celestialflow-3.3.4 → celestialflow-3.3.5}/src/celestialflow.egg-info/requires.txt +0 -0
- {celestialflow-3.3.4 → 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
|
+
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
|
|
@@ -269,46 +269,48 @@ flowchart TD
|
|
|
269
269
|
## 文件结构(File Structure)
|
|
270
270
|
|
|
271
271
|
```
|
|
272
|
-
📁 CelestialFlow (
|
|
273
|
-
📁 bench (
|
|
274
|
-
📁 [1项排除的目录] (
|
|
272
|
+
📁 CelestialFlow (769MB 928KB 138B)
|
|
273
|
+
📁 bench (361KB 634B)
|
|
274
|
+
📁 [1项排除的目录] (236KB 964B)
|
|
275
275
|
🐍 bench_datastructures.py (6KB 690B)
|
|
276
276
|
🐍 bench_execution_mode.py (2KB 707B)
|
|
277
277
|
🐍 bench_funnel_vs_lock.py (21KB 885B)
|
|
278
278
|
🐍 bench_futures_memory.py (2KB 269B)
|
|
279
|
-
🐍 bench_gil_vs_nogil.py (10KB
|
|
280
|
-
🐍 bench_graph_mode.py (
|
|
279
|
+
🐍 bench_gil_vs_nogil.py (10KB 524B)
|
|
280
|
+
🐍 bench_graph_mode.py (8KB 723B)
|
|
281
281
|
🐍 bench_hash.py (7KB 67B)
|
|
282
282
|
🐍 bench_hash_container.py (3KB 1009B)
|
|
283
283
|
🐍 bench_hash_memory.py (3KB 655B)
|
|
284
|
-
🐍 bench_http_grpc.py (2KB
|
|
284
|
+
🐍 bench_http_grpc.py (2KB 515B)
|
|
285
285
|
🐍 bench_ipc_queue.py (7KB 104B)
|
|
286
286
|
🐍 bench_lock_overhead.py (9KB 421B)
|
|
287
287
|
🐍 bench_mpqueue_vs_shared_memory.py (13KB 127B)
|
|
288
288
|
🐍 bench_observer.py (6KB 657B)
|
|
289
|
-
🐍 bench_persist_spout.py (4KB
|
|
289
|
+
🐍 bench_persist_spout.py (4KB 109B)
|
|
290
290
|
🐍 bench_queue.py (5KB 857B)
|
|
291
291
|
🐍 bench_requests.py (6KB 813B)
|
|
292
292
|
🐍 bench_tqdm.py (1KB 235B)
|
|
293
293
|
🐍 bench_utils.py (543B)
|
|
294
|
-
📁 demo (
|
|
295
|
-
📁 [4项排除的目录] (
|
|
294
|
+
📁 demo (819KB 210B)
|
|
295
|
+
📁 [4项排除的目录] (759KB 220B)
|
|
296
|
+
🐍 demo_ctree.py (6KB 985B)
|
|
296
297
|
🐍 demo_executor.py (1KB 557B)
|
|
297
298
|
🐍 demo_funnel.py (2KB 286B)
|
|
298
|
-
🐍 demo_graph.py (2KB
|
|
299
|
+
🐍 demo_graph.py (2KB 481B)
|
|
299
300
|
🐍 demo_network.py (3KB 756B)
|
|
300
|
-
🐍 demo_nodes.py (3KB
|
|
301
|
+
🐍 demo_nodes.py (3KB 770B)
|
|
301
302
|
🐍 demo_observer.py (2KB 445B)
|
|
302
|
-
🐍 demo_redis.py (8KB
|
|
303
|
-
🐍 demo_skip_dedup.py (6KB
|
|
304
|
-
🐍 demo_structure.py (8KB
|
|
305
|
-
🐍 demo_utils.py (
|
|
306
|
-
🐍 demo_web.py (8KB
|
|
307
|
-
📁 docs (2MB
|
|
308
|
-
📁 en[已折叠] (
|
|
309
|
-
📁 ja[已折叠] (
|
|
310
|
-
📁 zh-CN[已折叠] (
|
|
311
|
-
📁 experiments (
|
|
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)
|
|
312
314
|
🐍 experiment_networkx.py (1KB 908B)
|
|
313
315
|
🐍 experiment_tqdm.py (1KB 137B)
|
|
314
316
|
📁 img (5MB 871KB 242B)
|
|
@@ -316,49 +318,60 @@ flowchart TD
|
|
|
316
318
|
📷 logo(old).png (836KB 542B)
|
|
317
319
|
📷 logo.png (122KB 747B)
|
|
318
320
|
📷 scc_condensation.svg (17KB 1B)
|
|
319
|
-
📁 src (1MB
|
|
320
|
-
📁 celestialflow[已折叠] (1MB
|
|
321
|
-
📁 [1项排除的目录] (19KB
|
|
322
|
-
📁 tests (3MB
|
|
323
|
-
📁 assembly[已折叠]
|
|
324
|
-
📁 benchmark[已折叠]
|
|
325
|
-
📁 funnel[已折叠]
|
|
326
|
-
📁 graph[已折叠]
|
|
327
|
-
📁 node[已折叠]
|
|
328
|
-
📁 observer[已折叠]
|
|
329
|
-
📁 persist[已折叠]
|
|
330
|
-
📁 reporter[已折叠]
|
|
331
|
-
📁 runtime[已折叠]
|
|
332
|
-
📁 ticker[已折叠]
|
|
333
|
-
📁 [3项排除的目录]
|
|
334
|
-
🐍 conftest.py
|
|
335
|
-
📁 [12项排除的目录] (
|
|
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)
|
|
336
338
|
❓ .env (484B)
|
|
337
339
|
❓ .gitignore (1KB 315B)
|
|
338
340
|
📝 AGENTS.md (2KB 800B)
|
|
339
341
|
❓ LICENSE (1KB 65B)
|
|
340
342
|
❓ Makefile (149B)
|
|
341
343
|
⚙️ pyproject.toml (2KB 624B)
|
|
342
|
-
📝 README.md (
|
|
343
|
-
🔒 uv.lock (126KB
|
|
344
|
+
📝 README.md (17KB 908B)
|
|
345
|
+
🔒 uv.lock (126KB 841B)
|
|
344
346
|
```
|
|
345
347
|
<p align="center">
|
|
346
|
-
<em>celestial-flow 3.3.
|
|
348
|
+
<em>celestial-flow 3.3.5</em>
|
|
347
349
|
</p>
|
|
348
350
|
|
|
349
351
|
(该视图由我的另一个项目[CelestialVault](https://github.com/Mr-xiaotian/CelestialVault)中inst_file.FileTree.print_tree()生成。转换为图片则借助[Carbon](https://carbon.now.sh)。)
|
|
350
352
|
|
|
351
353
|
## 版本日志(Version Log)
|
|
352
|
-
- 3.3.
|
|
354
|
+
- 3.3.5
|
|
353
355
|
- feat:
|
|
354
|
-
- 在 `
|
|
356
|
+
- [IMPORTANT] 在lifecycle的sqlite中多添加 `event` 与 `parent_evnet` 两张表
|
|
357
|
+
- 用于在无外部 `celestiaftree` 的情况下记录事件因果关系
|
|
358
|
+
- `graph` 和 `node` 中都可以通过 `add_ticker` 来自主添加 `Ticker`, 并且在 `*.run` 中新添 `interval` 用于控制 `TickerClock` 的基本间隔
|
|
359
|
+
- `clone_executor` 改名 `clone_node`, 现在可以克隆任意node
|
|
355
360
|
- refactor:
|
|
356
|
-
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
- 在 `
|
|
360
|
-
-
|
|
361
|
-
|
|
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`
|
|
370
|
+
- fix:
|
|
371
|
+
- 修复bench函数因为新加入参数而无法运行的问题
|
|
372
|
+
- chore:
|
|
373
|
+
- 添加 `demo_ctree` 用于展示如何使用 `celestialtree` 库来外部记录事件
|
|
374
|
+
- 在 `bench_graph_mode` 中添加 `bench_graph_3`, 用以展示新 `clone_node`
|
|
362
375
|
|
|
363
376
|
更多过往日志可看:
|
|
364
377
|
|
|
@@ -250,46 +250,48 @@ flowchart TD
|
|
|
250
250
|
## 文件结构(File Structure)
|
|
251
251
|
|
|
252
252
|
```
|
|
253
|
-
📁 CelestialFlow (
|
|
254
|
-
📁 bench (
|
|
255
|
-
📁 [1项排除的目录] (
|
|
253
|
+
📁 CelestialFlow (769MB 928KB 138B)
|
|
254
|
+
📁 bench (361KB 634B)
|
|
255
|
+
📁 [1项排除的目录] (236KB 964B)
|
|
256
256
|
🐍 bench_datastructures.py (6KB 690B)
|
|
257
257
|
🐍 bench_execution_mode.py (2KB 707B)
|
|
258
258
|
🐍 bench_funnel_vs_lock.py (21KB 885B)
|
|
259
259
|
🐍 bench_futures_memory.py (2KB 269B)
|
|
260
|
-
🐍 bench_gil_vs_nogil.py (10KB
|
|
261
|
-
🐍 bench_graph_mode.py (
|
|
260
|
+
🐍 bench_gil_vs_nogil.py (10KB 524B)
|
|
261
|
+
🐍 bench_graph_mode.py (8KB 723B)
|
|
262
262
|
🐍 bench_hash.py (7KB 67B)
|
|
263
263
|
🐍 bench_hash_container.py (3KB 1009B)
|
|
264
264
|
🐍 bench_hash_memory.py (3KB 655B)
|
|
265
|
-
🐍 bench_http_grpc.py (2KB
|
|
265
|
+
🐍 bench_http_grpc.py (2KB 515B)
|
|
266
266
|
🐍 bench_ipc_queue.py (7KB 104B)
|
|
267
267
|
🐍 bench_lock_overhead.py (9KB 421B)
|
|
268
268
|
🐍 bench_mpqueue_vs_shared_memory.py (13KB 127B)
|
|
269
269
|
🐍 bench_observer.py (6KB 657B)
|
|
270
|
-
🐍 bench_persist_spout.py (4KB
|
|
270
|
+
🐍 bench_persist_spout.py (4KB 109B)
|
|
271
271
|
🐍 bench_queue.py (5KB 857B)
|
|
272
272
|
🐍 bench_requests.py (6KB 813B)
|
|
273
273
|
🐍 bench_tqdm.py (1KB 235B)
|
|
274
274
|
🐍 bench_utils.py (543B)
|
|
275
|
-
📁 demo (
|
|
276
|
-
📁 [4项排除的目录] (
|
|
275
|
+
📁 demo (819KB 210B)
|
|
276
|
+
📁 [4项排除的目录] (759KB 220B)
|
|
277
|
+
🐍 demo_ctree.py (6KB 985B)
|
|
277
278
|
🐍 demo_executor.py (1KB 557B)
|
|
278
279
|
🐍 demo_funnel.py (2KB 286B)
|
|
279
|
-
🐍 demo_graph.py (2KB
|
|
280
|
+
🐍 demo_graph.py (2KB 481B)
|
|
280
281
|
🐍 demo_network.py (3KB 756B)
|
|
281
|
-
🐍 demo_nodes.py (3KB
|
|
282
|
+
🐍 demo_nodes.py (3KB 770B)
|
|
282
283
|
🐍 demo_observer.py (2KB 445B)
|
|
283
|
-
🐍 demo_redis.py (8KB
|
|
284
|
-
🐍 demo_skip_dedup.py (6KB
|
|
285
|
-
🐍 demo_structure.py (8KB
|
|
286
|
-
🐍 demo_utils.py (
|
|
287
|
-
🐍 demo_web.py (8KB
|
|
288
|
-
📁 docs (2MB
|
|
289
|
-
📁 en[已折叠] (
|
|
290
|
-
📁 ja[已折叠] (
|
|
291
|
-
📁 zh-CN[已折叠] (
|
|
292
|
-
📁 experiments (
|
|
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)
|
|
293
295
|
🐍 experiment_networkx.py (1KB 908B)
|
|
294
296
|
🐍 experiment_tqdm.py (1KB 137B)
|
|
295
297
|
📁 img (5MB 871KB 242B)
|
|
@@ -297,49 +299,60 @@ flowchart TD
|
|
|
297
299
|
📷 logo(old).png (836KB 542B)
|
|
298
300
|
📷 logo.png (122KB 747B)
|
|
299
301
|
📷 scc_condensation.svg (17KB 1B)
|
|
300
|
-
📁 src (1MB
|
|
301
|
-
📁 celestialflow[已折叠] (1MB
|
|
302
|
-
📁 [1项排除的目录] (19KB
|
|
303
|
-
📁 tests (3MB
|
|
304
|
-
📁 assembly[已折叠]
|
|
305
|
-
📁 benchmark[已折叠]
|
|
306
|
-
📁 funnel[已折叠]
|
|
307
|
-
📁 graph[已折叠]
|
|
308
|
-
📁 node[已折叠]
|
|
309
|
-
📁 observer[已折叠]
|
|
310
|
-
📁 persist[已折叠]
|
|
311
|
-
📁 reporter[已折叠]
|
|
312
|
-
📁 runtime[已折叠]
|
|
313
|
-
📁 ticker[已折叠]
|
|
314
|
-
📁 [3项排除的目录]
|
|
315
|
-
🐍 conftest.py
|
|
316
|
-
📁 [12项排除的目录] (
|
|
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)
|
|
317
319
|
❓ .env (484B)
|
|
318
320
|
❓ .gitignore (1KB 315B)
|
|
319
321
|
📝 AGENTS.md (2KB 800B)
|
|
320
322
|
❓ LICENSE (1KB 65B)
|
|
321
323
|
❓ Makefile (149B)
|
|
322
324
|
⚙️ pyproject.toml (2KB 624B)
|
|
323
|
-
📝 README.md (
|
|
324
|
-
🔒 uv.lock (126KB
|
|
325
|
+
📝 README.md (17KB 908B)
|
|
326
|
+
🔒 uv.lock (126KB 841B)
|
|
325
327
|
```
|
|
326
328
|
<p align="center">
|
|
327
|
-
<em>celestial-flow 3.3.
|
|
329
|
+
<em>celestial-flow 3.3.5</em>
|
|
328
330
|
</p>
|
|
329
331
|
|
|
330
332
|
(该视图由我的另一个项目[CelestialVault](https://github.com/Mr-xiaotian/CelestialVault)中inst_file.FileTree.print_tree()生成。转换为图片则借助[Carbon](https://carbon.now.sh)。)
|
|
331
333
|
|
|
332
334
|
## 版本日志(Version Log)
|
|
333
|
-
- 3.3.
|
|
335
|
+
- 3.3.5
|
|
334
336
|
- feat:
|
|
335
|
-
- 在 `
|
|
337
|
+
- [IMPORTANT] 在lifecycle的sqlite中多添加 `event` 与 `parent_evnet` 两张表
|
|
338
|
+
- 用于在无外部 `celestiaftree` 的情况下记录事件因果关系
|
|
339
|
+
- `graph` 和 `node` 中都可以通过 `add_ticker` 来自主添加 `Ticker`, 并且在 `*.run` 中新添 `interval` 用于控制 `TickerClock` 的基本间隔
|
|
340
|
+
- `clone_executor` 改名 `clone_node`, 现在可以克隆任意node
|
|
336
341
|
- refactor:
|
|
337
|
-
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
- 在 `
|
|
341
|
-
-
|
|
342
|
-
|
|
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`
|
|
351
|
+
- fix:
|
|
352
|
+
- 修复bench函数因为新加入参数而无法运行的问题
|
|
353
|
+
- chore:
|
|
354
|
+
- 添加 `demo_ctree` 用于展示如何使用 `celestialtree` 库来外部记录事件
|
|
355
|
+
- 在 `bench_graph_mode` 中添加 `bench_graph_3`, 用以展示新 `clone_node`
|
|
343
356
|
|
|
344
357
|
更多过往日志可看:
|
|
345
358
|
|
|
@@ -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,
|
|
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
|
|
12
|
+
from .util_clone import clone_graph, clone_node
|
|
13
13
|
|
|
14
14
|
type AnyTaskExecutor = TaskExecutor[Any, Any]
|
|
15
15
|
|
|
@@ -35,9 +35,9 @@ 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 =
|
|
38
|
+
cloned_executor = clone_node(async_executor)
|
|
39
39
|
else:
|
|
40
|
-
cloned_executor =
|
|
40
|
+
cloned_executor = clone_node(sync_executor)
|
|
41
41
|
cloned_executor.set_execution_mode(mode)
|
|
42
42
|
|
|
43
43
|
start_perf = time.perf_counter()
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
# benchmark/util_clone.py
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
|
|
4
|
+
from typing import Any, cast, overload
|
|
5
|
+
|
|
6
|
+
from ..graph import TaskGraph
|
|
7
|
+
from ..node import TaskExecutor, TaskRouter, TaskSplitter
|
|
8
|
+
from ..node.util_types import AnyTaskNode
|
|
9
|
+
from ..runtime.util_errors import ConfigurationError
|
|
10
|
+
from ..runtime.util_event import clone_event_client
|
|
11
|
+
|
|
12
|
+
type CloneableTaskNode = (
|
|
13
|
+
TaskExecutor[Any, Any] | TaskSplitter[Any, Any] | TaskRouter[Any, Any]
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def _get_clone_init_kwargs(
|
|
18
|
+
node: CloneableTaskNode,
|
|
19
|
+
) -> dict[str, Any]:
|
|
20
|
+
"""
|
|
21
|
+
获取克隆节点的初始化参数。
|
|
22
|
+
|
|
23
|
+
:param node: 要克隆的节点
|
|
24
|
+
:return: 克隆节点的初始化参数
|
|
25
|
+
"""
|
|
26
|
+
return {
|
|
27
|
+
"name": node.get_name(),
|
|
28
|
+
"func": node.func,
|
|
29
|
+
"execution_mode": node.execution_mode,
|
|
30
|
+
"max_workers": node.max_workers,
|
|
31
|
+
"max_retries": node.max_retries,
|
|
32
|
+
"max_queue_size": node.max_queue_size,
|
|
33
|
+
"max_info": node.max_info,
|
|
34
|
+
"skip_func": node.skip_func,
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
@overload
|
|
39
|
+
def clone_node[T, R](
|
|
40
|
+
node: TaskExecutor[T, R],
|
|
41
|
+
) -> TaskExecutor[T, R]: ...
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
@overload
|
|
45
|
+
def clone_node[T, RItem](
|
|
46
|
+
node: TaskSplitter[T, RItem],
|
|
47
|
+
) -> TaskSplitter[T, RItem]: ...
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
@overload
|
|
51
|
+
def clone_node[T, Y](
|
|
52
|
+
node: TaskRouter[T, Y],
|
|
53
|
+
) -> TaskRouter[T, Y]: ...
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
def clone_node(
|
|
57
|
+
node: CloneableTaskNode,
|
|
58
|
+
) -> CloneableTaskNode:
|
|
59
|
+
"""
|
|
60
|
+
克隆内置任务节点。
|
|
61
|
+
|
|
62
|
+
benchmark 场景仅支持框架内置的 ``TaskExecutor`` / ``TaskSplitter`` /
|
|
63
|
+
``TaskRouter``。克隆体不会复用原节点的观察者、队列与事件客户端。
|
|
64
|
+
|
|
65
|
+
:param node: 要克隆的节点,调用方需保证其为上述三种内置节点之一
|
|
66
|
+
:return: 克隆节点
|
|
67
|
+
"""
|
|
68
|
+
kwargs = _get_clone_init_kwargs(node)
|
|
69
|
+
if isinstance(node, TaskExecutor):
|
|
70
|
+
cloned = cast(CloneableTaskNode, TaskExecutor(**kwargs))
|
|
71
|
+
elif isinstance(node, TaskSplitter):
|
|
72
|
+
cloned = cast(CloneableTaskNode, TaskSplitter(**kwargs))
|
|
73
|
+
else:
|
|
74
|
+
cloned = cast(CloneableTaskNode, TaskRouter(**kwargs))
|
|
75
|
+
|
|
76
|
+
cloned.set_retry_exceptions(*node.retry_exceptions)
|
|
77
|
+
return cloned
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
def clone_graph(graph: TaskGraph) -> TaskGraph:
|
|
81
|
+
"""
|
|
82
|
+
克隆任务图
|
|
83
|
+
|
|
84
|
+
该工具仅用于 benchmark 场景,因此只支持由内置节点
|
|
85
|
+
``TaskExecutor`` / ``TaskSplitter`` / ``TaskRouter`` 组成的任务图,并直接复用
|
|
86
|
+
:func:`clone_node` 克隆所有节点。克隆会覆盖图中已注册的全部节点,因此非连通
|
|
87
|
+
分量与无源环图也能被完整复制。
|
|
88
|
+
|
|
89
|
+
克隆体不携带原图 / 原节点的观察者:``clone_node`` 会创建全新实例,共享带
|
|
90
|
+
计数器的观察者会导致重复计数。
|
|
91
|
+
|
|
92
|
+
:param graph: 要克隆的任务图
|
|
93
|
+
:return: 克隆任务图
|
|
94
|
+
:raises ConfigurationError: 图中包含不受支持的节点类型时抛出
|
|
95
|
+
"""
|
|
96
|
+
ordered_nodes: list[CloneableTaskNode] = []
|
|
97
|
+
for node_name in graph.get_nodes():
|
|
98
|
+
node: AnyTaskNode = graph.node_dict[node_name]
|
|
99
|
+
if not isinstance(node, TaskExecutor | TaskSplitter | TaskRouter):
|
|
100
|
+
raise ConfigurationError(
|
|
101
|
+
"clone_graph() only supports graphs composed of TaskExecutor, "
|
|
102
|
+
"TaskSplitter, and TaskRouter nodes"
|
|
103
|
+
)
|
|
104
|
+
ordered_nodes.append(node)
|
|
105
|
+
|
|
106
|
+
# 建立原节点名到克隆节点的映射
|
|
107
|
+
name_map: dict[str, CloneableTaskNode] = {}
|
|
108
|
+
for node in ordered_nodes:
|
|
109
|
+
name_map[node.get_name()] = clone_node(node)
|
|
110
|
+
|
|
111
|
+
# 构建新的任务图
|
|
112
|
+
all_cloned_nodes: list[AnyTaskNode] = list(name_map.values())
|
|
113
|
+
|
|
114
|
+
cloned_graph: TaskGraph = TaskGraph(name=graph.name, graph_mode=graph.graph_mode)
|
|
115
|
+
cloned_graph.set_nodes(all_cloned_nodes)
|
|
116
|
+
|
|
117
|
+
# 重建连接
|
|
118
|
+
for from_name, to_names in graph.order_graph.out_edges.items():
|
|
119
|
+
if not to_names:
|
|
120
|
+
continue
|
|
121
|
+
cloned_from: AnyTaskNode = name_map[from_name]
|
|
122
|
+
cloned_to: list[AnyTaskNode] = [name_map[name] for name in to_names]
|
|
123
|
+
cloned_graph.connect([cloned_from], cloned_to)
|
|
124
|
+
|
|
125
|
+
cloned_graph.set_ctree(clone_event_client(graph.ctree_client))
|
|
126
|
+
|
|
127
|
+
return cloned_graph
|