Skip to content

Commit 3bd624e

Browse files
committed
feat(tasks): add cluster:gpu task and wire e2e:gpu to use it
1 parent b4e20c1 commit 3bd624e

File tree

4 files changed

+14
-5
lines changed

4 files changed

+14
-5
lines changed

e2e/python/conftest.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,10 +96,10 @@ def _run(sandbox: Sandbox, code: str) -> tuple[int, str, str]:
9696

9797
@pytest.fixture(scope="session")
9898
def gpu_sandbox_spec() -> datamodel_pb2.SandboxSpec:
99-
image = os.environ.get(
100-
"OPENSHELL_E2E_GPU_IMAGE",
101-
"ghcr.io/nvidia/openshell-community/sandboxes/nvidia-gpu:latest",
102-
)
99+
# Empty string defers image resolution to the server, which substitutes
100+
# the configured default sandbox image. Set OPENSHELL_E2E_GPU_IMAGE to
101+
# override (e.g. a locally-built or registry-mirrored image).
102+
image = os.environ.get("OPENSHELL_E2E_GPU_IMAGE", "")
103103
return datamodel_pb2.SandboxSpec(
104104
gpu=True,
105105
template=datamodel_pb2.SandboxTemplate(image=image),

tasks/cluster.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@
77
description = "Bootstrap or incremental deploy (creates cluster if needed, rebuilds changed components)"
88
run = "tasks/scripts/cluster.sh"
99

10+
["cluster:gpu"]
11+
description = "Bootstrap or incremental deploy with NVIDIA GPU passthrough enabled"
12+
env = { CLUSTER_GPU = "1" }
13+
run = "tasks/scripts/cluster.sh"
14+
1015
["cluster:build:full"]
1116
description = "Build and deploy local k3s cluster with OpenShell"
1217
depends = [

tasks/scripts/cluster-bootstrap.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,10 @@ fi
243243

244244
DEPLOY_CMD=(openshell gateway start --name "${CLUSTER_NAME}" --port "${GATEWAY_PORT}")
245245

246+
if [ "${CLUSTER_GPU:-0}" = "1" ]; then
247+
DEPLOY_CMD+=(--gpu)
248+
fi
249+
246250
if [ -n "${GATEWAY_HOST:-}" ]; then
247251
DEPLOY_CMD+=(--gateway-host "${GATEWAY_HOST}")
248252

tasks/test.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,6 @@ run = "uv run pytest -o python_files='test_*.py' -m 'not gpu' -n ${E2E_PARALLEL:
4343

4444
["e2e:python:gpu"]
4545
description = "Run Python GPU e2e tests"
46-
depends = ["python:proto", "cluster"]
46+
depends = ["python:proto", "cluster:gpu"]
4747
env = { UV_NO_SYNC = "1", PYTHONPATH = "python" }
4848
run = "uv run pytest -o python_files='test_*.py' -m gpu -n ${E2E_PARALLEL:-1} e2e/python"

0 commit comments

Comments
 (0)