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
8 changes: 4 additions & 4 deletions e2e/python/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,10 @@ def _run(sandbox: Sandbox, code: str) -> tuple[int, str, str]:

@pytest.fixture(scope="session")
def gpu_sandbox_spec() -> datamodel_pb2.SandboxSpec:
image = os.environ.get(
"OPENSHELL_E2E_GPU_IMAGE",
"ghcr.io/nvidia/openshell-community/sandboxes/nvidia-gpu:latest",
)
# Empty string defers image resolution to the server, which substitutes
# the configured default sandbox image. Set OPENSHELL_E2E_GPU_IMAGE to
# override (e.g. a locally-built or registry-mirrored image).
image = os.environ.get("OPENSHELL_E2E_GPU_IMAGE", "")
return datamodel_pb2.SandboxSpec(
gpu=True,
template=datamodel_pb2.SandboxTemplate(image=image),
Expand Down
5 changes: 5 additions & 0 deletions tasks/cluster.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@
description = "Bootstrap or incremental deploy (creates cluster if needed, rebuilds changed components)"
run = "tasks/scripts/cluster.sh"

["cluster:gpu"]
description = "Bootstrap or incremental deploy with NVIDIA GPU passthrough enabled"
env = { CLUSTER_GPU = "1" }
run = "tasks/scripts/cluster.sh"

Comment on lines +10 to +14
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can remove this as a separate task and use the env var instead.

["cluster:build:full"]
description = "Build and deploy local k3s cluster with OpenShell"
depends = [
Expand Down
4 changes: 4 additions & 0 deletions tasks/scripts/cluster-bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,10 @@ fi

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

if [ "${CLUSTER_GPU:-0}" = "1" ]; then
DEPLOY_CMD+=(--gpu)
fi

if [ -n "${GATEWAY_HOST:-}" ]; then
DEPLOY_CMD+=(--gateway-host "${GATEWAY_HOST}")

Expand Down
2 changes: 1 addition & 1 deletion tasks/test.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,6 @@ run = "uv run pytest -o python_files='test_*.py' -m 'not gpu' -n ${E2E_PARALLEL:

["e2e:python:gpu"]
description = "Run Python GPU e2e tests"
depends = ["python:proto", "cluster"]
depends = ["python:proto", "cluster:gpu"]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall, we prefer not adding new tasks, unless really necessary. In this case, we could drop the extra task and add env var in here directly (this is supported by mise).

Suggested change
depends = ["python:proto", "cluster:gpu"]
depends = ["python:proto", "CLUSTER_GPU=1 cluster"]

env = { UV_NO_SYNC = "1", PYTHONPATH = "python" }
run = "uv run pytest -o python_files='test_*.py' -m gpu -n ${E2E_PARALLEL:-1} e2e/python"
Loading