1 Star 0 Fork 2

xinyi61/CGraph

加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
T20-Suspend.py 956 Bytes
一键复制 编辑 原始数据 按行查看 历史
Chunel 提交于 2025-11-08 00:39 +08:00 . [python] change PyCGraph -> pycgraph
"""
@Author: Chunel
@Contact: chunel@foxmail.com
@File: T20-Suspend
@Time: 2025/3/29 00:23
@Desc:
"""
import time
from pycgraph import GPipeline, StdFutureCStatus
from MyGNode.MyNode1 import MyNode1
from MyGNode.MyNode2 import MyNode2
def tutorial_suspend():
pipeline = GPipeline()
a, b, c, d = MyNode1(), MyNode2(), MyNode1(), MyNode2()
pipeline.registerGElement(a, set(), "nodeA")
pipeline.registerGElement(b, {a}, "nodeB")
pipeline.registerGElement(c, {a}, "nodeC")
pipeline.registerGElement(d, {b, c}, "nodeD")
pipeline.init()
result: StdFutureCStatus = pipeline.asyncRun()
print("pipeline async run first time, BEGIN.")
time.sleep(2.6)
print("pipeline async run first time, SUSPEND.")
pipeline.suspend()
time.sleep(7.2)
print("pipeline async run, RESUME after 7200ms.")
pipeline.resume()
result.wait()
pipeline.destroy()
if __name__ == '__main__':
tutorial_suspend()
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/xinyi61/CGraph.git
git@gitee.com:xinyi61/CGraph.git
xinyi61
CGraph
CGraph
main

搜索帮助