Skip to content
Closed
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
2 changes: 2 additions & 0 deletions rock/admin/proto/request.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ class SandboxStartRequest(BaseModel):
"""Password for Docker registry authentication. When both username and password are provided, docker login will be performed before pulling the image."""
use_kata_runtime: bool = False
"""Whether to use kata container runtime (io.containerd.kata.v2) instead of --privileged mode."""
auto_delete_seconds: int = 0
"""The time for automatic container deletion, with the unit being seconds."""


class SandboxCommand(Command):
Expand Down
6 changes: 5 additions & 1 deletion rock/deployments/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,11 @@ def auto_clear_time(self) -> int:
@classmethod
def from_request(cls, request: SandboxStartRequest) -> DeploymentConfig:
"""Create DockerDeploymentConfig from SandboxStartRequest"""
return cls(**request.model_dump(exclude={"sandbox_id"}), container_name=request.sandbox_id)
return cls(
**request.model_dump(exclude={"sandbox_id", "auto_delete_seconds"}),
container_name=request.sandbox_id,
remove_container=(request.auto_delete_seconds == 0),
)


class RayDeploymentConfig(DockerDeploymentConfig):
Expand Down
1 change: 1 addition & 0 deletions rock/sdk/sandbox/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ async def start(self):
"registry_username": self.config.registry_username,
"registry_password": self.config.registry_password,
"use_kata_runtime": self.config.use_kata_runtime,
"auto_delete_seconds": self.config.auto_delete_seconds,
}
try:
response = await HttpUtils.post(url, headers, data)
Expand Down
1 change: 1 addition & 0 deletions rock/sdk/sandbox/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ class SandboxConfig(BaseConfig):
registry_username: str | None = None
registry_password: str | None = None
use_kata_runtime: bool = False
auto_delete_seconds: int = 0


class SandboxGroupConfig(SandboxConfig):
Expand Down
Loading