Skip to content

Commit

Permalink
Remove multi-stage build from Pyfunc ensembler service (#361)
Browse files Browse the repository at this point in the history
* Skip conda pack and unpack

* Activate conda env before running pyfunc server

* Update Pyfunc base image

* Set FOLDER_NAME env

* Upgrade Kaniko version to latest
  • Loading branch information
krithika369 committed Sep 11, 2023
1 parent f9c2a11 commit 909c7eb
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 25 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ BatchEnsemblingConfig:
BuildContextURI: git://github.com/caraml-dev/turing.git#refs/heads/main
DockerfileFilePath: engines/pyfunc-ensembler-job/app.Dockerfile
Image: gcr.io/kaniko-project/executor
ImageVersion: v1.6.0
ImageVersion: v1.15.0
ResourceRequestsLimits:
Requests:
CPU: "1"
Expand Down
3 changes: 0 additions & 3 deletions engines/pyfunc-ensembler-service/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,3 @@ COPY ./temp-deps/sdk ./../../sdk

RUN conda env create -f ./env-${PYTHON_VERSION}.yaml -n $CONDA_ENV_NAME && \
rm -rf /root/.cache

# Install conda-pack:
RUN conda install conda-pack
23 changes: 3 additions & 20 deletions engines/pyfunc-ensembler-service/app.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,9 @@ ARG GOOGLE_APPLICATION_CREDENTIALS
RUN if [[-z "$GOOGLE_APPLICATION_CREDENTIALS"]]; then gcloud auth activate-service-account --key-file=${GOOGLE_APPLICATION_CREDENTIALS}; fi
RUN gsutil -m cp -r ${MODEL_URL} .

# Install dependencies required by the user-defined ensembler
RUN conda env update --name ${CONDA_ENV_NAME} --file ./${FOLDER_NAME}/conda.yaml
RUN /bin/bash -c "conda env update --name ${CONDA_ENV_NAME} --file ./${FOLDER_NAME}/conda.yaml"

# Use conda-pack to create a standalone environment
# in /venv:
RUN conda-pack -n ${CONDA_ENV_NAME} -o /tmp/env.tar && \
mkdir /venv && cd /venv && tar xf /tmp/env.tar && \
rm /tmp/env.tar

RUN /venv/bin/conda-unpack

FROM debian:bullseye-slim

ARG FOLDER_NAME
ENV FOLDER_NAME=$FOLDER_NAME

COPY --from=builder /${FOLDER_NAME} ./${FOLDER_NAME}
COPY --from=builder /pyfunc_ensembler_runner ./pyfunc_ensembler_runner
COPY --from=builder /venv ./venv

SHELL ["/bin/bash", "-c"]
ENTRYPOINT source /venv/bin/activate && \
python -m pyfunc_ensembler_runner --mlflow_ensembler_dir /${FOLDER_NAME} -l INFO
ENTRYPOINT . activate ${CONDA_ENV_NAME} && \
python -m pyfunc_ensembler_runner --mlflow_ensembler_dir ./${FOLDER_NAME} -l INFO
2 changes: 1 addition & 1 deletion infra/charts/turing/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ turing:
BuildContextURI: git://github.com/caraml-dev/turing.git#refs/heads/main
DockerfileFilePath: engines/pyfunc-ensembler-service/app.Dockerfile
Image: gcr.io/kaniko-project/executor
ImageVersion: v1.6.0
ImageVersion: v1.15.0
ResourceRequestsLimits:
Requests:
CPU: "1"
Expand Down

0 comments on commit 909c7eb

Please sign in to comment.