Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions neuracore/api/endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,14 @@
"""

import requests
from neuracore_types import DataSpec, DataType, DeploymentRequest, SynchronizedPoint
from neuracore_types import (
DataSpec,
DataType,
DeploymentRequest,
GPUType,
SynchronizedPoint,
)
from neuracore_types.endpoints.endpoint_requests import DeploymentConfig
from neuracore_types.training.training import GPUType

from neuracore.api.core import _get_robot
from neuracore.core.auth import get_auth
Expand Down
18 changes: 18 additions & 0 deletions neuracore/core/robot.py
Original file line number Diff line number Diff line change
Expand Up @@ -701,6 +701,24 @@ def _cleanup_daemon_recording_context(self) -> None:
finally:
self._daemon_recording_context = None

def delete(self) -> None:
"""Delete the robot from the server."""
try:
response = requests.delete(
f"{API_URL}/org/{self.org_id}/robots/{self.id}",
headers=self._auth.get_headers(),
)
response.raise_for_status()
except requests.exceptions.ConnectionError:
raise RobotError(
"Failed to connect to neuracore server, "
"please check your internet connection and try again."
)
except requests.exceptions.RequestException as e:
raise RobotError(f"Failed to delete robot: {str(e)}")
finally:
self.close()

def close(self) -> None:
"""Release local resources owned by this Robot instance."""
self._cleanup_daemon_recording_context()
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/ml/test_algorithm_performance.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@
from neuracore_types import (
BatchedJointData,
DataType,
GPUType,
JointData,
RGBCameraData,
SynchronizedPoint,
)
from neuracore_types.training.training import GPUType

import neuracore as nc
from neuracore.core.endpoint import Policy
Expand Down
Loading
Loading