From 6df1bd833c0f1d141bb0393927acc96e5497dfd8 Mon Sep 17 00:00:00 2001 From: Johan de Ruiter Date: Thu, 9 Jul 2026 21:18:22 +0000 Subject: [PATCH] cosmos3: fix worker.py path (/opt/app) + CodeQL except:pass in resolve() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Two post-merge follow-ups from the prod rollout: - Dockerfile: COPY worker.py to /opt/app/worker.py + WORKDIR /opt/app. MM2's dynamo deployment runs 'python3 worker.py' with workingDir=/opt/app, so the worker MUST be there — the prior /workspace location made every prod pod crash-loop (python3: can't open /opt/app/worker.py). This is the fix behind the fw-v3 rebuild that's now serving prod. - worker.py: replace 'except ValueError: pass' in Cosmos3VideoRequest.resolve() with a log.warning (GitHub Advanced Security / CodeQL empty-except finding). Co-Authored-By: Claude Fable 5 --- examples/cosmos3/Dockerfile | 13 +++++++++---- examples/cosmos3/worker.py | 5 ++++- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/examples/cosmos3/Dockerfile b/examples/cosmos3/Dockerfile index 944062817b66..af8aa4c673c1 100644 --- a/examples/cosmos3/Dockerfile +++ b/examples/cosmos3/Dockerfile @@ -137,8 +137,13 @@ RUN mkdir -p /cache/torchinductor /cache/triton COPY patches /workspace/deepinfra-patches RUN git -C /workspace apply --verbose deepinfra-patches/*.patch -# DeepInfra Dynamo videogen worker. Runtime args -# (--served-model-name, --model, --num-gpus, ...) are appended to this command. -# worker.py self-relaunches under torchrun when --num-gpus > 1. -COPY worker.py /workspace/worker.py +# DeepInfra Dynamo videogen worker. MM2's dynamo deployment runs +# `python3 worker.py` with workingDir=/opt/app (the videogen-worker convention), +# so worker.py MUST live at /opt/app/worker.py — NOT /workspace (where the +# framework is cloned). cosmos_framework is installed editable, so it imports +# fine regardless of cwd. Runtime args (--served-model-name, --model=/data/default, +# --num-gpus) are appended by the deployment; worker.py self-relaunches under +# torchrun when --num-gpus > 1. +COPY worker.py /opt/app/worker.py +WORKDIR /opt/app ENTRYPOINT ["python3", "worker.py"] diff --git a/examples/cosmos3/worker.py b/examples/cosmos3/worker.py index f341a28a24bd..8e629dad9bc4 100644 --- a/examples/cosmos3/worker.py +++ b/examples/cosmos3/worker.py @@ -228,7 +228,10 @@ def resolve(self) -> tuple[int, str, str | None, int, int | None, str | None]: if (w, h) in _SIZE_TO_RES_AR: res, ar = _SIZE_TO_RES_AR[(w, h)] except ValueError: - pass + log.warning( + "ignoring unparseable size %r; using resolution defaults", + self.size, + ) vision_url = self.video_url or self.image_url or self.input_reference return nf, res, ar, fps, seed, vision_url