From e73a3a86adee1826f1be10622b95269c70f9f695 Mon Sep 17 00:00:00 2001 From: Chunel Date: Fri, 14 Aug 2026 23:01:25 +0800 Subject: [PATCH] [chron] some simple modify, ready for release --- COMPILE.md | 8 ++++---- CONTRIBUTORS.md | 1 + python/tutorial/T01-Simple.py | 3 ++- python/tutorial/T09-Aspect.py | 1 + python/tutorial/T10-AspectParam.py | 1 + python/tutorial/T19-Cancel.py | 6 ++---- python/tutorial/T22-Timeout.py | 4 ++-- src/UtilsCtrl/ThreadPool/UThreadPoolConfig.h | 1 - tutorial/BUILD | 2 ++ tutorial/T01-Simple.cpp | 2 +- tutorial/T05-Param.cpp | 2 +- tutorial/T06-Condition.cpp | 2 +- 12 files changed, 18 insertions(+), 15 deletions(-) diff --git a/COMPILE.md b/COMPILE.md index 1b705792..76f4fe28 100644 --- a/COMPILE.md +++ b/COMPILE.md @@ -105,8 +105,8 @@ * 通过uv安装(Linux/MacOS/Windows) ```shell - $ uv init cgraph_env # 通过uv 创建一个名为 cgraph_env 的环境 - $ cd cgraph_env - $ uv add "pycgraph @ git+https://github.com/ChunelFeng/CGraph.git@main#subdirectory=python" --marker "sys_platform == 'linux'" # 添加 pycgraph 依赖 - $ python3 -c "import pycgraph" # 验证 pycgraph 成功安装 + $ uv init pycgraph_env # 通过uv 创建一个名为 pycgraph_env 项目目录 + $ cd pycgraph_env + $ uv add pycgraph # 添加 pycgraph 依赖 + $ uv run python -c "import pycgraph" # 验证 pycgraph 成功安装 ``` diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index cd1d801b..817104e4 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -35,5 +35,6 @@ Contributors: - [guanquanchen](https://github.com/guanquanchen) - [Linyu](https://github.com/weijinglin) - [billlib](https://github.com/billlib) +- [SimonFoobar648](https://github.com/SimonFoobar648) 感谢以上朋友,为CGraph项目做出的贡献,排名以贡献时间前后为顺序。 diff --git a/python/tutorial/T01-Simple.py b/python/tutorial/T01-Simple.py index 6c84ec6e..3f277129 100644 --- a/python/tutorial/T01-Simple.py +++ b/python/tutorial/T01-Simple.py @@ -22,10 +22,11 @@ def tutorial_simple(): pipeline.registerGElement(d, {b, c}, "nodeD") status: CStatus = pipeline.init() - if status.isErr(): + if not status: # please check api return status # ret_code == 0 is ok, default # ret_code < 0 means error, ex: return CStatus(-1, "my error info") + # never try ret_code > 0 please print('pipeline init failed, error code is {0}, error info is {1}'.format( status.getCode(), status.getInfo())) return diff --git a/python/tutorial/T09-Aspect.py b/python/tutorial/T09-Aspect.py index 691bcdf0..a2e00bc6 100644 --- a/python/tutorial/T09-Aspect.py +++ b/python/tutorial/T09-Aspect.py @@ -24,6 +24,7 @@ def tutorial_aspect(): pipeline.registerGElement(a, set(), 'nodeA') pipeline.registerGElement(b_cluster, {a}, 'regionB') pipeline.registerGElement(c, {b_cluster}, 'nodeC') + pipeline.process() diff --git a/python/tutorial/T10-AspectParam.py b/python/tutorial/T10-AspectParam.py index 59da78f6..e03c474d 100644 --- a/python/tutorial/T10-AspectParam.py +++ b/python/tutorial/T10-AspectParam.py @@ -24,6 +24,7 @@ def tutorial_aspect_param(): pipeline.registerGElement(b, {a}, 'nodeB') pipeline.registerGElement(c, {b}, 'nodeC') pipeline.registerGElement(d, {c}, 'nodeD') + pipeline.process() diff --git a/python/tutorial/T19-Cancel.py b/python/tutorial/T19-Cancel.py index 03143ad0..58e61b92 100644 --- a/python/tutorial/T19-Cancel.py +++ b/python/tutorial/T19-Cancel.py @@ -28,14 +28,12 @@ def tutorial_cancel(): result: StdFutureCStatus = pipeline.asyncRun() print("pipeline async run first time, BEGIN.") result.wait() - print("pipeline async run first time, FINISH.") - print("======================") + print("pipeline async run first time, FINISH ======") result = pipeline.asyncRun() time.sleep(1.5) pipeline.cancel() - print("pipeline async run second time, CANCEL.") - print("======================") + print("pipeline async run second time, CANCEL ======") result.wait() pipeline.destroy() diff --git a/python/tutorial/T22-Timeout.py b/python/tutorial/T22-Timeout.py index a52aae66..279ed841 100644 --- a/python/tutorial/T22-Timeout.py +++ b/python/tutorial/T22-Timeout.py @@ -22,7 +22,7 @@ def tutorial_timeout(): pipeline.registerGElement(d, {b, c}, "nodeD") status: CStatus = pipeline.process() - if status.isOK(): + if status: print("---- T22-timeout.py pipeline run finish \n") c.setTimeout(300) @@ -34,7 +34,7 @@ def tutorial_timeout(): c.setTimeout(0) print("---- set [{0}] no timeout, rerun pipeline again".format(c.getName())) status = pipeline.process() - if status.isOK(): + if status: print("---- T22-timeout.py pipeline run finish again") diff --git a/src/UtilsCtrl/ThreadPool/UThreadPoolConfig.h b/src/UtilsCtrl/ThreadPool/UThreadPoolConfig.h index c7d2fdd0..f22eff1b 100644 --- a/src/UtilsCtrl/ThreadPool/UThreadPoolConfig.h +++ b/src/UtilsCtrl/ThreadPool/UThreadPoolConfig.h @@ -11,7 +11,6 @@ #include -#include "UThreadObject.h" #include "UThreadPoolDefine.h" CGRAPH_NAMESPACE_BEGIN diff --git a/tutorial/BUILD b/tutorial/BUILD index cc2e8bef..934c7e8a 100644 --- a/tutorial/BUILD +++ b/tutorial/BUILD @@ -5,6 +5,7 @@ cc_library( "MyGDaemon/**/*.h", "MyGEvent/**/*.h", "MyGMutable/**/*.h", + "MyGSome/**/*.h", "MyGNode/**/*.h", "MyParams/**/*.h",]), visibility = ["//visibility:public"], @@ -40,6 +41,7 @@ CGRAPH_TUTORIAL_LIST = [ "T26-Mutable", "T27-Trim", "T28-Stage", + "T29-Storage", ] [ diff --git a/tutorial/T01-Simple.cpp b/tutorial/T01-Simple.cpp index f3930350..af307094 100644 --- a/tutorial/T01-Simple.cpp +++ b/tutorial/T01-Simple.cpp @@ -26,7 +26,7 @@ void tutorial_simple() { status += pipeline->registerGElement(&b, {a}, "nodeB"); // 将名为nodeB,依赖a执行的node信息,注册入pipeline中 status += pipeline->registerGElement(&c, {a}, "nodeC"); status += pipeline->registerGElement(&d, {b, c}, "nodeD"); // 将名为nodeD,依赖{b,c}执行的node信息,注册入pipeline中 - if (!status.isOK()) { + if (!status) { return; // 使用时,请对所有CGraph接口的返回值做判定。今后tutorial例子中省略该操作。 } diff --git a/tutorial/T05-Param.cpp b/tutorial/T05-Param.cpp index 659ffe3f..0f9d8c69 100644 --- a/tutorial/T05-Param.cpp +++ b/tutorial/T05-Param.cpp @@ -22,7 +22,7 @@ void tutorial_param() { status += pipeline->registerGElement(&d, {a}, "writeNodeD", 2); // 对param中的iValue值+1,循环执行2次 status += pipeline->registerGElement(&e, {a}, "readNodeE"); status += pipeline->registerGElement(&f, {b, c, d, e}, "writeNodeF"); - if (!status.isOK()) { + if (!status) { return; // 使用时,请对所有CGraph接口的返回值做判定。本例子中省略 } diff --git a/tutorial/T06-Condition.cpp b/tutorial/T06-Condition.cpp index d83f1652..315fa8d3 100644 --- a/tutorial/T06-Condition.cpp +++ b/tutorial/T06-Condition.cpp @@ -36,7 +36,7 @@ void tutorial_condition() { status += pipeline->registerGElement(&b_condition, {a}, "conditionB", 1); status += pipeline->registerGElement(&c, {b_condition}, "readNodeC", 1); status += pipeline->registerGElement(&d_condition, {c}, "conditionD", 1); - if (!status.isOK()) { + if (!status) { return; }