antioch-py 2.2.4__py3-none-any.whl → 3.0.1__py3-none-any.whl
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.
Potentially problematic release.
This version of antioch-py might be problematic. Click here for more details.
- antioch/__init__.py +101 -0
- antioch/{module/execution.py → execution.py} +1 -1
- antioch/{module/input.py → input.py} +2 -4
- antioch/{module/module.py → module.py} +17 -34
- antioch/{module/node.py → node.py} +17 -16
- {antioch_py-2.2.4.dist-info → antioch_py-3.0.1.dist-info}/METADATA +8 -11
- antioch_py-3.0.1.dist-info/RECORD +61 -0
- {antioch_py-2.2.4.dist-info → antioch_py-3.0.1.dist-info}/WHEEL +1 -1
- antioch_py-3.0.1.dist-info/licenses/LICENSE +21 -0
- common/ark/__init__.py +6 -16
- common/ark/ark.py +23 -62
- common/ark/hardware.py +1 -1
- common/ark/kinematics.py +1 -1
- common/ark/module.py +22 -0
- common/ark/node.py +46 -3
- common/ark/scheduler.py +2 -29
- common/ark/sim.py +1 -1
- {antioch/module → common/ark}/token.py +17 -0
- common/assets/rigging.usd +0 -0
- common/constants.py +63 -5
- common/core/__init__.py +37 -24
- common/core/auth.py +87 -112
- common/core/container.py +261 -0
- common/core/registry.py +131 -152
- common/core/rome.py +251 -0
- common/core/telemetry.py +176 -0
- common/core/types.py +219 -0
- common/message/__init__.py +19 -5
- common/message/annotation.py +174 -23
- common/message/array.py +25 -1
- common/message/camera.py +23 -1
- common/message/color.py +32 -6
- common/message/detection.py +40 -0
- common/message/foxglove.py +20 -0
- common/message/frame.py +71 -7
- common/message/image.py +58 -9
- common/message/imu.py +24 -4
- common/message/joint.py +69 -10
- common/message/log.py +52 -7
- common/message/pir.py +23 -8
- common/message/plot.py +57 -0
- common/message/point.py +55 -6
- common/message/point_cloud.py +55 -19
- common/message/pose.py +59 -19
- common/message/quaternion.py +105 -92
- common/message/radar.py +195 -29
- common/message/twist.py +34 -0
- common/message/types.py +40 -5
- common/message/vector.py +180 -245
- common/sim/__init__.py +49 -0
- common/{session/config.py → sim/objects.py} +97 -27
- common/sim/state.py +11 -0
- common/utils/comms.py +30 -12
- common/utils/logger.py +26 -7
- antioch/message.py +0 -87
- antioch/module/__init__.py +0 -53
- antioch/session/__init__.py +0 -152
- antioch/session/ark.py +0 -500
- antioch/session/asset.py +0 -65
- antioch/session/error.py +0 -80
- antioch/session/objects/__init__.py +0 -40
- antioch/session/objects/animation.py +0 -162
- antioch/session/objects/articulation.py +0 -180
- antioch/session/objects/basis_curve.py +0 -180
- antioch/session/objects/camera.py +0 -65
- antioch/session/objects/collision.py +0 -46
- antioch/session/objects/geometry.py +0 -58
- antioch/session/objects/ground_plane.py +0 -48
- antioch/session/objects/imu.py +0 -53
- antioch/session/objects/joint.py +0 -49
- antioch/session/objects/light.py +0 -123
- antioch/session/objects/pir_sensor.py +0 -102
- antioch/session/objects/radar.py +0 -62
- antioch/session/objects/rigid_body.py +0 -197
- antioch/session/objects/xform.py +0 -119
- antioch/session/record.py +0 -158
- antioch/session/scene.py +0 -1544
- antioch/session/session.py +0 -211
- antioch/session/task.py +0 -309
- antioch_py-2.2.4.dist-info/RECORD +0 -85
- antioch_py-2.2.4.dist-info/entry_points.txt +0 -2
- common/core/agent.py +0 -324
- common/core/task.py +0 -36
- common/message/velocity.py +0 -11
- common/rome/__init__.py +0 -9
- common/rome/client.py +0 -435
- common/rome/error.py +0 -16
- common/session/__init__.py +0 -31
- common/session/environment.py +0 -31
- common/session/sim.py +0 -129
- common/utils/usd.py +0 -12
- /antioch/{module/clock.py → clock.py} +0 -0
- {antioch_py-2.2.4.dist-info → antioch_py-3.0.1.dist-info}/top_level.txt +0 -0
- /common/message/{base.py → message.py} +0 -0
antioch/session/session.py
DELETED
|
@@ -1,211 +0,0 @@
|
|
|
1
|
-
import os
|
|
2
|
-
import time
|
|
3
|
-
from typing import Any, overload
|
|
4
|
-
|
|
5
|
-
from antioch.session.error import (
|
|
6
|
-
SessionSimRpcClientError,
|
|
7
|
-
SessionSimRpcInternalError,
|
|
8
|
-
SessionSimRpcInterruptedError,
|
|
9
|
-
SessionSimRpcNotConnectedError,
|
|
10
|
-
)
|
|
11
|
-
from common.core.auth import AuthHandler
|
|
12
|
-
from common.message import Message
|
|
13
|
-
from common.session.sim import RpcCall, RpcResponse, SimulationInfo
|
|
14
|
-
from common.utils.comms import CommsSession
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
class SessionContainer:
|
|
18
|
-
"""
|
|
19
|
-
Base class for all session containers.
|
|
20
|
-
|
|
21
|
-
Provides common functionality for accessing the session client. Session containers
|
|
22
|
-
include Scene, Ark, and SessionContainer subclasses. This base class only manages the
|
|
23
|
-
session connection - path management is delegated to SessionContainer subclasses.
|
|
24
|
-
"""
|
|
25
|
-
|
|
26
|
-
def __init__(self):
|
|
27
|
-
"""
|
|
28
|
-
Initialize the session container.
|
|
29
|
-
"""
|
|
30
|
-
|
|
31
|
-
self._session = Session.get_current()
|
|
32
|
-
|
|
33
|
-
@property
|
|
34
|
-
def connected(self) -> bool:
|
|
35
|
-
"""
|
|
36
|
-
Check if the session is connected to the Sim RPC server.
|
|
37
|
-
|
|
38
|
-
:return: True if connected, False otherwise.
|
|
39
|
-
"""
|
|
40
|
-
|
|
41
|
-
return self._session.connected
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
class Session:
|
|
45
|
-
"""
|
|
46
|
-
Singleton client for interacting with the Sim RPC server.
|
|
47
|
-
|
|
48
|
-
Uses a lazy singleton pattern - the first call to get_current() creates the instance,
|
|
49
|
-
and all subsequent calls return the same instance.
|
|
50
|
-
|
|
51
|
-
Example:
|
|
52
|
-
session = Session.get_current()
|
|
53
|
-
result = session.query_sim_rpc("get_state")
|
|
54
|
-
"""
|
|
55
|
-
|
|
56
|
-
_current: "Session | None" = None
|
|
57
|
-
|
|
58
|
-
def __init__(self, timeout: float = 10.0, debug: bool = False):
|
|
59
|
-
"""
|
|
60
|
-
Initialize the session client.
|
|
61
|
-
|
|
62
|
-
:param timeout: Default timeout for Sim RPC calls in seconds.
|
|
63
|
-
:param debug: Whether to enable debug mode.
|
|
64
|
-
"""
|
|
65
|
-
|
|
66
|
-
self._comms = CommsSession()
|
|
67
|
-
self._timeout = timeout
|
|
68
|
-
self._debug = debug or os.environ.get("ANTIOCH_RPC_PROFILE", "0") == "1"
|
|
69
|
-
Session._current = self
|
|
70
|
-
|
|
71
|
-
def __del__(self):
|
|
72
|
-
"""
|
|
73
|
-
Close the client connection.
|
|
74
|
-
"""
|
|
75
|
-
|
|
76
|
-
self._comms.close()
|
|
77
|
-
|
|
78
|
-
@classmethod
|
|
79
|
-
def get_current(cls) -> "Session":
|
|
80
|
-
"""
|
|
81
|
-
Get the current session client, creating it if it doesn't exist (lazy singleton).
|
|
82
|
-
|
|
83
|
-
:return: The current session client.
|
|
84
|
-
"""
|
|
85
|
-
|
|
86
|
-
if cls._current is None:
|
|
87
|
-
cls._current = Session()
|
|
88
|
-
return cls._current
|
|
89
|
-
|
|
90
|
-
@property
|
|
91
|
-
def connected(self) -> bool:
|
|
92
|
-
"""
|
|
93
|
-
Check if the simulation RPC server is reachable.
|
|
94
|
-
|
|
95
|
-
:return: True if connected, False otherwise.
|
|
96
|
-
"""
|
|
97
|
-
|
|
98
|
-
try:
|
|
99
|
-
self.query_sim_rpc("get_info", response_type=SimulationInfo, timeout=1.0)
|
|
100
|
-
return True
|
|
101
|
-
except Exception:
|
|
102
|
-
return False
|
|
103
|
-
|
|
104
|
-
@property
|
|
105
|
-
def comms(self) -> CommsSession:
|
|
106
|
-
"""
|
|
107
|
-
Get the comms session.
|
|
108
|
-
|
|
109
|
-
:return: The comms session.
|
|
110
|
-
"""
|
|
111
|
-
|
|
112
|
-
return self._comms
|
|
113
|
-
|
|
114
|
-
@property
|
|
115
|
-
def authenticated(self) -> bool:
|
|
116
|
-
"""
|
|
117
|
-
Check if user is authenticated.
|
|
118
|
-
|
|
119
|
-
:return: True if a valid access token exists, False otherwise.
|
|
120
|
-
"""
|
|
121
|
-
|
|
122
|
-
return AuthHandler().get_token() is not None
|
|
123
|
-
|
|
124
|
-
def login(self) -> None:
|
|
125
|
-
"""
|
|
126
|
-
Authenticate user and cache access token.
|
|
127
|
-
|
|
128
|
-
Initiates OAuth2 device code flow, prompting user to visit a URL and enter a code.
|
|
129
|
-
The access token is cached locally for subsequent requests.
|
|
130
|
-
|
|
131
|
-
:raises AuthError: If authentication fails.
|
|
132
|
-
"""
|
|
133
|
-
|
|
134
|
-
AuthHandler().login()
|
|
135
|
-
|
|
136
|
-
@overload
|
|
137
|
-
def query_sim_rpc(
|
|
138
|
-
self,
|
|
139
|
-
endpoint: str,
|
|
140
|
-
payload: dict[str, Any] | None = None,
|
|
141
|
-
*,
|
|
142
|
-
timeout: float = 60.0,
|
|
143
|
-
) -> Any | None: ...
|
|
144
|
-
|
|
145
|
-
@overload
|
|
146
|
-
def query_sim_rpc[T](
|
|
147
|
-
self,
|
|
148
|
-
endpoint: str,
|
|
149
|
-
payload: dict[str, Any] | None = None,
|
|
150
|
-
*,
|
|
151
|
-
response_type: type[T],
|
|
152
|
-
timeout: float = 60.0,
|
|
153
|
-
) -> T: ...
|
|
154
|
-
|
|
155
|
-
def query_sim_rpc[T](
|
|
156
|
-
self,
|
|
157
|
-
endpoint: str,
|
|
158
|
-
payload: dict[str, Any] | None = None,
|
|
159
|
-
*,
|
|
160
|
-
response_type: type[T] | None = None,
|
|
161
|
-
timeout: float = 60.0,
|
|
162
|
-
) -> T | Any | None:
|
|
163
|
-
"""
|
|
164
|
-
Execute a sim RPC query.
|
|
165
|
-
|
|
166
|
-
:param endpoint: The sim RPC endpoint.
|
|
167
|
-
:param payload: Optional request payload dict.
|
|
168
|
-
:param response_type: Expected response type (Message subclass or primitive like int, str, bool).
|
|
169
|
-
:param timeout: Query timeout in seconds.
|
|
170
|
-
:return: Response as typed object, arbitrary data, or None.
|
|
171
|
-
:raises SessionSimRpcNotConnectedError: If the Sim RPC server is not reachable.
|
|
172
|
-
:raises SessionSimRpcClientError: If the Sim RPC server returns a client error.
|
|
173
|
-
:raises SessionSimRpcInternalError: If the Sim RPC server returns an internal error.
|
|
174
|
-
"""
|
|
175
|
-
|
|
176
|
-
try:
|
|
177
|
-
start_time = time.perf_counter() if self._debug else 0
|
|
178
|
-
response = self._comms.query(
|
|
179
|
-
path=f"_sim/rpc/{endpoint}",
|
|
180
|
-
response_type=RpcResponse,
|
|
181
|
-
request=RpcCall(data=payload),
|
|
182
|
-
timeout=timeout or self._timeout,
|
|
183
|
-
)
|
|
184
|
-
|
|
185
|
-
# Check for errors in RPC response
|
|
186
|
-
if response.error is not None:
|
|
187
|
-
if response.error.internal:
|
|
188
|
-
raise SessionSimRpcInternalError(message=response.error.message, traceback=response.error.traceback)
|
|
189
|
-
else:
|
|
190
|
-
raise SessionSimRpcClientError(response.error.message)
|
|
191
|
-
|
|
192
|
-
# Print elapsed time in debug mode
|
|
193
|
-
if self._debug:
|
|
194
|
-
elapsed_ms = (time.perf_counter() - start_time) * 1000
|
|
195
|
-
print(f"[SIM-RPC] {endpoint}: {elapsed_ms:.1f}ms", flush=True)
|
|
196
|
-
|
|
197
|
-
# Return response data or None if no data
|
|
198
|
-
if response.data is None:
|
|
199
|
-
return None
|
|
200
|
-
if response_type is not None:
|
|
201
|
-
if issubclass(response_type, Message):
|
|
202
|
-
return response_type.model_validate(response.data)
|
|
203
|
-
return response.data
|
|
204
|
-
return response.data
|
|
205
|
-
|
|
206
|
-
except TimeoutError as e:
|
|
207
|
-
if not self.connected:
|
|
208
|
-
raise SessionSimRpcNotConnectedError("Sim RPC server is not connected") from e
|
|
209
|
-
raise
|
|
210
|
-
except KeyboardInterrupt as e:
|
|
211
|
-
raise SessionSimRpcInterruptedError("Sim RPC interrupted") from e
|
antioch/session/task.py
DELETED
|
@@ -1,309 +0,0 @@
|
|
|
1
|
-
import json
|
|
2
|
-
import tarfile
|
|
3
|
-
import tempfile
|
|
4
|
-
from datetime import datetime, timezone
|
|
5
|
-
from pathlib import Path
|
|
6
|
-
|
|
7
|
-
from antioch.session.error import SessionTaskError
|
|
8
|
-
from antioch.session.scene import Scene
|
|
9
|
-
from antioch.session.session import SessionContainer
|
|
10
|
-
from common.constants import ANTIOCH_API_URL
|
|
11
|
-
from common.core import Agent, AuthHandler
|
|
12
|
-
from common.core.task import TaskOutcome
|
|
13
|
-
from common.rome import RomeClient
|
|
14
|
-
from common.utils.logger import Logger
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
class Task(SessionContainer):
|
|
18
|
-
"""
|
|
19
|
-
Singleton for task management and telemetry recording.
|
|
20
|
-
|
|
21
|
-
Uses a lazy singleton pattern - the first instantiation or call to get_current()
|
|
22
|
-
creates the instance, and all subsequent calls return the same instance.
|
|
23
|
-
|
|
24
|
-
Provides logging with simulation time context and telemetry recording.
|
|
25
|
-
A task represents a single simulation run with defined outcomes.
|
|
26
|
-
Telemetry is always streamed to WebSocket on port 8765 when started.
|
|
27
|
-
|
|
28
|
-
Example:
|
|
29
|
-
scene = Scene()
|
|
30
|
-
task = Task() # or Task.get_current()
|
|
31
|
-
|
|
32
|
-
# Start task (streams to WebSocket on port 8765)
|
|
33
|
-
task.start()
|
|
34
|
-
|
|
35
|
-
# Or start task with MCAP recording
|
|
36
|
-
task.start(mcap_path="/tmp/task_telemetry.mcap")
|
|
37
|
-
|
|
38
|
-
# Run simulation
|
|
39
|
-
scene.step(dt=0.01)
|
|
40
|
-
|
|
41
|
-
# Log telemetry with sim time (automatically recorded when started)
|
|
42
|
-
task.logger.telemetry("velocity", VelocityMessage(...))
|
|
43
|
-
|
|
44
|
-
# Finish task with outcome (finalizes telemetry and uploads to cloud)
|
|
45
|
-
task.finish(TaskOutcome.SUCCESS)
|
|
46
|
-
|
|
47
|
-
# Or finish without uploading MCAP
|
|
48
|
-
task.finish(TaskOutcome.SUCCESS, upload_mcap=False)
|
|
49
|
-
"""
|
|
50
|
-
|
|
51
|
-
_current: "Task | None" = None
|
|
52
|
-
|
|
53
|
-
def __init__(self):
|
|
54
|
-
"""
|
|
55
|
-
Initialize the task.
|
|
56
|
-
"""
|
|
57
|
-
|
|
58
|
-
super().__init__()
|
|
59
|
-
self._agent = Agent()
|
|
60
|
-
self._scene = Scene()
|
|
61
|
-
|
|
62
|
-
self._logger: Logger | None = None
|
|
63
|
-
self._started = False
|
|
64
|
-
self._mcap_path: str | None = None
|
|
65
|
-
|
|
66
|
-
# Task metadata for cloud storage
|
|
67
|
-
self._ark_name: str | None = None
|
|
68
|
-
self._ark_version: str | None = None
|
|
69
|
-
self._ark_hash: str | None = None
|
|
70
|
-
self._task_start_time: datetime | None = None
|
|
71
|
-
|
|
72
|
-
Task._current = self
|
|
73
|
-
|
|
74
|
-
@property
|
|
75
|
-
def logger(self) -> Logger:
|
|
76
|
-
"""
|
|
77
|
-
Get the logger with current simulation time.
|
|
78
|
-
|
|
79
|
-
Sets the logger's logical execution time to match the current
|
|
80
|
-
simulation time before returning. We lazy load the scene to avoid
|
|
81
|
-
circular dependencies.
|
|
82
|
-
|
|
83
|
-
:return: The task logger.
|
|
84
|
-
:raises SessionTaskError: If task has not been started.
|
|
85
|
-
"""
|
|
86
|
-
|
|
87
|
-
if self._logger is None:
|
|
88
|
-
raise SessionTaskError("Task not started")
|
|
89
|
-
|
|
90
|
-
self._logger.set_let(self._scene.time_us)
|
|
91
|
-
return self._logger
|
|
92
|
-
|
|
93
|
-
@classmethod
|
|
94
|
-
def get_current(cls) -> "Task":
|
|
95
|
-
"""
|
|
96
|
-
Get the current task, creating it if it doesn't exist (lazy singleton).
|
|
97
|
-
|
|
98
|
-
:return: The current task.
|
|
99
|
-
"""
|
|
100
|
-
|
|
101
|
-
if cls._current is None:
|
|
102
|
-
cls._current = Task()
|
|
103
|
-
return cls._current
|
|
104
|
-
|
|
105
|
-
@property
|
|
106
|
-
def started(self) -> bool:
|
|
107
|
-
"""
|
|
108
|
-
Check if the task is currently started.
|
|
109
|
-
|
|
110
|
-
:return: True if task is started, False otherwise.
|
|
111
|
-
"""
|
|
112
|
-
|
|
113
|
-
return self._started
|
|
114
|
-
|
|
115
|
-
def start(self, mcap_path: str | None = None) -> None:
|
|
116
|
-
"""
|
|
117
|
-
Start the task and begin streaming telemetry to WebSocket (always active on port 8765).
|
|
118
|
-
Optionally records telemetry to an MCAP file.
|
|
119
|
-
|
|
120
|
-
This operation is idempotent - calling it multiple times will finish the previous
|
|
121
|
-
task and start a new one.
|
|
122
|
-
|
|
123
|
-
:param mcap_path: Optional path to save MCAP telemetry file (defaults to None for no MCAP recording).
|
|
124
|
-
:raises SessionTaskError: If no Ark is loaded in the scene or if user is not authenticated.
|
|
125
|
-
"""
|
|
126
|
-
|
|
127
|
-
if self._started:
|
|
128
|
-
print("Task already started. Finish or clear the task before starting a new one")
|
|
129
|
-
return
|
|
130
|
-
|
|
131
|
-
# Check that an Ark is loaded
|
|
132
|
-
if self._scene.ark is None:
|
|
133
|
-
raise SessionTaskError("No Ark loaded. Please load an Ark before starting a task")
|
|
134
|
-
|
|
135
|
-
# Get auth token
|
|
136
|
-
auth = AuthHandler()
|
|
137
|
-
token = auth.get_token()
|
|
138
|
-
if not token:
|
|
139
|
-
raise SessionTaskError("User not authenticated. Please login first")
|
|
140
|
-
|
|
141
|
-
# Store task metadata
|
|
142
|
-
self._ark_name = self._scene.ark.definition.name
|
|
143
|
-
self._ark_version = self._scene.ark.definition.info.version
|
|
144
|
-
self._ark_hash = self._scene.ark.definition.metadata.digest
|
|
145
|
-
self._task_start_time = datetime.now(timezone.utc)
|
|
146
|
-
|
|
147
|
-
# Start recording telemetry
|
|
148
|
-
self._agent.record_telemetry(mcap_path)
|
|
149
|
-
|
|
150
|
-
# Update task state
|
|
151
|
-
self._logger = Logger(self._session.comms, base_channel="task", print_logs=True)
|
|
152
|
-
self._started = True
|
|
153
|
-
self._mcap_path = mcap_path
|
|
154
|
-
|
|
155
|
-
def finish(
|
|
156
|
-
self,
|
|
157
|
-
outcome: TaskOutcome,
|
|
158
|
-
result: dict | None = None,
|
|
159
|
-
bundle_paths: list[Path] | None = None,
|
|
160
|
-
upload_mcap: bool = True,
|
|
161
|
-
show_progress: bool = True,
|
|
162
|
-
) -> None:
|
|
163
|
-
"""
|
|
164
|
-
Finish the task with the specified outcome and optionally upload results to cloud storage.
|
|
165
|
-
|
|
166
|
-
Resets telemetry session (finalizes MCAP file if one was created and resets time tracking).
|
|
167
|
-
The WebSocket server remains active.
|
|
168
|
-
|
|
169
|
-
If result and/or bundle_paths are provided, uploads them to Antioch for cloud storage.
|
|
170
|
-
|
|
171
|
-
:param outcome: The task outcome (defaults to SUCCESS).
|
|
172
|
-
:param result: Optional dictionary of task results (must be JSON-serializable).
|
|
173
|
-
:param bundle_paths: Optional list of file paths to bundle and upload to cloud storage.
|
|
174
|
-
:param upload_mcap: Upload MCAP file to cloud storage if one was recorded (defaults to True).
|
|
175
|
-
:param show_progress: Show upload progress bars (defaults to True).
|
|
176
|
-
:raises SessionTaskError: If task not started or if result is not JSON-serializable.
|
|
177
|
-
"""
|
|
178
|
-
|
|
179
|
-
if not self._started:
|
|
180
|
-
raise SessionTaskError("Task not started")
|
|
181
|
-
|
|
182
|
-
# Validate result is JSON-serializable if provided
|
|
183
|
-
if result is not None:
|
|
184
|
-
try:
|
|
185
|
-
json.dumps(result)
|
|
186
|
-
except (TypeError, ValueError) as e:
|
|
187
|
-
raise SessionTaskError(f"Task result must be JSON-serializable: {e}") from e
|
|
188
|
-
|
|
189
|
-
# Validate bundle paths exist and are accessible
|
|
190
|
-
bundle_tar_path = None
|
|
191
|
-
if bundle_paths is not None and len(bundle_paths) > 0:
|
|
192
|
-
for path in bundle_paths:
|
|
193
|
-
if not Path(path).exists():
|
|
194
|
-
raise SessionTaskError(f"Bundle path does not exist: {path}")
|
|
195
|
-
if not Path(path).is_file():
|
|
196
|
-
raise SessionTaskError(f"Bundle path is not a file: {path}")
|
|
197
|
-
|
|
198
|
-
# Create tar.gz bundle
|
|
199
|
-
try:
|
|
200
|
-
bundle_tar_path = self._create_bundle(bundle_paths)
|
|
201
|
-
except Exception as e:
|
|
202
|
-
raise SessionTaskError(f"Failed to create bundle: {e}") from e
|
|
203
|
-
|
|
204
|
-
# Save the MCAP file to disk (does not reset websocket session)
|
|
205
|
-
self._agent.save_telemetry()
|
|
206
|
-
|
|
207
|
-
# Upload task to Antioch Cloud
|
|
208
|
-
try:
|
|
209
|
-
task_complete_time = datetime.now(timezone.utc)
|
|
210
|
-
self._upload_task_to_antioch(outcome, result, bundle_tar_path, task_complete_time, upload_mcap, show_progress)
|
|
211
|
-
except Exception as e:
|
|
212
|
-
raise SessionTaskError(f"Failed to upload task to Antioch Cloud: {e}") from e
|
|
213
|
-
|
|
214
|
-
# Clean up temp bundle file
|
|
215
|
-
if bundle_tar_path and Path(bundle_tar_path).exists():
|
|
216
|
-
Path(bundle_tar_path).unlink()
|
|
217
|
-
|
|
218
|
-
# Reset task state
|
|
219
|
-
self._logger = None
|
|
220
|
-
self._started = False
|
|
221
|
-
self._mcap_path = None
|
|
222
|
-
self._ark_name = None
|
|
223
|
-
self._ark_version = None
|
|
224
|
-
self._ark_hash = None
|
|
225
|
-
self._task_start_time = None
|
|
226
|
-
|
|
227
|
-
def _create_bundle(self, bundle_paths: list[Path]) -> str:
|
|
228
|
-
"""
|
|
229
|
-
Create a tar.gz archive from the provided file paths.
|
|
230
|
-
|
|
231
|
-
:param bundle_paths: List of file paths to include in the bundle.
|
|
232
|
-
:return: Path to the created tar.gz file.
|
|
233
|
-
"""
|
|
234
|
-
|
|
235
|
-
# Create temp file for the bundle
|
|
236
|
-
with tempfile.NamedTemporaryFile(suffix=".tar.gz", delete=False) as temp_file:
|
|
237
|
-
temp_path = temp_file.name
|
|
238
|
-
with tarfile.open(temp_path, "w:gz") as tar:
|
|
239
|
-
for path in bundle_paths:
|
|
240
|
-
tar.add(str(path), arcname=Path(path).name)
|
|
241
|
-
|
|
242
|
-
return temp_path
|
|
243
|
-
|
|
244
|
-
def _upload_task_to_antioch(
|
|
245
|
-
self,
|
|
246
|
-
outcome: TaskOutcome,
|
|
247
|
-
result: dict | None,
|
|
248
|
-
bundle_tar_path: str | None,
|
|
249
|
-
task_complete_time: datetime,
|
|
250
|
-
upload_mcap: bool,
|
|
251
|
-
show_progress: bool,
|
|
252
|
-
) -> None:
|
|
253
|
-
"""
|
|
254
|
-
Upload task completion data to Antioch Cloud.
|
|
255
|
-
|
|
256
|
-
:param outcome: The task outcome.
|
|
257
|
-
:param result: Optional task result dictionary.
|
|
258
|
-
:param bundle_tar_path: Optional path to bundle tar.gz file.
|
|
259
|
-
:param task_complete_time: ISO 8601 timestamp of task completion.
|
|
260
|
-
:param upload_mcap: Upload MCAP file if one was recorded.
|
|
261
|
-
:param show_progress: Show upload progress bars.
|
|
262
|
-
:raises SessionTaskError: If upload operations fail.
|
|
263
|
-
"""
|
|
264
|
-
|
|
265
|
-
# Get auth token
|
|
266
|
-
token = AuthHandler().get_token()
|
|
267
|
-
if token is None:
|
|
268
|
-
raise SessionTaskError("User not authenticated. Please login first")
|
|
269
|
-
|
|
270
|
-
# Create Rome client
|
|
271
|
-
rome_client = RomeClient(api_url=ANTIOCH_API_URL, token=token)
|
|
272
|
-
|
|
273
|
-
# Assert all required fields are set (should never be None at this point)
|
|
274
|
-
assert self._ark_name is not None, "Ark name should be set"
|
|
275
|
-
assert self._ark_version is not None, "Ark version should be set"
|
|
276
|
-
assert self._ark_hash is not None, "Ark hash should be set"
|
|
277
|
-
assert self._task_start_time is not None, "Task start time should be set"
|
|
278
|
-
|
|
279
|
-
# Complete the task (creates ES entry)
|
|
280
|
-
try:
|
|
281
|
-
task_id = rome_client.complete_task(
|
|
282
|
-
ark_name=self._ark_name,
|
|
283
|
-
ark_version=self._ark_version,
|
|
284
|
-
ark_hash=self._ark_hash,
|
|
285
|
-
task_start_time=self._task_start_time,
|
|
286
|
-
task_complete_time=task_complete_time,
|
|
287
|
-
outcome=outcome,
|
|
288
|
-
result=result,
|
|
289
|
-
)
|
|
290
|
-
except Exception as e:
|
|
291
|
-
raise SessionTaskError(f"Failed to complete task in Antioch: {e}") from e
|
|
292
|
-
|
|
293
|
-
# Upload MCAP if it exists and upload_mcap is True
|
|
294
|
-
if upload_mcap and self._mcap_path:
|
|
295
|
-
if not Path(self._mcap_path).exists():
|
|
296
|
-
raise SessionTaskError(f"MCAP file does not exist, or is inaccessible: {self._mcap_path}")
|
|
297
|
-
try:
|
|
298
|
-
rome_client.upload_mcap(task_id=task_id, mcap_path=self._mcap_path, show_progress=show_progress)
|
|
299
|
-
except Exception as e:
|
|
300
|
-
raise SessionTaskError(f"Failed to upload MCAP to Antioch: {e}") from e
|
|
301
|
-
|
|
302
|
-
# Upload bundle if it exists
|
|
303
|
-
if bundle_tar_path:
|
|
304
|
-
if not Path(bundle_tar_path).exists():
|
|
305
|
-
raise SessionTaskError(f"Bundle file does not exist, or is inaccessible: {bundle_tar_path}")
|
|
306
|
-
try:
|
|
307
|
-
rome_client.upload_bundle(task_id=task_id, bundle_path=bundle_tar_path, show_progress=show_progress)
|
|
308
|
-
except Exception as e:
|
|
309
|
-
raise SessionTaskError(f"Failed to upload bundle to Antioch: {e}") from e
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
antioch/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
-
antioch/message.py,sha256=7YsmUA6H3Imikv6beUJilTpA8Nb5DCkeOwbRQwOLfGI,1463
|
|
3
|
-
antioch/module/__init__.py,sha256=nSbYXkicwbypnfyko2cN2JwvIzSntfVEYyP63VVPaGU,1008
|
|
4
|
-
antioch/module/clock.py,sha256=54NpvlbkFLtmiLGMXADGCkYbooUaKsDGN-xjjDqq7mw,2026
|
|
5
|
-
antioch/module/execution.py,sha256=bASbLFz3YqP7Ma5Pbga6W7ddNCQo3GzbjAlgrQXYWSw,7995
|
|
6
|
-
antioch/module/input.py,sha256=BGbJ6AOgm7gVTO6PBYs8B53q0v_YD3Jy2joM5M7kUlk,4317
|
|
7
|
-
antioch/module/module.py,sha256=6b9s_N1Tpr4Wtp8hXVxZHDzhfKgG2IHeOd8KE65TfMk,7581
|
|
8
|
-
antioch/module/node.py,sha256=1EDNzKbQINs4nKZiSdn_FEPg-3MyCKdC0b7pfucmLgk,14542
|
|
9
|
-
antioch/module/token.py,sha256=6KJbPMoaMqUrx8nfYzAgVTf8EaazT46g6KMC1zO97Pk,830
|
|
10
|
-
antioch/session/__init__.py,sha256=-TtFaO3SCjIjBvh29Dso54qlfqnfdUbUN_p8tW5i220,3526
|
|
11
|
-
antioch/session/ark.py,sha256=r8hpCM8wymtgIX1mcvGofQR6mZOdn9UCsnFAtnnpvto,18814
|
|
12
|
-
antioch/session/asset.py,sha256=G4wKHVxDkzLEtUap7b7jDF6Y_I4gdHiJ-b756QFBx54,2222
|
|
13
|
-
antioch/session/error.py,sha256=hEByLcsS8PPpK46prnz1GSWBx0ErGTnSkwBd29FUmWg,1685
|
|
14
|
-
antioch/session/record.py,sha256=acNeikDeWJFZLovgwbXGHTriqi5-szYjjrnt9s_cdUY,5527
|
|
15
|
-
antioch/session/scene.py,sha256=srg2F8PH4tOx9f2an2Q9TULyDtGPcBpBC3Gm6gMzjo8,60036
|
|
16
|
-
antioch/session/session.py,sha256=K25RZZ8HYMUpyeDoCzzWh-YLs1DcjBlrzxN2SvbtZ4E,6348
|
|
17
|
-
antioch/session/task.py,sha256=OBGFAD-oWRjkQUAElO9bXhJ_SI-j7S6TxKpUmCgN1-M,11484
|
|
18
|
-
antioch/session/objects/__init__.py,sha256=n7EYDfneWwro1OaXphbWGyasZ0tvAAAGe72PcUmTF_Y,1184
|
|
19
|
-
antioch/session/objects/animation.py,sha256=FIgYsHG9TWcdi5aG3ycGorJv-nJBFkiHArDWXLEx8bY,5427
|
|
20
|
-
antioch/session/objects/articulation.py,sha256=bSAvi6ZOAGOPTsXEtt8fGAG3VF8UR8TxSL0L1izGtbQ,6644
|
|
21
|
-
antioch/session/objects/basis_curve.py,sha256=I5x5CklyDeg7m3907Gs9vDa4PP9mjnMPZutjg7Vc8Kg,5918
|
|
22
|
-
antioch/session/objects/camera.py,sha256=clFfSKKlvMlh8x_OZb7AmHrqmWxO9sI760_LGvIBwBM,2252
|
|
23
|
-
antioch/session/objects/collision.py,sha256=ZGAINF7p3MbCoTwvx4Pzicc8dIfbJgjBgUn_TC_hrT0,1479
|
|
24
|
-
antioch/session/objects/geometry.py,sha256=MuC6qnHCVGnxYGovHU8U2G-tRGbINoL273t3yYQAPCE,1954
|
|
25
|
-
antioch/session/objects/ground_plane.py,sha256=o82nW9Ndhw-AiwiSKUrr1IhspFmdah7BYOTc1EUVEeg,1460
|
|
26
|
-
antioch/session/objects/imu.py,sha256=vx59MutAg1HOEvZESqOmxlQocrnXEW1B5rqD7LBzLwM,1602
|
|
27
|
-
antioch/session/objects/joint.py,sha256=_mqXq1IDvzQ9FnvCpKXGa0YNh8f9zCtmskC8UP4QgNI,1476
|
|
28
|
-
antioch/session/objects/light.py,sha256=Sl0zPIiCnocCCLUaaJaiDLbHVhAJ-ZnIr9IOueIrc_g,3831
|
|
29
|
-
antioch/session/objects/pir_sensor.py,sha256=gAHZRmuQXSsOdTKiEFDnBxOwGnOJ-IctfbU0DuUV7vU,3514
|
|
30
|
-
antioch/session/objects/radar.py,sha256=BXl8OzngiY_urBRBB7kAlBHvtpR9aosWv7nuYcKSeWo,1930
|
|
31
|
-
antioch/session/objects/rigid_body.py,sha256=TuJ04vG0eyzg4lFAVp7ZE0YTzOjhlcqLoNaeW2sZM0E,6294
|
|
32
|
-
antioch/session/objects/xform.py,sha256=VkSDIfFEuutrDVuKO2F5sI4zKsGa0xZzxFeH-tRMjp0,3237
|
|
33
|
-
common/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
34
|
-
common/constants.py,sha256=0jsX0pWUklL9UNLK4_rzGuo53qFWZX1_PIw9j2aKDnU,1652
|
|
35
|
-
common/ark/__init__.py,sha256=Lu2lJ5k7-vN6ZGeX2sYhRwzXEyt9kCyXtgsyvdIaCiU,1472
|
|
36
|
-
common/ark/ark.py,sha256=RqD8fmSPK_cjnaUOsscAj9406BsMXVCEynu_RtGa6qk,2444
|
|
37
|
-
common/ark/hardware.py,sha256=5AH9jkrjIvVK6JBfWM7Okpqm9Iqbs7gtyxktlzBS4oI,2252
|
|
38
|
-
common/ark/kinematics.py,sha256=BCPQKmQ5vWlZBCie861TIImmR3X5BniiuGRPoIvByDM,748
|
|
39
|
-
common/ark/module.py,sha256=IwkoirFb4dZkfVpn3tjgChRy5S6hVPbrtR9XgJ5UIBI,1922
|
|
40
|
-
common/ark/node.py,sha256=PWESl7sDdY_Q6aA3CZMRTQ0SONlO9LkUmXhRbUhT8_g,2303
|
|
41
|
-
common/ark/scheduler.py,sha256=QGO_-ZewCvOHJ-w9BAJJQdco0-b-mbbzufpSX9b-mNo,15703
|
|
42
|
-
common/ark/sim.py,sha256=SQtZkf97QF91oLWkTUEhq62GYL3yk7-LLDDR-lXVKcA,900
|
|
43
|
-
common/assets/__init__.py,sha256=We71LsStYI5-hknGd2XHrvHg8G4k1dity887BnI5oPI,102
|
|
44
|
-
common/core/__init__.py,sha256=L8rvLHQd-mOCfDQ2WN9BZiMqU0skeTTkeQvpJ59ouqI,1110
|
|
45
|
-
common/core/agent.py,sha256=EBNSTuxCOUM66UV7e1LA1aQLyYgIsRjFZXWqbbp-lR0,8613
|
|
46
|
-
common/core/auth.py,sha256=ihMnlhyDWJ73VhxqSulLTPxgorDK76WT7Mx97RCAhLY,9244
|
|
47
|
-
common/core/registry.py,sha256=J2Ihhgr6aTfovm-zSiGEcyHB8iBcpFcZVw6vVYKFjNg,11399
|
|
48
|
-
common/core/task.py,sha256=eybV7yQ8nPYgQtYuse-QvoMJ87Msh6rAN_LUOTGmN94,629
|
|
49
|
-
common/message/__init__.py,sha256=JHTTMFuMYUF9jspydMihfz2dK9-Mp37zWOTMZBUwK5g,1802
|
|
50
|
-
common/message/annotation.py,sha256=BlzDYhioAK1ATFfgZozmaF7uOqFdSr7KBhe2m03Z2q4,1911
|
|
51
|
-
common/message/array.py,sha256=Fly7u8BE-_QRwnkmv3k6P2EI0FguEUIzF_tE-mFGT1Q,13971
|
|
52
|
-
common/message/base.py,sha256=kdBEmcHy6R9EV_QbarSwPWZE0n_Sar-gXK8g5ceT2-U,18080
|
|
53
|
-
common/message/camera.py,sha256=Xv3Y31ppg9fkjncMteHwgB3Dx7RNRWbnStoDFp-YnhM,3075
|
|
54
|
-
common/message/color.py,sha256=PsM-mD-LAitJJD4DCvMaSFGwXjFEiWgdcrqxFRj0wGI,3292
|
|
55
|
-
common/message/frame.py,sha256=J8J0EutQ3mfHvmGjna-7hhWgIyqHgkKPPjIgMMyxCUw,1674
|
|
56
|
-
common/message/image.py,sha256=aF_rU_sOSJQci6g_Wr5Sd16FUFnHm2kgurqWcPPKbaA,5296
|
|
57
|
-
common/message/imu.py,sha256=mwIu_dK64aixrnz6Hsg8v-vXVKUabLBNbfHe2KqbVPo,328
|
|
58
|
-
common/message/joint.py,sha256=V9qEILZVaWoAbKGT_V3wvSAvZzoJ7YmrcROkIdzmg5o,1051
|
|
59
|
-
common/message/log.py,sha256=VN1zCwrUtTPNiyakNjYPZuz3UDMtW19fhD1F1M8MTf8,552
|
|
60
|
-
common/message/pir.py,sha256=nSm5dymphomoOZqZAtQeUCowrIginEjVvLwW9NdGNAU,797
|
|
61
|
-
common/message/point.py,sha256=oryHZEltba1z3GFRyb099oDddmiLE5SM4TKexgtBYaE,2229
|
|
62
|
-
common/message/point_cloud.py,sha256=e06e6-bGaN8VzwkCy4MltDZocnKP7Bbr14gBlUhXu-A,2035
|
|
63
|
-
common/message/pose.py,sha256=fcb0-xuIYWaaHHGC_iET9yma1fuicFvXJsaJaLO5XVI,4703
|
|
64
|
-
common/message/quaternion.py,sha256=Y6-XR3g7VaWVOkLoK6hE26wTYjnJFjrHIv9y17GM1EY,6897
|
|
65
|
-
common/message/radar.py,sha256=18w89hpq5tahh9V_49CWKXkU78b21xrTj_bH35u1UFE,2014
|
|
66
|
-
common/message/types.py,sha256=k2wtbozsyd4HhMBoDfPFMLyCAGmTxaOvVhzIr-wx3N0,480
|
|
67
|
-
common/message/vector.py,sha256=IrREGUi2zKTUmp5PG4YNiJKEM1zRXLl0fK9QuF7I06o,20302
|
|
68
|
-
common/message/velocity.py,sha256=vHcFH_nMNBgobwY7dLeBaHJNvNiJxsQaPxImUh3GjHY,205
|
|
69
|
-
common/rome/__init__.py,sha256=hfwUw5wbT-Ph-OFwGhiqw3XEeWaZwmLAs66LOYKqfzU,210
|
|
70
|
-
common/rome/client.py,sha256=jhF4BEwtvJ3cIaT-M0ZxOljEHD9QJnO8b_QnIvu1-Wk,15797
|
|
71
|
-
common/rome/error.py,sha256=oW8yI81o3hQghop4omFcMkXx4IbacGye38Iyw2VKihQ,294
|
|
72
|
-
common/session/__init__.py,sha256=S6DsgJbRwFHaEcqe2CNrR_KI2811B1auLv-VX4g5JVU,643
|
|
73
|
-
common/session/config.py,sha256=IxNK4uGRVmruLq9eFktBu8opyc_ACg1kysgkvCb5lho,17874
|
|
74
|
-
common/session/environment.py,sha256=CVW00KXWF8L0L6ocUsZ2UWt-iqAiP0usFdhZsK43fak,714
|
|
75
|
-
common/session/sim.py,sha256=CrwVPbu0m8UAFUSsTsU_TMgD1Ik9FKxs9FsaepIuZzg,2859
|
|
76
|
-
common/utils/__init__.py,sha256=9zRb7XayzCGRs4I94hWKJHyQ1MevlUiTzXsPNBLBX7Y,113
|
|
77
|
-
common/utils/comms.py,sha256=1lpnb9ra5I3xv-Eo0GFZ7nR4TjKseOeDNf9QMWQZbds,17283
|
|
78
|
-
common/utils/logger.py,sha256=VcZ4dduWut8xWPs-F5ye8RRrNdBehSSG3r1LAWc-IBY,3389
|
|
79
|
-
common/utils/time.py,sha256=kGDzObbaqWOep4vT1Y2W-BheunxdjYBI4V3Nfp4Ck3Q,790
|
|
80
|
-
common/utils/usd.py,sha256=to4VPtnamMDIQK-pwDIVfiuzUnNzEImj5szOar1NHiE,253
|
|
81
|
-
antioch_py-2.2.4.dist-info/METADATA,sha256=ahK5PzztFRLcl8Gd7-cp_EGRRYsegqHdf-Qzr6BqHpc,3485
|
|
82
|
-
antioch_py-2.2.4.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
83
|
-
antioch_py-2.2.4.dist-info/entry_points.txt,sha256=1bLTH5BXCOsQkS8k6L_wJ6Nj62j4aoU9Ey_PhWzsRRM,59
|
|
84
|
-
antioch_py-2.2.4.dist-info/top_level.txt,sha256=GtzNccsep3YdBt9VXQ7-ZFsFJFffr4hyZvqg0YqRqtw,15
|
|
85
|
-
antioch_py-2.2.4.dist-info/RECORD,,
|