Skip to content

Commit 3716886

Browse files
committed
fix: upgrade stale runpod installs in bootstrap and forward package spec
1 parent ad98a6d commit 3716886

3 files changed

Lines changed: 23 additions & 2 deletions

File tree

runpod/apps/dev.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,13 @@ def _endpoint_input(app: App, spec: ResourceSpec, generation: int = 1) -> Dict:
131131
{"key": "RUNPOD_RUNTIME_KIND", "value": spec.kind.value},
132132
]
133133
)
134+
# the bootstrap pip-installs the runpod package on bare images;
135+
# forward a pinned spec (e.g. a git branch during prerelease)
136+
package_spec = _os.environ.get("RUNPOD_PACKAGE_SPEC")
137+
if package_spec:
138+
payload["template"]["env"].append(
139+
{"key": "RUNPOD_PACKAGE_SPEC", "value": package_spec}
140+
)
134141
payload["template"]["dockerArgs"] = _bootstrap_docker_args()
135142
if spec.kind is ResourceKind.API:
136143
payload["type"] = "LB"

runpod/apps/tasks.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,9 @@ def _pod_input(spec: ResourceSpec, token: str, task_name: str) -> Dict[str, Any]
9898
env["RUNPOD_TASK_RUNNER_B64"] = base64.b64encode(
9999
_runner_source().encode()
100100
).decode()
101+
package_spec = _os.environ.get("RUNPOD_PACKAGE_SPEC")
102+
if package_spec:
103+
env["RUNPOD_PACKAGE_SPEC"] = package_spec
101104
pod["dockerArgs"] = _bootstrap_command()
102105

103106
pod["env"] = [{"key": k, "value": v} for k, v in env.items()]

runpod/runtimes/bootstrap.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,13 +99,24 @@ def _ensure_runtime():
9999
except ImportError:
100100
pass
101101
# RUNPOD_PACKAGE_SPEC allows pinning or installing from git (e.g.
102-
# prerelease testing); defaults to the published package
102+
# prerelease testing); defaults to the published package. --upgrade
103+
# matters: the image may carry an older runpod without the runtimes
104+
# modules, and a plain install would no-op against it.
103105
spec = os.environ.get("RUNPOD_PACKAGE_SPEC", "runpod")
104106
_log(f"worker runtime not in image, installing {spec}")
105-
packages = [spec, "cloudpickle"]
107+
packages = ["--upgrade", spec, "cloudpickle"]
106108
if _runtime_kind() == "api":
107109
packages.append("uvicorn>=0.30")
108110
_pip_install(packages, "runtime")
111+
try:
112+
import runpod.runtimes.queue.worker # noqa: F401
113+
except ImportError as exc:
114+
raise PhaseError(
115+
"runtime",
116+
f"installed {spec} but the worker runtime is still missing: "
117+
f"{exc}. the installed runpod version may predate the runtimes "
118+
f"modules; set RUNPOD_PACKAGE_SPEC to a version that has them.",
119+
)
109120

110121

111122
def _resource_entry():

0 commit comments

Comments
 (0)