puda-comms 0.0.4__tar.gz → 0.0.6__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.
- {puda_comms-0.0.4 → puda_comms-0.0.6}/PKG-INFO +12 -13
- {puda_comms-0.0.4 → puda_comms-0.0.6}/README.md +11 -11
- {puda_comms-0.0.4 → puda_comms-0.0.6}/pyproject.toml +11 -5
- puda_comms-0.0.6/src/puda_comms/__init__.py +9 -0
- {puda_comms-0.0.4 → puda_comms-0.0.6}/src/puda_comms/command_service.py +261 -85
- {puda_comms-0.0.4 → puda_comms-0.0.6}/src/puda_comms/machine_client.py +215 -88
- {puda_comms-0.0.4 → puda_comms-0.0.6}/src/puda_comms/models.py +7 -1
- puda_comms-0.0.6/src/puda_comms/run_manager.py +112 -0
- puda_comms-0.0.6/src/puda_comms/stream_subscriber.py +388 -0
- puda_comms-0.0.4/src/puda_comms/__init__.py +0 -5
- {puda_comms-0.0.4 → puda_comms-0.0.6}/src/puda_comms/execution_state.py +0 -0
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: puda-comms
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.6
|
|
4
4
|
Summary: Communication library for the PUDA platform.
|
|
5
5
|
Author: zhao
|
|
6
6
|
Author-email: zhao <20024592+agentzhao@users.noreply.github.com>
|
|
7
7
|
Requires-Dist: nats-py>=2.12.0
|
|
8
|
-
Requires-Dist: puda-drivers
|
|
9
8
|
Requires-Dist: pydantic>=2.12.5
|
|
10
9
|
Requires-Python: >=3.14
|
|
11
10
|
Description-Content-Type: text/markdown
|
|
@@ -73,6 +72,7 @@ Represents a command to be sent to a machine.
|
|
|
73
72
|
|
|
74
73
|
**Fields:**
|
|
75
74
|
- `name` (str): The command name to execute
|
|
75
|
+
- `machine_id` (str): Machine ID to send the command to (required)
|
|
76
76
|
- `params` (Dict[str, Any]): Command parameters (default: empty dict)
|
|
77
77
|
- `step_number` (int): Execution step number for tracking progress
|
|
78
78
|
- `version` (str): Command version (default: "1.0")
|
|
@@ -81,7 +81,8 @@ Represents a command to be sent to a machine.
|
|
|
81
81
|
```python
|
|
82
82
|
command = CommandRequest(
|
|
83
83
|
name="attach_tip",
|
|
84
|
-
|
|
84
|
+
machine_id="first",
|
|
85
|
+
params={"deck_slot": "A3", "well_name": "G8"},
|
|
85
86
|
step_number=2,
|
|
86
87
|
version="1.0"
|
|
87
88
|
)
|
|
@@ -109,7 +110,7 @@ response = CommandResponse(
|
|
|
109
110
|
error_response = CommandResponse(
|
|
110
111
|
status=CommandResponseStatus.ERROR,
|
|
111
112
|
code="EXECUTION_ERROR",
|
|
112
|
-
message="Failed to attach tip:
|
|
113
|
+
message="Failed to attach tip: deck_slot A3 not found",
|
|
113
114
|
completed_at="2026-01-20T02:00:46Z"
|
|
114
115
|
)
|
|
115
116
|
```
|
|
@@ -166,8 +167,8 @@ Complete NATS message structure combining header with optional command or respon
|
|
|
166
167
|
"command": {
|
|
167
168
|
"name": "attach_tip",
|
|
168
169
|
"params": {
|
|
169
|
-
"
|
|
170
|
-
"
|
|
170
|
+
"deck_slot": "A3",
|
|
171
|
+
"well_name": "G8"
|
|
171
172
|
},
|
|
172
173
|
"step_number": 2,
|
|
173
174
|
"version": "1.0"
|
|
@@ -230,10 +231,9 @@ Queue commands are regular commands that are executed in sequence. Use `send_que
|
|
|
230
231
|
Both `send_queue_command()`, `send_queue_commands()`, and `send_immediate_command()` accept an optional `timeout` parameter (default: 120 seconds):
|
|
231
232
|
|
|
232
233
|
```python
|
|
233
|
-
# Single command
|
|
234
|
+
# Single command (machine_id must be in CommandRequest)
|
|
234
235
|
reply = await service.send_queue_command(
|
|
235
|
-
request=request,
|
|
236
|
-
machine_id="first",
|
|
236
|
+
request=request, # request.machine_id must be set
|
|
237
237
|
run_id=run_id,
|
|
238
238
|
user_id="user123",
|
|
239
239
|
username="John Doe",
|
|
@@ -241,9 +241,9 @@ reply = await service.send_queue_command(
|
|
|
241
241
|
)
|
|
242
242
|
|
|
243
243
|
# Multiple commands (timeout applies to each command)
|
|
244
|
+
# Each command in the list must have machine_id set
|
|
244
245
|
reply = await service.send_queue_commands(
|
|
245
|
-
requests=commands,
|
|
246
|
-
machine_id="first",
|
|
246
|
+
requests=commands, # Each CommandRequest must have machine_id
|
|
247
247
|
run_id=run_id,
|
|
248
248
|
user_id="user123",
|
|
249
249
|
username="John Doe",
|
|
@@ -282,8 +282,7 @@ Always check the response status and handle errors appropriately:
|
|
|
282
282
|
|
|
283
283
|
```python
|
|
284
284
|
reply: NATSMessage = await service.send_queue_command(
|
|
285
|
-
request=request,
|
|
286
|
-
machine_id="first",
|
|
285
|
+
request=request, # request.machine_id must be set
|
|
287
286
|
run_id=run_id,
|
|
288
287
|
user_id="user123",
|
|
289
288
|
username="John Doe"
|
|
@@ -61,6 +61,7 @@ Represents a command to be sent to a machine.
|
|
|
61
61
|
|
|
62
62
|
**Fields:**
|
|
63
63
|
- `name` (str): The command name to execute
|
|
64
|
+
- `machine_id` (str): Machine ID to send the command to (required)
|
|
64
65
|
- `params` (Dict[str, Any]): Command parameters (default: empty dict)
|
|
65
66
|
- `step_number` (int): Execution step number for tracking progress
|
|
66
67
|
- `version` (str): Command version (default: "1.0")
|
|
@@ -69,7 +70,8 @@ Represents a command to be sent to a machine.
|
|
|
69
70
|
```python
|
|
70
71
|
command = CommandRequest(
|
|
71
72
|
name="attach_tip",
|
|
72
|
-
|
|
73
|
+
machine_id="first",
|
|
74
|
+
params={"deck_slot": "A3", "well_name": "G8"},
|
|
73
75
|
step_number=2,
|
|
74
76
|
version="1.0"
|
|
75
77
|
)
|
|
@@ -97,7 +99,7 @@ response = CommandResponse(
|
|
|
97
99
|
error_response = CommandResponse(
|
|
98
100
|
status=CommandResponseStatus.ERROR,
|
|
99
101
|
code="EXECUTION_ERROR",
|
|
100
|
-
message="Failed to attach tip:
|
|
102
|
+
message="Failed to attach tip: deck_slot A3 not found",
|
|
101
103
|
completed_at="2026-01-20T02:00:46Z"
|
|
102
104
|
)
|
|
103
105
|
```
|
|
@@ -154,8 +156,8 @@ Complete NATS message structure combining header with optional command or respon
|
|
|
154
156
|
"command": {
|
|
155
157
|
"name": "attach_tip",
|
|
156
158
|
"params": {
|
|
157
|
-
"
|
|
158
|
-
"
|
|
159
|
+
"deck_slot": "A3",
|
|
160
|
+
"well_name": "G8"
|
|
159
161
|
},
|
|
160
162
|
"step_number": 2,
|
|
161
163
|
"version": "1.0"
|
|
@@ -218,10 +220,9 @@ Queue commands are regular commands that are executed in sequence. Use `send_que
|
|
|
218
220
|
Both `send_queue_command()`, `send_queue_commands()`, and `send_immediate_command()` accept an optional `timeout` parameter (default: 120 seconds):
|
|
219
221
|
|
|
220
222
|
```python
|
|
221
|
-
# Single command
|
|
223
|
+
# Single command (machine_id must be in CommandRequest)
|
|
222
224
|
reply = await service.send_queue_command(
|
|
223
|
-
request=request,
|
|
224
|
-
machine_id="first",
|
|
225
|
+
request=request, # request.machine_id must be set
|
|
225
226
|
run_id=run_id,
|
|
226
227
|
user_id="user123",
|
|
227
228
|
username="John Doe",
|
|
@@ -229,9 +230,9 @@ reply = await service.send_queue_command(
|
|
|
229
230
|
)
|
|
230
231
|
|
|
231
232
|
# Multiple commands (timeout applies to each command)
|
|
233
|
+
# Each command in the list must have machine_id set
|
|
232
234
|
reply = await service.send_queue_commands(
|
|
233
|
-
requests=commands,
|
|
234
|
-
machine_id="first",
|
|
235
|
+
requests=commands, # Each CommandRequest must have machine_id
|
|
235
236
|
run_id=run_id,
|
|
236
237
|
user_id="user123",
|
|
237
238
|
username="John Doe",
|
|
@@ -270,8 +271,7 @@ Always check the response status and handle errors appropriately:
|
|
|
270
271
|
|
|
271
272
|
```python
|
|
272
273
|
reply: NATSMessage = await service.send_queue_command(
|
|
273
|
-
request=request,
|
|
274
|
-
machine_id="first",
|
|
274
|
+
request=request, # request.machine_id must be set
|
|
275
275
|
run_id=run_id,
|
|
276
276
|
user_id="user123",
|
|
277
277
|
username="John Doe"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "puda-comms"
|
|
3
|
-
version = "0.0.
|
|
3
|
+
version = "0.0.6"
|
|
4
4
|
description = "Communication library for the PUDA platform."
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
authors = [
|
|
@@ -9,14 +9,20 @@ authors = [
|
|
|
9
9
|
requires-python = ">=3.14"
|
|
10
10
|
dependencies = [
|
|
11
11
|
"nats-py>=2.12.0",
|
|
12
|
-
# "puda-drivers>=0.0.16",
|
|
13
|
-
"puda-drivers",
|
|
14
12
|
"pydantic>=2.12.5",
|
|
15
13
|
]
|
|
16
14
|
|
|
17
|
-
[tool.
|
|
18
|
-
|
|
15
|
+
[tool.ruff]
|
|
16
|
+
line-length = 100
|
|
17
|
+
|
|
18
|
+
[tool.ruff.lint.mccabe]
|
|
19
|
+
max-complexity = 10
|
|
19
20
|
|
|
20
21
|
[build-system]
|
|
21
22
|
requires = ["uv_build>=0.9.18,<0.10.0"]
|
|
22
23
|
build-backend = "uv_build"
|
|
24
|
+
|
|
25
|
+
[dependency-groups]
|
|
26
|
+
dev = [
|
|
27
|
+
"ruff>=0.14.13",
|
|
28
|
+
]
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# Import models first to ensure they're initialized before other modules that depend on them
|
|
2
|
+
from . import models
|
|
3
|
+
|
|
4
|
+
from .machine_client import MachineClient
|
|
5
|
+
from .execution_state import ExecutionState
|
|
6
|
+
from .command_service import CommandService
|
|
7
|
+
from .stream_subscriber import StreamSubscriber
|
|
8
|
+
|
|
9
|
+
__all__ = ["MachineClient", "ExecutionState", "CommandService", "StreamSubscriber", "models"]
|