-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.cloud
More file actions
112 lines (100 loc) · 6.35 KB
/
Copy pathDockerfile.cloud
File metadata and controls
112 lines (100 loc) · 6.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
FROM python:3.11-slim
# Base tooling — uv on system Python. `rsync` + `openssh-client` are
# required by Ray's autoscaler: it runs `rsync -e 'docker exec -i' …`
# from the host INTO this container to mount bootstrap files at
# cluster-up time, and that needs rsync available on both sides.
RUN apt-get update && apt-get install -y --no-install-recommends \
git curl ca-certificates build-essential \
rsync openssh-client \
postgresql postgresql-client \
&& rm -rf /var/lib/apt/lists/* \
&& pip install --no-cache-dir uv
WORKDIR /app/bird-interact-agents
# Activate the venv that `uv sync` creates so every subsequent command
# (including the Ray Jobs entrypoint at runtime) resolves `python` to the
# venv's interpreter — without this, the cluster's `python ray_app.py`
# falls back to the system interpreter and the cloud deps aren't visible.
ENV VIRTUAL_ENV=/app/bird-interact-agents/.venv \
PATH=/app/bird-interact-agents/.venv/bin:$PATH
# Ray's autoscaler runs commands inside this container via
# `docker exec -it … bash --login -c -i …`. `bash --login` re-reads
# /etc/profile (and friends), which **clobbers the PATH we set above**
# with the system default, hiding `ray`/`python` from the venv.
# Drop a /etc/profile.d snippet so login + interactive shells see the
# venv too. Also mirror in /etc/bash.bashrc for non-login interactive
# shells. Without this: `bash: ray: command not found` on `ray start`.
RUN printf 'export VIRTUAL_ENV=%s\nexport PATH=%s/bin:$PATH\n' \
"$VIRTUAL_ENV" "$VIRTUAL_ENV" > /etc/profile.d/venv.sh \
&& chmod +x /etc/profile.d/venv.sh \
&& printf 'export VIRTUAL_ENV=%s\nexport PATH=%s/bin:$PATH\n' \
"$VIRTUAL_ENV" "$VIRTUAL_ENV" >> /etc/bash.bashrc
# CODE-LAYERS ──────────────────────────────────────────────────────────────
# Python deps + project install. Physically first so the data COPYs below are
# cached independently of code churn. The sentinel split below still puts these
# inputs under `code_hash` for the image-tag computation.
COPY pyproject.toml uv.lock /app/bird-interact-agents/
# `--no-install-project` installs only the dependencies — the project
# itself can't be installed yet because src/ isn't copied. This step is
# cached as long as pyproject.toml + uv.lock are unchanged.
RUN uv sync --extra all --extra dev --no-install-project
COPY src/ /app/bird-interact-agents/src/
# Now register the project itself in the venv (editable, fast — no
# deps to resolve since `--no-deps`). Without this step the venv has
# every dependency but NOT `bird_interact_agents`, so `python
# ray_app.py` inside the Ray Jobs container fails with
# `ModuleNotFoundError: No module named 'bird_interact_agents'`.
RUN uv pip install --no-deps -e .
# DATA-LAYERS ──────────────────────────────────────────────────────────────
# Bake the audited-gold sidecars into the image.
#
# DEV-1468: the SLayer setup dirs (slayer_models/, slayer_otf_cache/,
# slayer_models_otf/) are NO LONGER baked. They are uploaded to GCS at submit
# (`runs/<id>/slayer_setup/...`) and the in-cluster actor downloads the combo's
# dir once per worker process into its env-override root (BIRD_SLAYER_MODELS_ROOT
# / BIRD_OTF_CACHE_ROOT / BIRD_SLAYER_MODELS_OTF_ROOT, set in cluster.yaml.j2).
# This makes locally-built (gitignored) embeddings.db ship too, and keeps the
# image free of slayer-model churn.
#
# De-bake (this chunk): the benchmark DATASET (mini-interact / livesqlbench)
# is NO LONGER baked either. It is uploaded ONCE to a content-hashed GCS prefix
# at submit (`cloud/benchmark_data.ensure_uploaded`) and the actor downloads it
# per node into the benchmark's `container_data_dir` (`/data/<benchmark>`),
# then points the benchmark's data-root/data-file env vars at it. The gated
# gold sidecar rides along inside that dataset upload (it lives in the data
# root), so it is not baked here. This removes the per-rebuild dataset re-bake
# and lets one image serve any benchmark. `BIRD_DB_PATH`/`BIRD_DATA_PATH` are
# therefore set by the actor at runtime, NOT pinned here.
# `audited_gold/` lives in the main checkout (gitignored, never tracked) — pulled
# in via BuildKit's `--build-context audited-gold=<paths.audited_gold_root()>`
# arg that `image.build_and_push` sets at build time. This keeps the cloud
# build runnable from any git worktree (the dir doesn't exist there) without
# requiring the user to manually mirror it. Author-produced corrections are
# code-like, so they stay baked (unlike the raw dataset/gold).
COPY --from=audited-gold . /app/bird-interact-agents/audited_gold/
# DEV-1515: `annotations/` lives in the main checkout (gitignored, same
# posture as audited_gold/) — pulled in via BuildKit's
# `--build-context annotations=<paths.annotations_root()>` arg set by
# `image.build_and_push` so the build runs from any worktree. The grader
# reads task + submission annotations from this dir via
# `paths.annotations_root()`, which resolves to `/app/bird-interact-agents/annotations/`
# inside the worker (via git's `--git-common-dir`).
COPY --from=annotations . /app/bird-interact-agents/annotations/
# DEV-1550: bake the upstream BIRD-Interact and livesqlbench grader
# subtrees so `eval.upstream_ex_base` can load `test_utils.py` +
# `db_utils.py` in the cloud actor. Without this the cascade-tier-N1
# dispatch silently falls back to legacy `_set_equal` (the loader's
# `FileNotFoundError` is caught upstream and downgraded), so the PR's
# N1=ex_base promise never engages in production.
#
# Build contexts (`bird-interact-evaluation`, `livesqlbench-evaluation`)
# are wired by `cloud.image.build_and_push` and point at the evaluation
# subdirs of `paths.bird_interact_root()` / `paths.livesqlbench_root()`.
# The deeper rel paths preserved here match the host-tree layout so
# `_MINI_INTERACT_REL` / `_LIVESQLBENCH_REL` in `upstream_ex_base` resolve
# identically on cloud and on the developer laptop.
COPY --from=bird-interact-evaluation . \
/app/upstream_graders/bird-interact/mini_interact/knowledge_based/mini_interact_conv/evaluation/
COPY --from=livesqlbench-evaluation . \
/app/upstream_graders/livesqlbench/evaluation/src/
ENV BIRD_RESULTS_ROOT=/tmp/results \
BIRD_INTERACT_AGENTS_CLOUD=1