rainbow-rb-flow-manager 0.0.9.dev5__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- rainbow_rb_flow_manager-0.0.9.dev5/PKG-INFO +142 -0
- rainbow_rb_flow_manager-0.0.9.dev5/README.md +128 -0
- rainbow_rb_flow_manager-0.0.9.dev5/pyproject.toml +33 -0
- rainbow_rb_flow_manager-0.0.9.dev5/setup.cfg +4 -0
- rainbow_rb_flow_manager-0.0.9.dev5/src/rainbow/rb_flow_manager/__init__.py +0 -0
- rainbow_rb_flow_manager-0.0.9.dev5/src/rainbow/rb_flow_manager/context.py +610 -0
- rainbow_rb_flow_manager-0.0.9.dev5/src/rainbow/rb_flow_manager/controller/base_controller.py +88 -0
- rainbow_rb_flow_manager-0.0.9.dev5/src/rainbow/rb_flow_manager/controller/zenoh_controller.py +328 -0
- rainbow_rb_flow_manager-0.0.9.dev5/src/rainbow/rb_flow_manager/example.py +89 -0
- rainbow_rb_flow_manager-0.0.9.dev5/src/rainbow/rb_flow_manager/exception.py +45 -0
- rainbow_rb_flow_manager-0.0.9.dev5/src/rainbow/rb_flow_manager/executor.py +2405 -0
- rainbow_rb_flow_manager-0.0.9.dev5/src/rainbow/rb_flow_manager/global_resolver.py +20 -0
- rainbow_rb_flow_manager-0.0.9.dev5/src/rainbow/rb_flow_manager/py.typed +0 -0
- rainbow_rb_flow_manager-0.0.9.dev5/src/rainbow/rb_flow_manager/schema.py +88 -0
- rainbow_rb_flow_manager-0.0.9.dev5/src/rainbow/rb_flow_manager/step.py +1629 -0
- rainbow_rb_flow_manager-0.0.9.dev5/src/rainbow/rb_flow_manager/utils.py +67 -0
- rainbow_rb_flow_manager-0.0.9.dev5/src/rainbow_rb_flow_manager.egg-info/PKG-INFO +142 -0
- rainbow_rb_flow_manager-0.0.9.dev5/src/rainbow_rb_flow_manager.egg-info/SOURCES.txt +19 -0
- rainbow_rb_flow_manager-0.0.9.dev5/src/rainbow_rb_flow_manager.egg-info/dependency_links.txt +1 -0
- rainbow_rb_flow_manager-0.0.9.dev5/src/rainbow_rb_flow_manager.egg-info/requires.txt +6 -0
- rainbow_rb_flow_manager-0.0.9.dev5/src/rainbow_rb_flow_manager.egg-info/top_level.txt +1 -0
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: rainbow-rb-flow-manager
|
|
3
|
+
Version: 0.0.9.dev5
|
|
4
|
+
Summary: Rainbow Python Flow Manager
|
|
5
|
+
Author-email: Derek <dfd1123@rainbow-robotics.com>
|
|
6
|
+
Requires-Python: <3.13,>=3.12
|
|
7
|
+
Description-Content-Type: text/markdown
|
|
8
|
+
Requires-Dist: rainbow-rb-utils==0.0.9.dev5
|
|
9
|
+
Requires-Dist: rainbow-rb-zenoh==0.0.9.dev5
|
|
10
|
+
Requires-Dist: rainbow-rb-flat-buffers==0.0.9.dev5
|
|
11
|
+
Requires-Dist: rainbow-rb-schemas==0.0.9.dev5
|
|
12
|
+
Requires-Dist: rainbow-rb-sdk==0.0.9.dev5
|
|
13
|
+
Requires-Dist: rainbow-rb-log==0.0.9.dev5
|
|
14
|
+
|
|
15
|
+
# rb_flow_manager 사용 설명서
|
|
16
|
+
|
|
17
|
+
`rb_flow_manager`는 `Step` 트리를 멀티프로세스로 실행하고, 실행 상태/일시정지/재개/중지 제어를 제공하는 워크플로우 엔진입니다.
|
|
18
|
+
|
|
19
|
+
## 1. 핵심 구성요소
|
|
20
|
+
|
|
21
|
+
- `Step` 계열 (`step.py`)
|
|
22
|
+
- 기본: `Step`
|
|
23
|
+
- 제어 구조: `FolderStep`, `RepeatStep`, `ConditionStep`, `BreakStep`, `JumpToStep`
|
|
24
|
+
- 고급: `SubTaskStep`, `CallEventStep`, `SyncStep`
|
|
25
|
+
- 실행기: `ScriptExecutor` (`executor.py`)
|
|
26
|
+
- 다중 프로세스 실행
|
|
27
|
+
- 상태 조회/제어 API 제공
|
|
28
|
+
- 컨트롤러 인터페이스: `BaseController`
|
|
29
|
+
- 실행 이벤트 훅(`on_start`, `on_pause`, `on_error` 등) 구현 가능
|
|
30
|
+
- 기본 컨트롤러 구현 예시: `Zenoh_Controller`
|
|
31
|
+
|
|
32
|
+
## 2. 최소 실행 예제
|
|
33
|
+
|
|
34
|
+
```python
|
|
35
|
+
from rb_flow_manager.step import Step
|
|
36
|
+
from rb_flow_manager.executor import ScriptExecutor
|
|
37
|
+
from rb_flow_manager.schema import MakeProcessArgs
|
|
38
|
+
|
|
39
|
+
def hello_step():
|
|
40
|
+
print("hello step")
|
|
41
|
+
|
|
42
|
+
root = Step(
|
|
43
|
+
step_id="root",
|
|
44
|
+
name="Root",
|
|
45
|
+
children=[
|
|
46
|
+
Step(step_id="s1", name="Hello", func=hello_step),
|
|
47
|
+
],
|
|
48
|
+
)
|
|
49
|
+
|
|
50
|
+
executor = ScriptExecutor()
|
|
51
|
+
|
|
52
|
+
args: MakeProcessArgs = {
|
|
53
|
+
"process_id": "script_1",
|
|
54
|
+
"step": root,
|
|
55
|
+
"repeat_count": 1,
|
|
56
|
+
"robot_model": "C500920",
|
|
57
|
+
"category": "manipulate",
|
|
58
|
+
"step_mode": False,
|
|
59
|
+
"min_step_interval": 0.0,
|
|
60
|
+
"is_ui_execution": False,
|
|
61
|
+
"post_tree": None,
|
|
62
|
+
"parent_process_id": None,
|
|
63
|
+
"event_sub_tree_list": [],
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
executor.start(args)
|
|
67
|
+
executor.wait_all()
|
|
68
|
+
print(executor.get_all_states())
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## 3. Step 작성 방식
|
|
72
|
+
|
|
73
|
+
`Step`는 두 방식으로 함수 실행을 지원합니다.
|
|
74
|
+
|
|
75
|
+
- 직접 함수 연결
|
|
76
|
+
- `func=<callable>`
|
|
77
|
+
- 문자열 함수명 방식
|
|
78
|
+
- `func_name="rb_manipulate_sdk.point"`
|
|
79
|
+
- 런타임에 import/호출
|
|
80
|
+
|
|
81
|
+
또한 `args`를 통해 스텝 인자를 전달하고, `children`으로 트리를 구성합니다.
|
|
82
|
+
|
|
83
|
+
## 4. 실행 제어 API
|
|
84
|
+
|
|
85
|
+
`ScriptExecutor` 주요 메서드:
|
|
86
|
+
|
|
87
|
+
- `start(args: MakeProcessArgs | list[MakeProcessArgs]) -> bool`
|
|
88
|
+
- `pause(process_id: str) -> bool`
|
|
89
|
+
- `resume(process_id: str) -> bool`
|
|
90
|
+
- `stop(process_id: str) -> bool`
|
|
91
|
+
- `wait_all(timeout: float | None = None) -> bool`
|
|
92
|
+
- `get_all_states() -> dict[str, dict]`
|
|
93
|
+
|
|
94
|
+
## 5. 상태 모델
|
|
95
|
+
|
|
96
|
+
`RB_Flow_Manager_ProgramState`:
|
|
97
|
+
|
|
98
|
+
- `IDLE`
|
|
99
|
+
- `RUNNING`
|
|
100
|
+
- `PAUSED`
|
|
101
|
+
- `WAITING`
|
|
102
|
+
- `STOPPED`
|
|
103
|
+
- `POST_START`
|
|
104
|
+
- `COMPLETED`
|
|
105
|
+
- `ERROR`
|
|
106
|
+
|
|
107
|
+
각 프로세스별 상세 실행 상태는 `ExecutorState` TypedDict 구조로 관리됩니다.
|
|
108
|
+
|
|
109
|
+
## 6. 컨트롤러 연동
|
|
110
|
+
|
|
111
|
+
커스텀 컨트롤러를 사용하려면 `BaseController`를 구현한 뒤 `ScriptExecutor(controller=...)`로 전달합니다.
|
|
112
|
+
|
|
113
|
+
```python
|
|
114
|
+
from rb_flow_manager.controller.base_controller import BaseController
|
|
115
|
+
|
|
116
|
+
class MyController(BaseController):
|
|
117
|
+
def on_init(self, state_dicts): ...
|
|
118
|
+
def on_start(self, task_id): ...
|
|
119
|
+
def on_stop(self, task_id, step_id): ...
|
|
120
|
+
def on_pause(self, task_id, step_id): ...
|
|
121
|
+
def on_wait(self, task_id, step_id): ...
|
|
122
|
+
def on_resume(self, task_id, step_id): ...
|
|
123
|
+
def on_next(self, task_id, step_id): ...
|
|
124
|
+
def on_sub_task_start(self, task_id, sub_task_id, sub_task_type): ...
|
|
125
|
+
def on_sub_task_done(self, task_id, sub_task_id, sub_task_type): ...
|
|
126
|
+
def on_done(self, task_id, step_id): ...
|
|
127
|
+
def on_error(self, task_id, step_id, error): ...
|
|
128
|
+
def on_post_start(self, task_id): ...
|
|
129
|
+
def on_complete(self, task_id): ...
|
|
130
|
+
def on_close(self): ...
|
|
131
|
+
def on_all_complete(self): ...
|
|
132
|
+
def on_all_stop(self): ...
|
|
133
|
+
def on_all_pause(self): ...
|
|
134
|
+
def on_all_wait(self): ...
|
|
135
|
+
def on_all_resume(self): ...
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
## 7. 실무 팁
|
|
139
|
+
|
|
140
|
+
- `process_id`는 서비스 내에서 유일하게 관리하세요.
|
|
141
|
+
- 긴 실행 트리는 `min_step_interval`을 사용해 과도한 호출을 방지하세요.
|
|
142
|
+
- 다중 트리 병렬 실행 시 `start([...])` 형태를 사용하면 일괄 시작 제어가 쉽습니다.
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
# rb_flow_manager 사용 설명서
|
|
2
|
+
|
|
3
|
+
`rb_flow_manager`는 `Step` 트리를 멀티프로세스로 실행하고, 실행 상태/일시정지/재개/중지 제어를 제공하는 워크플로우 엔진입니다.
|
|
4
|
+
|
|
5
|
+
## 1. 핵심 구성요소
|
|
6
|
+
|
|
7
|
+
- `Step` 계열 (`step.py`)
|
|
8
|
+
- 기본: `Step`
|
|
9
|
+
- 제어 구조: `FolderStep`, `RepeatStep`, `ConditionStep`, `BreakStep`, `JumpToStep`
|
|
10
|
+
- 고급: `SubTaskStep`, `CallEventStep`, `SyncStep`
|
|
11
|
+
- 실행기: `ScriptExecutor` (`executor.py`)
|
|
12
|
+
- 다중 프로세스 실행
|
|
13
|
+
- 상태 조회/제어 API 제공
|
|
14
|
+
- 컨트롤러 인터페이스: `BaseController`
|
|
15
|
+
- 실행 이벤트 훅(`on_start`, `on_pause`, `on_error` 등) 구현 가능
|
|
16
|
+
- 기본 컨트롤러 구현 예시: `Zenoh_Controller`
|
|
17
|
+
|
|
18
|
+
## 2. 최소 실행 예제
|
|
19
|
+
|
|
20
|
+
```python
|
|
21
|
+
from rb_flow_manager.step import Step
|
|
22
|
+
from rb_flow_manager.executor import ScriptExecutor
|
|
23
|
+
from rb_flow_manager.schema import MakeProcessArgs
|
|
24
|
+
|
|
25
|
+
def hello_step():
|
|
26
|
+
print("hello step")
|
|
27
|
+
|
|
28
|
+
root = Step(
|
|
29
|
+
step_id="root",
|
|
30
|
+
name="Root",
|
|
31
|
+
children=[
|
|
32
|
+
Step(step_id="s1", name="Hello", func=hello_step),
|
|
33
|
+
],
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
executor = ScriptExecutor()
|
|
37
|
+
|
|
38
|
+
args: MakeProcessArgs = {
|
|
39
|
+
"process_id": "script_1",
|
|
40
|
+
"step": root,
|
|
41
|
+
"repeat_count": 1,
|
|
42
|
+
"robot_model": "C500920",
|
|
43
|
+
"category": "manipulate",
|
|
44
|
+
"step_mode": False,
|
|
45
|
+
"min_step_interval": 0.0,
|
|
46
|
+
"is_ui_execution": False,
|
|
47
|
+
"post_tree": None,
|
|
48
|
+
"parent_process_id": None,
|
|
49
|
+
"event_sub_tree_list": [],
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
executor.start(args)
|
|
53
|
+
executor.wait_all()
|
|
54
|
+
print(executor.get_all_states())
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## 3. Step 작성 방식
|
|
58
|
+
|
|
59
|
+
`Step`는 두 방식으로 함수 실행을 지원합니다.
|
|
60
|
+
|
|
61
|
+
- 직접 함수 연결
|
|
62
|
+
- `func=<callable>`
|
|
63
|
+
- 문자열 함수명 방식
|
|
64
|
+
- `func_name="rb_manipulate_sdk.point"`
|
|
65
|
+
- 런타임에 import/호출
|
|
66
|
+
|
|
67
|
+
또한 `args`를 통해 스텝 인자를 전달하고, `children`으로 트리를 구성합니다.
|
|
68
|
+
|
|
69
|
+
## 4. 실행 제어 API
|
|
70
|
+
|
|
71
|
+
`ScriptExecutor` 주요 메서드:
|
|
72
|
+
|
|
73
|
+
- `start(args: MakeProcessArgs | list[MakeProcessArgs]) -> bool`
|
|
74
|
+
- `pause(process_id: str) -> bool`
|
|
75
|
+
- `resume(process_id: str) -> bool`
|
|
76
|
+
- `stop(process_id: str) -> bool`
|
|
77
|
+
- `wait_all(timeout: float | None = None) -> bool`
|
|
78
|
+
- `get_all_states() -> dict[str, dict]`
|
|
79
|
+
|
|
80
|
+
## 5. 상태 모델
|
|
81
|
+
|
|
82
|
+
`RB_Flow_Manager_ProgramState`:
|
|
83
|
+
|
|
84
|
+
- `IDLE`
|
|
85
|
+
- `RUNNING`
|
|
86
|
+
- `PAUSED`
|
|
87
|
+
- `WAITING`
|
|
88
|
+
- `STOPPED`
|
|
89
|
+
- `POST_START`
|
|
90
|
+
- `COMPLETED`
|
|
91
|
+
- `ERROR`
|
|
92
|
+
|
|
93
|
+
각 프로세스별 상세 실행 상태는 `ExecutorState` TypedDict 구조로 관리됩니다.
|
|
94
|
+
|
|
95
|
+
## 6. 컨트롤러 연동
|
|
96
|
+
|
|
97
|
+
커스텀 컨트롤러를 사용하려면 `BaseController`를 구현한 뒤 `ScriptExecutor(controller=...)`로 전달합니다.
|
|
98
|
+
|
|
99
|
+
```python
|
|
100
|
+
from rb_flow_manager.controller.base_controller import BaseController
|
|
101
|
+
|
|
102
|
+
class MyController(BaseController):
|
|
103
|
+
def on_init(self, state_dicts): ...
|
|
104
|
+
def on_start(self, task_id): ...
|
|
105
|
+
def on_stop(self, task_id, step_id): ...
|
|
106
|
+
def on_pause(self, task_id, step_id): ...
|
|
107
|
+
def on_wait(self, task_id, step_id): ...
|
|
108
|
+
def on_resume(self, task_id, step_id): ...
|
|
109
|
+
def on_next(self, task_id, step_id): ...
|
|
110
|
+
def on_sub_task_start(self, task_id, sub_task_id, sub_task_type): ...
|
|
111
|
+
def on_sub_task_done(self, task_id, sub_task_id, sub_task_type): ...
|
|
112
|
+
def on_done(self, task_id, step_id): ...
|
|
113
|
+
def on_error(self, task_id, step_id, error): ...
|
|
114
|
+
def on_post_start(self, task_id): ...
|
|
115
|
+
def on_complete(self, task_id): ...
|
|
116
|
+
def on_close(self): ...
|
|
117
|
+
def on_all_complete(self): ...
|
|
118
|
+
def on_all_stop(self): ...
|
|
119
|
+
def on_all_pause(self): ...
|
|
120
|
+
def on_all_wait(self): ...
|
|
121
|
+
def on_all_resume(self): ...
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
## 7. 실무 팁
|
|
125
|
+
|
|
126
|
+
- `process_id`는 서비스 내에서 유일하게 관리하세요.
|
|
127
|
+
- 긴 실행 트리는 `min_step_interval`을 사용해 과도한 호출을 방지하세요.
|
|
128
|
+
- 다중 트리 병렬 실행 시 `start([...])` 형태를 사용하면 일괄 시작 제어가 쉽습니다.
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=69", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "rainbow-rb-flow-manager"
|
|
7
|
+
version = "0.0.9.dev5"
|
|
8
|
+
requires-python = ">=3.12,<3.13"
|
|
9
|
+
description = "Rainbow Python Flow Manager"
|
|
10
|
+
authors = [
|
|
11
|
+
{ name = "Derek", email = "dfd1123@rainbow-robotics.com" },
|
|
12
|
+
]
|
|
13
|
+
readme = "README.md"
|
|
14
|
+
|
|
15
|
+
dependencies = [
|
|
16
|
+
"rainbow-rb-utils==0.0.9.dev5",
|
|
17
|
+
"rainbow-rb-zenoh==0.0.9.dev5",
|
|
18
|
+
"rainbow-rb-flat-buffers==0.0.9.dev5",
|
|
19
|
+
"rainbow-rb-schemas==0.0.9.dev5",
|
|
20
|
+
"rainbow-rb-sdk==0.0.9.dev5",
|
|
21
|
+
"rainbow-rb-log==0.0.9.dev5",
|
|
22
|
+
]
|
|
23
|
+
|
|
24
|
+
[tool.setuptools]
|
|
25
|
+
package-dir = {"" = "src"}
|
|
26
|
+
include-package-data = true
|
|
27
|
+
|
|
28
|
+
[tool.setuptools.packages.find]
|
|
29
|
+
where = ["src"]
|
|
30
|
+
include = ["rainbow.rb_flow_manager*"]
|
|
31
|
+
|
|
32
|
+
[tool.setuptools.package-data]
|
|
33
|
+
"*" = ["py.typed"]
|
|
File without changes
|