Repository navigation
Conversation
App.worker_image declares an existing worker image as a queue endpoint
with no decorated function. The image's own handler serves jobs; args
replaces its start command. Calls send plain {"input": kwargs}.
- ResourceSpec gains image_only and docker_args, validated
- deploy and dev skip the runtime launcher for image-only resources
- dev does not hand RUNPOD_API_KEY to the image
- LiveTarget raw mode returns worker output unchanged
- Queue stub resolves its target through an overridable hook
SLS-1191
| from .errors import EndpointNotFound, InvalidResourceError | ||
| from .gpu import GpuLike | ||
| from .handles import ApiHandle, FunctionHandle | ||
| from .handles import ApiHandle, FunctionHandle, WorkerImageHandle |
| from .errors import EndpointNotFound, InvalidResourceError | ||
| from .gpu import GpuLike | ||
| from .handles import ApiHandle, FunctionHandle | ||
| from .handles import ApiHandle, FunctionHandle, WorkerImageHandle |
| from .errors import EndpointNotFound, InvalidResourceError | ||
| from .gpu import GpuLike | ||
| from .handles import ApiHandle, FunctionHandle | ||
| from .handles import ApiHandle, FunctionHandle, WorkerImageHandle |
There was a problem hiding this comment.
🟡 Changes recommended
Streaming and nested calls still mishandle raw worker outputs, while image-only resources can cause bundled Torch to shadow GPU images’ CUDA-compatible version.
3 open issues
What changed in this PR
Adds App.worker_image() to run prebuilt worker images as queue endpoints within the existing app lifecycle.
Changes:
- Adds worker-image registration, validation, and queue handles.
- Updates deploy/dev payloads and introduces raw worker-output handling.
- Documents the API and adds focused tests.
| File | Description |
|---|---|
| tests/test_apps/test_worker_image.py | Tests registration, payloads, and invocation. |
| runpod/apps/targets.py | Adds raw output mode. |
| runpod/apps/stubs.py | Adds overridable target resolution and cloning. |
| runpod/apps/spec.py | Validates and serializes image-only settings. |
| runpod/apps/handles.py | Adds WorkerImageHandle. |
| runpod/apps/dev.py | Configures image-only endpoints without account-key injection. |
| runpod/apps/deploy.py | Preserves or overrides image startup commands. |
| runpod/apps/app.py | Adds App.worker_image() registration. |
| runpod/apps/__init__.py | Exports the new handle. |
| README.md | Documents worker-image usage. |
Review effort: Balanced
| mounts=mounts, | ||
| env=env, | ||
| datacenter=datacenter, | ||
| image=image, |
| async def _resolve_target(self): | ||
| if in_discovery(): | ||
| raise DiscoveryInvocationError(self.spec.name) | ||
| return await self._app._resolve(self.spec) |
Comment on lines
+760
to
+761
| if self.raw: | ||
| return output |
KAJdev
requested changes
Dec 4, 2026
Contributor
There was a problem hiding this comment.
This API feels weird to me, Stubs already exist and are the better fit here, something like:
app = App("inference")
endpoint = Queue(
app=app,
name="endpoint",
image="someones/worker:latest",
gpu="ADA_24",
workers=(0, 3),
)
endpoint.remote()which extends the current stub api with an image parameter that would change the target to an actual deployed endpoint
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

What
Adds
App.worker_image(...), which deploys an existing worker image as a queue endpoint without a decorated function. The image's own handler serves the jobs.argsreplaces the image's start command; leave it out to keep the image's own.The returned handle has the queue surface:
remote,spawn,stream,job,with_options. Keyword arguments become the job input as plain{"input": kwargs}, which is the shape a standardrunpod.serverlesshandler reads.rp flash dev,rp flash deployandrp flash undeploymanage it like any other queue resource.Why
Before 2.x, a prebuilt worker image could be deployed as an endpoint directly. The
runpod.appsmodel only supported decorated functions run through the Flash runtime, so there was no way to put an existing worker image on an endpoint from an app.How
ResourceSpecgainsimage_onlyanddocker_args. Validation: image-only resources must be queues and need a non-blank image, anddocker_argsis only allowed on image-only resources.RUNPOD_RUNTIME_KINDfor image-only resources and setdockerArgsfromargs(empty keeps the image command).RUNPOD_API_KEYinto image-only resources, since the image is not the Flash runtime and does not need the account key.LiveTargethas a raw mode that returns worker output unchanged instead of unwrapping the Flash result envelope.Queuestub now resolves its target through an async_resolve_target()hook, whichWorkerImageHandleoverrides to resolve through the app (deployed target, or the dev live target).imageOnlyanddockerArgs.Test plan
tests/test_apps/test_worker_image.py: registration and validation, deploy and dev payloads, manifest fields, no account key in dev, raw live target, remote/spawn/with_options payloads, resolution through the app, syncremoteThe current main CI failure (opentelemetry-api 1.46 deprecates
opentelemetry._logs, which pytest'sfilterwarnings=errorturns into collection errors in 3 test files) affects this branch too. It is unrelated to this change.