Skip to content
Merged
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
24 changes: 5 additions & 19 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,6 @@ jobs:
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
steps:
- uses: actions/checkout@v7
with:
path: sdk-runtime

- uses: actions/checkout@v7
with:
repository: runpod/runpod-python
ref: main
path: runpod-python

- uses: actions/setup-python@v6
with:
Expand All @@ -34,16 +26,12 @@ jobs:
- uses: astral-sh/setup-uv@v7
with:
enable-cache: true
cache-dependency-glob: sdk-runtime/uv.lock
cache-dependency-glob: uv.lock

- name: Install dependencies
working-directory: sdk-runtime
run: |
uv sync --all-groups
uv pip install -e ../runpod-python
run: uv sync --locked --all-groups

- name: Run tests
working-directory: sdk-runtime
run: uv run --no-sync pytest -q

lint:
Expand All @@ -56,7 +44,7 @@ jobs:
enable-cache: true

- name: Install dependencies
run: uv sync --all-groups
run: uv sync --locked --all-groups

- name: Check lint
run: uv run --no-sync ruff check .
Expand All @@ -79,11 +67,9 @@ jobs:
load: true
push: false
tags: runpod-sdk-runtime:test
build-args: |
BASE_IMAGE=python:3.12-slim
RUNPOD_PACKAGE_SPEC=https://github.com/runpod/runpod-python/archive/refs/heads/main.tar.gz
build-args: BASE_IMAGE=python:3.12-slim
cache-from: type=gha,scope=queue-test
cache-to: type=gha,mode=max,scope=queue-test

- name: Verify runtime imports
run: docker run --rm --entrypoint python runpod-sdk-runtime:test -c "import runpod_sdk_runtime.bootstrap"
run: docker run --rm --entrypoint python runpod-sdk-runtime:test -c "from runpod_sdk_runtime.bootstrap import _sdk_importable; ok, error = _sdk_importable([]); assert ok, error; import runpod_sdk_runtime.queue.worker"
4 changes: 2 additions & 2 deletions .github/workflows/images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ on:
runpod_package_spec:
description: Runpod SDK package spec
required: true
default: runpod
default: runpod>=2.2.0

permissions:
contents: read
Expand All @@ -33,7 +33,7 @@ jobs:
run: |
if [ "${{ github.event_name }}" = "release" ]; then
tag="${RELEASE_TAG#v}"
sdk_spec="runpod"
sdk_spec="runpod>=2.2.0"
release_tags="true"
else
tag="$INPUT_TAG"
Expand Down
27 changes: 23 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,26 @@ Production execution accepts JSON `args` and `kwargs`, with an optional transpor
envelope. Requests cannot supply source, dependencies, mounts, or pickle
serialization. Source-mode tasks use the shared live executor.

## Remote values

Tasks and queues accept finite JSON-compatible arguments, results, and stream
chunks. JSON conversion turns tuples into lists and supported dictionary keys
into strings. Python objects, bytes, non-finite numbers, and cyclic containers
fail validation. Use JSON representations for custom types and encode binary
data as strings.

Live requests use `serialization_format: "json"`, which is also the default.
Successful responses contain `json_result`, including for a null return value.
Workers validate arguments and the format before installing request dependencies
or executing source. Task and live queue failures use a `success: false` response
with an `error` message; a failing stream emits that response after any valid chunks.
Deployed queue failures use the serverless job error response.

The runtime requires Runpod SDK 2.2.0 or later, with shared JSON protocol validators in
`runpod.apps.protocol` and `runpod._serialization`, including in vendored
deployment environments and custom images. SDK and runtime releases must be
deployed together for this protocol contract.

## Storage bindings

Apps provisioning supplies `RUNPOD_MOUNTS`, a JSON array of bindings with `kind`
Expand Down Expand Up @@ -103,11 +123,10 @@ alive for the next watchdog pass. Container exit alone does not stop pod billing

## Development

