forked from ChunelFeng/CGraph
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathT09-Aspect.py
More file actions
32 lines (23 loc) · 754 Bytes
/
T09-Aspect.py
File metadata and controls
32 lines (23 loc) · 754 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
32
"""
@Author: Chunel
@Contact: chunel@foxmail.com
@File: T09-Aspect
@Time: 2025/3/5 23:31
@Desc:
"""
from PyCGraph import GPipeline, GAspect, GCluster
from MyGNode.MyNode1 import MyNode1
from MyGNode.MyNode2 import MyNode2
from MyGAspect.MyTimerAspect import MyTimerAspect
def tutorial_aspect():
a, b1, b2, c = MyNode1(), MyNode2('nodeB1'), MyNode1('nodeB2'), MyNode2()
b_cluster = GCluster([b1, b2])
a.addGAspect(MyTimerAspect())
b_cluster.addGAspect(MyTimerAspect())
pipeline = GPipeline()
pipeline.registerGElement(a, set(), 'nodeA')
pipeline.registerGElement(b_cluster, {a}, 'regionB')
pipeline.registerGElement(c, {b_cluster}, 'nodeC')
pipeline.process()
if __name__ == '__main__':
tutorial_aspect()