forked from ChunelFeng/CGraph
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathT02-Cluster.py
More file actions
31 lines (22 loc) · 822 Bytes
/
T02-Cluster.py
File metadata and controls
31 lines (22 loc) · 822 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
"""
@Author: Chunel
@Contact: chunel@foxmail.com
@File: T02-Cluster
@Time: 2025/2/22 11:40
@Desc:
"""
from PyCGraph import GPipeline, GCluster
from MyGNode.MyNode1 import MyNode1
from MyGNode.MyNode2 import MyNode2
def tutorial_cluster():
b1, b2, b3 = MyNode1("nodeB1"), MyNode1("nodeB2", 3), MyNode2("nodeB3")
b_cluster = GCluster([b1, b2, b3]) # 入参为 list[] 表示写入 group(当前为 cluster) 中的内容,而非依赖内容
pipeline = GPipeline()
a, c, d = MyNode1(), MyNode2(), MyNode1()
pipeline.registerGElement(a, set(), "nodeA")
pipeline.registerGElement(b_cluster, {a}, "clusterB", 2)
pipeline.registerGElement(c, {a}, "nodeC")
pipeline.registerGElement(d, {b_cluster, c}, "nodeD", 2)
pipeline.process()
if __name__ == '__main__':
tutorial_cluster()