Skip to content

Commit 32dea10

Browse files
committed
feat: add queue runtime image and dev tag channel for runtime images
1 parent a5a3a75 commit 32dea10

5 files changed

Lines changed: 73 additions & 10 deletions

File tree

.github/workflows/runtimes.yml

Lines changed: 38 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Runtimes
22

33
on:
44
push:
5-
branches: [main]
5+
branches: [main, feat/apps-sdk]
66
paths:
77
- "runpod/runtimes/**"
88
- ".github/workflows/runtimes.yml"
@@ -14,6 +14,8 @@ on:
1414

1515
env:
1616
REGISTRY: docker.io
17+
# dev-suffixed tags for non-main branches so testing never clobbers latest
18+
TAG_SUFFIX: ${{ github.ref == 'refs/heads/main' && 'latest' || 'dev' }}
1719

1820
jobs:
1921
test-runner:
@@ -62,7 +64,7 @@ jobs:
6264
PYTHON_VERSION=${{ matrix.python-version }}
6365
push: ${{ github.event_name != 'pull_request' }}
6466
tags: |
65-
runpod/task:py${{ matrix.python-version }}-latest
67+
runpod/task:py${{ matrix.python-version }}-${{ env.TAG_SUFFIX }}
6668
cache-from: type=gha,scope=task-py${{ matrix.python-version }}
6769
cache-to: type=gha,mode=max,scope=task-py${{ matrix.python-version }}
6870

@@ -95,6 +97,39 @@ jobs:
9597
platforms: linux/amd64
9698
push: ${{ github.event_name != 'pull_request' }}
9799
tags: |
98-
runpod/task-gpu:latest
100+
runpod/task-gpu:${{ env.TAG_SUFFIX }}
99101
cache-from: type=gha,scope=task-gpu
100102
cache-to: type=gha,mode=max,scope=task-gpu
103+
104+
build-queue:
105+
runs-on: ubuntu-latest
106+
needs: [test-runner]
107+
strategy:
108+
matrix:
109+
python-version: ["3.10", "3.11", "3.12"]
110+
steps:
111+
- uses: actions/checkout@v7
112+
113+
- uses: docker/setup-buildx-action@v3
114+
115+
- name: Login to Docker Hub
116+
if: github.event_name != 'pull_request'
117+
uses: docker/login-action@v3
118+
with:
119+
registry: ${{ env.REGISTRY }}
120+
username: ${{ secrets.DOCKERHUB_USERNAME }}
121+
password: ${{ secrets.DOCKERHUB_TOKEN }}
122+
123+
- name: Build and push queue image
124+
uses: docker/build-push-action@v6
125+
with:
126+
context: .
127+
file: runpod/runtimes/queue/Dockerfile
128+
platforms: linux/amd64
129+
build-args: |
130+
PYTHON_VERSION=${{ matrix.python-version }}
131+
push: ${{ github.event_name != 'pull_request' }}
132+
tags: |
133+
runpod/queue:py${{ matrix.python-version }}-${{ env.TAG_SUFFIX }}
134+
cache-from: type=gha,scope=queue-py${{ matrix.python-version }}
135+
cache-to: type=gha,mode=max,scope=queue-py${{ matrix.python-version }}

runpod/apps/dev.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,17 @@
2323

2424
DEV_PREFIX = "dev"
2525

26-
# worker runtime images by (kind, is_cpu); tag pinned via env override
26+
# worker runtime images by (kind, is_cpu). queue images are built from
27+
# runpod/runtimes/queue in this repo; api still rides the flash lb
28+
# images until the lb runtime lands. RUNPOD_RUNTIME_TAG selects the
29+
# image channel (latest, dev, or a pinned version).
30+
import os as _os
31+
32+
_TAG = _os.environ.get("RUNPOD_RUNTIME_TAG", "latest")
33+
2734
DEFAULT_IMAGES = {
28-
("queue", False): "runpod/flash:py3.12-latest",
29-
("queue", True): "runpod/flash-cpu:py3.12-latest",
35+
("queue", False): f"runpod/queue:py3.12-{_TAG}",
36+
("queue", True): f"runpod/queue:py3.12-{_TAG}",
3037
("api", False): "runpod/flash-lb:py3.12-latest",
3138
("api", True): "runpod/flash-lb-cpu:py3.12-latest",
3239
}

runpod/apps/tasks.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,14 @@
3535
# safety net: pods self-terminate server-side after this long
3636
DEFAULT_MAX_LIFETIME = timedelta(hours=1)
3737

38-
# task runtime images built from runtimes/task by the runtimes workflow
39-
DEFAULT_GPU_IMAGE = "runpod/task-gpu:latest"
40-
DEFAULT_CPU_IMAGE = "runpod/task:py3.12-latest"
38+
# task runtime images built from runpod/runtimes/task by the runtimes
39+
# workflow. RUNPOD_RUNTIME_TAG selects the channel (latest, dev, pinned).
40+
import os as _os
41+
42+
_TAG = _os.environ.get("RUNPOD_RUNTIME_TAG", "latest")
43+
44+
DEFAULT_GPU_IMAGE = f"runpod/task-gpu:{_TAG}"
45+
DEFAULT_CPU_IMAGE = f"runpod/task:py3.12-{_TAG}"
4146

4247
READY_POLL_INTERVAL = 2.0
4348
READY_TIMEOUT = 600.0

runpod/runtimes/queue/Dockerfile

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
ARG PYTHON_VERSION=3.12
2+
FROM python:${PYTHON_VERSION}-slim
3+
4+
ENV DEBIAN_FRONTEND=noninteractive \
5+
TZ=Etc/UTC \
6+
PYTHONUNBUFFERED=1
7+
8+
RUN apt-get update && apt-get install -y --no-install-recommends \
9+
git ca-certificates \
10+
&& apt-get clean && rm -rf /var/lib/apt/lists/*
11+
12+
# install the runpod package (worker loop + runtimes) from the build context
13+
COPY . /src
14+
RUN pip install --no-cache-dir /src cloudpickle && rm -rf /src
15+
16+
CMD ["python", "-m", "runpod.runtimes.queue.bootstrap"]

tests/test_apps/test_bootstrap.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ def q():
109109

110110
payload = _endpoint_input(app, q.spec)
111111
template = payload["template"]
112-
assert template["imageName"] == "runpod/flash-cpu:py3.12-latest"
112+
assert template["imageName"].startswith("runpod/queue:py3.12-")
113113
assert template["dockerArgs"] == ""
114114
env = {e["key"]: e["value"] for e in template["env"]}
115115
assert "RUNPOD_BOOTSTRAP_B64" not in env

0 commit comments

Comments
 (0)