forked from ChunelFeng/CGraph
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMyStageNode.py
More file actions
27 lines (22 loc) · 731 Bytes
/
MyStageNode.py
File metadata and controls
27 lines (22 loc) · 731 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
"""
@Author: Chunel
@Contact: chunel@foxmail.com
@File: MyStageNode
@Time: 2025/4/4 01:16
@Desc:
"""
import time
from datetime import datetime
from PyCGraph import GNode, CStatus
class MyStageNode(GNode):
def __init__(self, before: int, after: int):
super().__init__()
self._before = before
self._after = after
def run(self):
time.sleep(self._before)
print('[{0}] ----> {1} wait {2}s before enter stage'.format(datetime.now(), self.getName(), self._before))
status: CStatus = self.enterStage('stage1')
print('[{0}] <---- {1} wait {2}s after enter stage'.format(datetime.now(), self.getName(), self._after))
time.sleep(self._after)
return status