Skip to content

Commit e3c40a3

Browse files
authored
Prompt changes and build caching (#15)
1 parent cb21ab4 commit e3c40a3

File tree

4 files changed

+22
-49
lines changed

4 files changed

+22
-49
lines changed

src/fhda/Dockerfile.custom_deployment

Lines changed: 19 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ RUN --mount=type=cache,target=/var/cache/apt \
1616
build-essential && \
1717
apt-get clean && rm -rf /var/lib/apt/lists/*
1818

19-
RUN wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda.sh && \
19+
RUN wget https://repo.anaconda.com/miniconda/Miniconda3-py312_25.3.1-1-Linux-x86_64.sh -O ~/miniconda.sh && \
2020
chmod +x ~/miniconda.sh && \
2121
bash ~/miniconda.sh -b -p /app/miniconda && \
2222
rm ~/miniconda.sh && \
@@ -28,11 +28,14 @@ ENV PATH="/app/miniconda/bin:$PATH"
2828
ENV PYTHONPATH="/app/miniconda/lib/python3.12/site-packages:${PYTHONPATH:-}"
2929

3030
# Install uv & mamba
31-
RUN pip3 install --no-cache-dir uv==0.5.21
32-
RUN conda install -c conda-forge mamba -y
31+
RUN --mount=type=cache,target=/root/.cache/pip \
32+
pip3 install --no-cache-dir uv==0.5.21
33+
RUN --mount=type=cache,target=/app/miniconda/pkgs \
34+
conda install -c conda-forge mamba -y
3335

3436
# Install R and kernels in the crow_env environment
35-
RUN mamba install -c conda-forge -y \
37+
RUN --mount=type=cache,target=/app/miniconda/pkgs \
38+
mamba install -c conda-forge -y \
3639
r-base=4.3.3 \
3740
r-recommended=4.3 \
3841
r-irkernel=1.3.2 \
@@ -83,10 +86,13 @@ RUN mamba install -c conda-forge -y \
8386
statsmodels=0.14.4 \
8487
umap-learn=0.5.7
8588

86-
RUN python -m ipykernel install --user --name python3 --display-name "Python 3 (ipykernel)"
87-
RUN R -e 'IRkernel::installspec(name = "R", displayname = "R (4.3.3)")'
89+
RUN --mount=type=cache,target=/app/miniconda/pkgs \
90+
python -m ipykernel install --user --name python3 --display-name "Python 3 (ipykernel)"
91+
RUN --mount=type=cache,target=/app/miniconda/pkgs \
92+
R -e 'IRkernel::installspec(name = "R", displayname = "R (4.3.3)")'
8893

89-
RUN mamba install -c conda-forge -c bioconda -y \
94+
RUN --mount=type=cache,target=/app/miniconda/pkgs \
95+
mamba install -c conda-forge -c bioconda -y \
9096
biokit=0.5.0 \
9197
gseapy=1.1.4 \
9298
blast=2.16.0 \
@@ -109,22 +115,15 @@ RUN mamba install -c conda-forge -c bioconda -y \
109115
bioconductor-genomicranges=1.54.1 \
110116
bioconductor-summarizedexperiment=1.32.0 \
111117
bioconductor-apeglm=1.24.0 \
112-
bioconductor-flowcore=2.14.0
118+
bioconductor-flowcore=2.14.0 \
119+
bioconductor-flowmeans=1.62.0
113120

114121
ENV UV_COMPILE_BYTECODE=1
115122
ENV UV_LINK_MODE=copy
116123

117124
FROM base AS builder
118125

119126
ARG MODULE_NAME
120-
ARG USE_INTERNAL_DEPS
121-
ARG USE_GIT_FUTUREHOUSE_CLIENT
122-
123-
124-
RUN mkdir -p ~/.ssh && \
125-
chmod 700 ~/.ssh && \
126-
ssh-keyscan github.com >> ~/.ssh/known_hosts && \
127-
printf "Host github.com\n IdentityFile /root/.ssh/pqa_id_ed25519\n IdentityFile /root/.ssh/aviary_id_ed25519\nHost gitlab.company.com\n IdentityFile /root/.ssh/pqa_id_ed25519\n" > ~/.ssh/config
128127

129128
RUN --mount=type=cache,target=/var/cache/apt \
130129
apt-get update -qq && \
@@ -135,36 +134,15 @@ RUN --mount=type=cache,target=/var/cache/apt \
135134
ENV VIRTUAL_ENV="/app/miniconda/bin"
136135
ENV PATH="/app/miniconda/bin:$PATH"
137136

137+
# Now copy application code (this will change frequently)
138138
COPY ./${MODULE_NAME} /app/${MODULE_NAME}
139-
140139
RUN mkdir -p /app/scripts
141140
COPY ./scripts/run_crow_job.py /app/scripts/
142141

143-
RUN --mount=type=cache,target=/root/.cache/uv \
144-
--mount=type=ssh \
145-
--mount=type=secret,id=ssh_key,target=/root/.ssh/aviary_id_ed25519.tmp \
146-
if [ "$USE_INTERNAL_DEPS" = "true" ]; then \
147-
cp /root/.ssh/aviary_id_ed25519.tmp /root/.ssh/aviary_id_ed25519 && \
148-
chmod 400 /root/.ssh/aviary_id_ed25519 && \
149-
git clone git@github.com:Future-House/aviary-internal.git /app/aviary_internal && \
150-
cd /app/aviary_internal/aviary_internal && \
151-
uv pip install --system -e .; \
152-
else \
153-
echo 'Skipping aviary_internal install'; \
154-
fi && \
155-
if [ "$USE_GIT_FUTUREHOUSE_CLIENT" = "true" ]; then \
156-
git clone git@github.com:Future-House/crow-ecosystem.git /app/crow-ecosystem && \
157-
cd /app/crow-ecosystem/packages/futurehouse-client && \
158-
uv pip install --system -e .; \
159-
else \
160-
uv pip install --system futurehouse-client; \
161-
fi
162-
142+
# Install application dependencies (this will only rerun when code changes)
163143
WORKDIR /app/${MODULE_NAME}
164-
RUN --mount=type=ssh \
165-
--mount=type=secret,id=pqa_ssh_key,target=/root/.ssh/pqa_id_ed25519.tmp \
166-
cp /root/.ssh/pqa_id_ed25519.tmp /root/.ssh/pqa_id_ed25519 && \
167-
chmod 400 /root/.ssh/pqa_id_ed25519 && \
144+
RUN --mount=type=cache,target=/root/.cache/uv \
145+
--mount=type=cache,target=/app/miniconda/pkgs \
168146
if [ -f "pyproject.toml" ]; then \
169147
uv pip install --system -e .; \
170148
elif [ -f "requirements.txt" ]; then \
@@ -176,11 +154,6 @@ RUN --mount=type=ssh \
176154
RUN find /app -type l -delete && \
177155
rm -rf /app/.git
178156

179-
# Fix futurehouse_client imports by creating a symlink if we're using the git version
180-
RUN if [ "$USE_GIT_FUTUREHOUSE_CLIENT" = "true" ]; then \
181-
ln -sf /app/crow-ecosystem/packages/futurehouse-client/futurehouse_client /app/miniconda/lib/python3.12/site-packages/futurehouse_client; \
182-
fi
183-
184157
FROM base AS runtime
185158

186159
COPY --from=builder /app/ /app/

src/fhda/data_analysis_env.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,8 +190,6 @@ def from_task(
190190
# Overwrite the language in the kwargs with NBLanguage enum
191191
kwargs["language"] = language
192192
logger.info("Language: %s", language.name)
193-
if language == NBLanguage.R:
194-
task += f"\n{prompts.R_OUTPUT_RECOMMENDATION_PROMPT}"
195193

196194
if trajectory_path.exists():
197195
files = list(trajectory_path.iterdir())

src/fhda/prompts.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@
4343
```r
4444
print(head(dataframe))
4545
```
46+
47+
4. Very important: always use the tidyverse package where possible.
4648
"""
4749

4850

src/scripts/deploy.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"STAGE": "PROD",
2222
}
2323

24-
CONTAINER_CONFIG = DockerContainerConfiguration(cpu="2", memory="4Gi")
24+
CONTAINER_CONFIG = DockerContainerConfiguration(cpu="8", memory="16Gi")
2525

2626
frame_paths = [
2727
FramePath(path="info.cost", type="text"),

0 commit comments

Comments
 (0)