many-keyboard-72430
08/09/2023, 5:12 PM@batch. (The motivation in this case for the multi-stage build is mainly to save space/time.)
I’ve tried a build like this:
FROM python:3.11 as build-stage
RUN python -m venv /opt/venv
ENV PATH="/opt/venv/bin:$PATH"
#... install python dependencies to venv ...
FROM python:3.11-slim as deploy-stage
COPY --from=build-stage /opt/venv /opt/venv
ENV PATH="/opt/venv/bin:$PATH"
And a version of the above which adds the ENV/WORKDIR/USER lines mentioned in the docs (ref).
Either version yields an error like:
Data store error:
No completed attempts of the task was found for task '<my-task-path>'
The same flow runs successfully to completion if I use a one-stage build, ie one that just starts from python:3.11.
Any help appreciated.ancient-application-36103
08/09/2023, 5:43 PMmany-keyboard-72430
08/09/2023, 5:44 PMancient-application-36103
08/09/2023, 5:46 PMmany-keyboard-72430
08/09/2023, 5:49 PMancient-application-36103
08/09/2023, 5:54 PMancient-application-36103
08/09/2023, 5:55 PMancient-application-36103
08/09/2023, 5:56 PM-slim image wouldn't work because we need wgetmany-keyboard-72430
08/09/2023, 6:00 PM@batch(image="python:3.11-slim") without making the calls to requests or llama-cpp, just an os.listdir() iirc, and it worked, but I might be misremembering. Would this experiment test the wget hypothesis?many-keyboard-72430
08/09/2023, 6:18 PMprint(os.listdir()) as proof of life] This runs successfully e2e.
2. [`image="mmacpherson/llm-meta:latest"`/`@batch()` step runs print(os.listdir()) as proof of life] Where I removed the pip install lines, so it is only creating the venv in the build stage, copying it over in the deploy stage, and setting the ENV/WORKDIR/USER per the docs above. (I confirm that I can run the python in that image at /opt/venv as expected.) With no installed packages, this setup fails in the @batch() step with that “Data store error:” noted above.
Here is the complete Dockerfile used to produce the image in expt 2:
FROM python:3.11 as compile-image
RUN python -m venv /opt/venv
ENV PATH="/opt/venv/bin:$PATH"
# RUN pip install --no-cache-dir --upgrade pip && \
# pip install --no-cache-dir --upgrade \
# llama-cpp-python \
# requests
FROM python:3.11-slim AS run-image
COPY --from=compile-image /opt/venv /opt/venv
ENV PATH="/opt/venv/bin:$PATH"
# Per Metaflow's docs.
RUN mkdir /logs && chown 1000 /logs
RUN mkdir /metaflow && chown 1000 /metaflow
ENV HOME=/metaflow
WORKDIR /metaflow
USER 1000many-keyboard-72430
08/10/2023, 5:40 AMFROM python:3.11 as compile-image
RUN pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir --upgrade \
llama-cpp-python \
requests
FROM python:3.11-slim AS run-image
COPY --from=compile-image /usr/local/lib/python3.11 /usr/local/lib/python3.11
# Per Metaflow's docs.
RUN mkdir /logs && chown 1000 /logs
RUN mkdir /metaflow && chown 1000 /metaflow
ENV HOME=/metaflow
WORKDIR /metaflow
USER 1000