Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add custom pip and conda repo hooks #107

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion chassisml_sdk/examples/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
modzy-sdk>=0.6.0
chassisml==1.1.2
chassisml>=1.3
cloudpickle==2.0.0
ipykernel==6.6.0
mlflow>=1.23.1
Expand Down
4 changes: 4 additions & 0 deletions service/.env
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# APP
PORT=5000
#Testing repos
#PYPI_REPO=http://local.repo/repodir
#CONDA_CHANNEL_ALIAS=http://successfully.failed

# mount path inside of Kaniko container
# this path works on Windows and POSIX. Windows will interpret root to mean "C" drive so /data will internally map to C:/data
MOUNT_PATH_DIR=/data
Expand Down
3 changes: 3 additions & 0 deletions service/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,9 @@ def create_job_object(
f'--build-arg=MODEL_CLASS={module_name}',
# Modzy is the default interface.
'--build-arg=INTERFACE=modzy',
f'--build-arg=CHASSIS_PYPI_REPO={os.getenv("PYPI_REPO") if os.getenv("PYPI_REPO") is not None else "https://pypi.org/simple"}',
f'--build-arg=CHASSIS_CONDA_CHANNEL_ALIAS={os.getenv("CONDA_CHANNEL_ALIAS") if os.getenv("CONDA_CHANNEL_ALIAS") is not None else "channel_alias: https://conda.anaconda.org/"}',

]

modzy_uploader_args = [
Expand Down
17 changes: 16 additions & 1 deletion service/flavours/mlflow/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,12 @@ ARG MODEL_CLASS
ARG INTERFACE
# This is the model.yaml file.
ARG MODZY_METADATA_PATH
#PyPi Repo
ARG CHASSIS_PYPI_REPO
#Conda Repo
ARG CHASSIS_CONDA_CHANNEL_ALIAS

#OMI Annotations

LABEL ml.openmodel.interfaces=["${INTERFACE}"]
LABEL ml.openml.model_name="${MODEL_NAME}"
LABEL ml.openmodel.protocols=[["v2"]]
Expand All @@ -22,6 +25,18 @@ LABEL ml.openmodel.port="45000"
WORKDIR /app

RUN apt-get update && apt-get install -y build-essential cmake

#set Python repos
RUN mkdir ~/.pip
RUN echo '[global]' >| ~/.pip/pip.conf
RUN echo 'index-url = '${CHASSIS_PYPI_REPO} >> ~/.pip/pip.conf

RUN echo 'channels:'>| ~/.condarc
RUN echo ' - r'>> ~/.condarc
RUN echo ' - defaults'>> ~/.condarc
RUN echo 'show_channel_urls: True'>> ~/.condarc
RUN echo ${CHASSIS_CONDA_CHANNEL_ALIAS} >> ~/.condarc

# create env
ENV CONDA_ENV chassis-env

Expand Down
19 changes: 17 additions & 2 deletions service/flavours/mlflow/Dockerfile.arm
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
# - flavours
# - mlflow

FROM balenalib/aarch64-ubuntu-python:3-latest-build

FROM balenalib/aarch64-ubuntu-python:3-latest-build-20220513
RUN [ "cross-build-start" ]

# Install miniconda
Expand All @@ -21,9 +20,25 @@ ARG MODEL_CLASS
ARG INTERFACE
# This is the model.yaml file.
ARG MODZY_METADATA_PATH
#PyPi Repo
ARG CHASSIS_PYPI_REPO
#Conda Repo
ARG CHASSIS_CONDA_CHANNEL_ALIAS

WORKDIR /app

#set Python repos
RUN mkdir ~/.pip
RUN echo '[global]' >| ~/.pip/pip.conf
RUN echo 'index-url = '${CHASSIS_PYPI_REPO} >> ~/.pip/pip.conf

RUN echo 'channels:'>| ~/.condarc
RUN echo ' - r'>> ~/.condarc
RUN echo ' - defaults'>> ~/.condarc
RUN echo 'show_channel_urls: True'>> ~/.condarc
RUN echo ${CHASSIS_CONDA_CHANNEL_ALIAS} >> ~/.condarc


COPY flavours/${MODEL_CLASS}/${MODEL_DIR}/conda.yaml ./conda.yaml

ENV CONDA_ENV chassis-env
Expand Down
15 changes: 15 additions & 0 deletions service/flavours/mlflow/Dockerfile.arm.gpu
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,24 @@ ARG MODEL_CLASS
ARG INTERFACE
# This is the model.yaml file.
ARG MODZY_METADATA_PATH
#PyPi Repo
ARG CHASSIS_PYPI_REPO
#Conda Repo
ARG CHASSIS_CONDA_CHANNEL_ALIAS

WORKDIR /app

#set Python repos
RUN mkdir ~/.pip
RUN echo '[global]' >| ~/.pip/pip.conf
RUN echo 'index-url = '${CHASSIS_PYPI_REPO} >> ~/.pip/pip.conf

RUN echo 'channels:'>| ~/.condarc
RUN echo ' - r'>> ~/.condarc
RUN echo ' - defaults'>> ~/.condarc
RUN echo 'show_channel_urls: True'>> ~/.condarc
RUN echo ${CHASSIS_CONDA_CHANNEL_ALIAS} >> ~/.condarc

COPY flavours/${MODEL_CLASS}/${MODEL_DIR}/requirements.txt ./user_requirements.txt

RUN apt-get update && apt-get install libffi-dev
Expand Down
15 changes: 15 additions & 0 deletions service/flavours/mlflow/Dockerfile.gpu
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,24 @@ ARG MODEL_CLASS
ARG INTERFACE
# This is the model.yaml file.
ARG MODZY_METADATA_PATH
#PyPi Repo
ARG CHASSIS_PYPI_REPO
#Conda Repo
ARG CHASSIS_CONDA_CHANNEL_ALIAS

WORKDIR /app

#set Python repos
RUN mkdir ~/.pip
RUN echo '[global]' >| ~/.pip/pip.conf
RUN echo 'index-url = '${CHASSIS_PYPI_REPO} >> ~/.pip/pip.conf

RUN echo 'channels:'>| ~/.condarc
RUN echo ' - r'>> ~/.condarc
RUN echo ' - defaults'>> ~/.condarc
RUN echo 'show_channel_urls: True'>> ~/.condarc
RUN echo ${CHASSIS_CONDA_CHANNEL_ALIAS} >> ~/.condarc

COPY flavours/${MODEL_CLASS}/${MODEL_DIR}/conda.yaml ./conda.yaml

ENV CONDA_ENV chassis-env
Expand Down