Fix worker never picking up code changes after restart
CI / lint (push) Canceled after 0s
CI / typecheck (push) Canceled after 0s
CI / unit-tests (push) Canceled after 0s
CI / integration-tests (push) Canceled after 0s
CI / container-build (push) Canceled after 0s
CI / dependency-audit (push) Canceled after 0s
CI / lint (push) Canceled after 0s
CI / typecheck (push) Canceled after 0s
CI / unit-tests (push) Canceled after 0s
CI / integration-tests (push) Canceled after 0s
CI / container-build (push) Canceled after 0s
CI / dependency-audit (push) Canceled after 0s
docker compose restart worker looked like it should reflect new code (docker-compose.yml bind-mounts ./app:/app/app for dev), but the worker Dockerfile installed the app package non-editably (pip install .), which copies a frozen snapshot into site-packages at image build time. The bare `arq` console-script just imports whatever site-packages says `app` is -- unlike uvicorn --reload, which explicitly resolves its import string against the CWD -- so the worker silently kept running whatever code existed at the last `docker compose up --build`, no matter how many times it was restarted or how recent the git pull was. Confirmed live: after pulling the series/season ingestion pipeline and restarting, the worker log still read "Starting worker for 2 functions: ingest_movie_task, ingest_person_task" -- proof it never saw ingest_series_task/ingest_season_task at all. Switching to `pip install -e .` makes site-packages point at /app by absolute path instead of a frozen copy, so the same bind mount that already worked for the API now actually reaches the worker process too -- a plain restart after `git pull` is enough going forward. Applied to both Dockerfiles for consistency, since the API's working behavior was incidental to uvicorn, not something to rely on either. Co-Authored-By: Claude Sonnet 5 <[email protected]>
This commit is contained in:
co-authored by
Claude Sonnet 5
parent
3acf00e9f0
commit
e6841badf8
@@ -17,7 +17,11 @@ RUN apt-get update \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
COPY pyproject.toml ./
|
||||
COPY app ./app
|
||||
RUN pip install --no-cache-dir .
|
||||
# Editable install so site-packages resolves `app` by absolute path (/app)
|
||||
# rather than a frozen copy — consistent with worker.Dockerfile, and keeps
|
||||
# this correct even though uvicorn --reload happens to resolve its own
|
||||
# import string against the CWD regardless.
|
||||
RUN pip install --no-cache-dir -e .
|
||||
|
||||
FROM base AS runtime
|
||||
RUN useradd --create-home --uid 1000 aurora
|
||||
|
||||
@@ -17,7 +17,14 @@ RUN apt-get update \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
COPY pyproject.toml ./
|
||||
COPY app ./app
|
||||
RUN pip install --no-cache-dir .
|
||||
# Editable install: site-packages ends up pointing at this /app directory by
|
||||
# absolute path rather than a frozen copy of it. That matters because the
|
||||
# `arq` console-script (unlike uvicorn --reload, which explicitly resolves
|
||||
# its app import against the CWD) just imports whatever site-packages says
|
||||
# `app` is — a non-editable install would permanently freeze the worker's
|
||||
# code at whatever this build saw, silently ignoring the dev bind mount
|
||||
# (docker-compose.yml's `./app:/app/app`) on every later `restart`.
|
||||
RUN pip install --no-cache-dir -e .
|
||||
|
||||
FROM base AS runtime
|
||||
RUN useradd --create-home --uid 1000 aurora
|
||||
|
||||
Reference in New Issue
Block a user