Install the Apps SDK checkout first, then install this project:
Install this project with its published SDK dependency:

```bash
uv sync --all-groups
uv pip install -e ../runpod-python
uv sync --locked --all-groups
uv run --no-sync pytest
uv run --no-sync ruff check .
uv run --no-sync ruff format --check .
Expand All @@ -119,7 +138,7 @@ Build a CPU queue image against a specific SDK package source:
docker build \
-f docker/queue.Dockerfile \
--build-arg BASE_IMAGE=python:3.12-slim \
--build-arg RUNPOD_PACKAGE_SPEC=runpod \
--build-arg 'RUNPOD_PACKAGE_SPEC=runpod>=2.2.0' \
-t runpod/queue:local .
```

Expand Down
2 changes: 1 addition & 1 deletion docker/api.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
ARG BASE_IMAGE=python:3.12-slim
FROM ${BASE_IMAGE}

ARG RUNPOD_PACKAGE_SPEC=runpod
ARG RUNPOD_PACKAGE_SPEC=runpod>=2.2.0

ENV DEBIAN_FRONTEND=noninteractive \
TZ=Etc/UTC \
Expand Down
2 changes: 1 addition & 1 deletion docker/queue.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
ARG BASE_IMAGE=python:3.12-slim
FROM ${BASE_IMAGE}

ARG RUNPOD_PACKAGE_SPEC=runpod
ARG RUNPOD_PACKAGE_SPEC=runpod>=2.2.0

ENV DEBIAN_FRONTEND=noninteractive \
TZ=Etc/UTC \
Expand Down
2 changes: 1 addition & 1 deletion docker/task.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
ARG BASE_IMAGE=python:3.12-slim
FROM ${BASE_IMAGE}

ARG RUNPOD_PACKAGE_SPEC=runpod
ARG RUNPOD_PACKAGE_SPEC=runpod>=2.2.0

ENV DEBIAN_FRONTEND=noninteractive \
TZ=Etc/UTC \
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@ authors = [
{ name = "Runpod", email = "engineer@runpod.io" },
]
dependencies = [
"cloudpickle>=3.0.0",
"fastapi[standard]>=0.115.0",
"runpod",
"runpod>=2.2.0",
"uvicorn>=0.30.0",
]

Expand Down Expand Up @@ -55,3 +54,4 @@ ignore = ["S101"]
"src/runpod_sdk_runtime/executor.py" = ["S603", "S607"]
"src/runpod_sdk_runtime/task/runner.py" = ["S104", "S110", "S310"]
"tests/*" = ["S105", "S106", "S310"]
"tests/test_bootstrap_without_sdk.py" = ["S603"]
9 changes: 6 additions & 3 deletions src/runpod_sdk_runtime/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,10 @@ def _sdk_importable(paths):
modules = SDK_MODULES[_runtime_kind()]
probe = (
"import sys; sys.path[:0] = sys.argv[1:]; import importlib; "
f"[importlib.import_module(name) for name in {modules!r}]"
f"[importlib.import_module(name) for name in {modules!r}]; "
"from runpod._serialization import normalize_json, validate_json; "
"from runpod.apps.protocol import FORMAT_JSON, FunctionRequest; "
"FunctionRequest.from_input"
)
result = subprocess.run(
[sys.executable, "-c", probe, *paths],
Expand Down Expand Up @@ -346,9 +349,9 @@ def _ensure_sdk_installed():
ok, _ = _sdk_importable([])
if ok:
return
spec = os.environ.get("RUNPOD_PACKAGE_SPEC", "runpod")
spec = os.environ.get("RUNPOD_PACKAGE_SPEC", "runpod>=2.2.0")
_log(f"worker sdk not in image, installing {spec}")
packages = [spec, "cloudpickle"]
packages = [spec]
if _runtime_kind() == "api":
packages.extend(("fastapi[standard]", "uvicorn>=0.30"))
_pip_install(packages, "runtime")
Expand Down
Loading
Loading