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

Prepackaged RedHat Model Servers #1775

Merged
merged 22 commits into from
May 25, 2020
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
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
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ examples/models/keras_mnist/build/
examples/models/mean_classifier/build/
notebooks/my-ml-deployment/

wrappers/s2i/python/Dockerfile
wrappers/s2i/python/_wrappers

.Rhistory
Expand Down
81 changes: 71 additions & 10 deletions ci_build_and_push_images.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ function build_push_operator {
-C operator \
docker-build \
docker-push \
docker-build-redhat
docker-build-redhat \
docker-push-redhat
OPERATOR_EXIT_VALUE=$?
}

Expand All @@ -46,7 +47,8 @@ function build_push_executor {
-C executor \
docker-build \
docker-push \
docker-build-redhat
docker-build-redhat \
docker-push-redhat
EXECUTOR_EXIT_VALUE=$?
}

Expand All @@ -58,7 +60,8 @@ function build_push_engine {
-C engine \
build_image \
push_to_registry \
docker-build-redhat
docker-build-redhat \
docker-push-redhat
ENGINE_EXIT_VALUE=$?
}

Expand All @@ -68,36 +71,88 @@ function build_push_mock {
build_rest \
build_grpc \
push_rest \
push_grpc \
docker-build-redhat
push_grpc
MOCK_MODEL_EXIT_VALUE=$?
}

function build_push_alibi_detect {
make \
-C components/alibi-detect-server \
docker-build \
docker-push \
docker-build-redhat
docker-push
ALIBI_DETECT_EXIT_VALUE=$?
}

function build_push_request_logger {
make \
-C components/seldon-request-logger \
build_image \
push_image \
docker-build-redhat
push_image
LOGGER_EXIT_VALUE=$?
}

function build_push_sklearnserver {
make \
-C servers/sklearnserver \
build_all \
push_all
SKLEARN_EXIT_VALUE=$?
}

function build_push_mlflowserver {
make \
-C servers/mlflowserver \
build_all \
push_all
MLFLOW_EXIT_VALUE=$?
}

function build_push_xgboostserver {
make \
-C servers/xgboostserver \
build_all \
push_all
XGBOOST_EXIT_VALUE=$?
}

function build_push_tfproxy {
make \
-C integrations/tfserving \
build_all \
push_all
TFPROXY_EXIT_VALUE=$?
}

function build_push_alibi_explainer {
make \
-C components/alibi-explain-server \
docker-build \
docker-push
EXPLAIN_EXIT_VALUE=$?
}

function build_push_storage_initializer {
make \
-C components/storage-initializer \
docker-build \
docker-push
STORAGE_INITIALIZER_EXIT_VALUE=$?
}


build_push_python
build_push_operator
build_push_executor
build_push_engine
build_push_mock
build_push_alibi_detect
build_push_request_logger
build_push_sklearnserver
build_push_mlflowserver
build_push_xgboostserver
build_push_tfproxy
build_push_alibi_explainer
build_push_storage_initializer

#######################################
# EXIT STOPS COMMANDS FROM HERE ONWARDS
Expand All @@ -122,6 +177,12 @@ exit $((${PYTHON_EXIT_VALUE} \
+ ${EXECUTOR_EXIT_VALUE} \
+ ${MOCK_MODEL_EXIT_VALUE} \
+ ${ALIBI_DETECT_EXIT_VALUE} \
+ ${LOGGER_EXIT_VALUE}))
+ ${LOGGER_EXIT_VALUE} \
+ ${SKLEARN_EXIT_VALUE} \
+ ${MLFLOW_EXIT_VALUE} \
+ ${XGBOOST_EXIT_VALUE} \
+ ${TFPROXY_EXIT_VALUE} \
+ ${STORAGE_INITIALIZER_EXIT_VALUE} \
+ ${EXPLAIN_EXIT_VALUE}))


25 changes: 17 additions & 8 deletions components/alibi-detect-server/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
FROM python:3.7

RUN apt-get update \
&& apt-get install -y --no-install-recommends git \
&& apt-get purge -y --auto-remove \
&& rm -rf /var/lib/apt/lists/*

WORKDIR /workspace
FROM registry.access.redhat.com/ubi8/python-36
axsaucedo marked this conversation as resolved.
Show resolved Hide resolved
LABEL name="Seldon Alibi Detect Server" \
vendor="Seldon Technologies" \
version="1.1.1-rc" \
release="1" \
summary="Alibi Detect Server for Seldon Core" \
description="The Alibi Detect Server provides outlier, drift and adversarial detection services for Seldon Core"

ADD requirements_server.txt .

RUN pip install pip -U

RUN pip install -r requirements_server.txt

# Fix cloudevents bug: https://github.com/cloudevents/sdk-python/issues/24
Expand All @@ -21,4 +22,12 @@ COPY setup.py .

RUN pip install -e .

# Add licences
RUN pip install pip-licenses
RUN mkdir ./licenses && pip-licenses --from=mixed --format=csv --output-file=./licenses/license_info.csv && \
pip-licenses --from=mixed --format=plain-vertical --with-license-file --no-license-path --output-file=./licenses/license.txt
USER root
RUN mv ./licenses /licenses
USER default

ENTRYPOINT ["python", "-m", "adserver"]
33 changes: 0 additions & 33 deletions components/alibi-detect-server/Dockerfile.redhat

This file was deleted.

36 changes: 15 additions & 21 deletions components/alibi-detect-server/Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
SHELL := /bin/bash
VERSION := $(shell cat ../../version.txt)
IMAGE=alibi-detect-server

Expand All @@ -17,12 +18,6 @@ test: type_check
lint:
black .

docker-build:
docker build -f Dockerfile -t seldonio/${IMAGE}:${VERSION} .

docker-push:
docker push seldonio/${IMAGE}:${VERSION}

#
# Local Run
#
Expand Down Expand Up @@ -52,24 +47,23 @@ curl-outlier-detector-scores:
curl -v localhost:8080/ -d @./input.json -H "Alibi-Detect-Return-Feature-Score: true" -H "Alibi-Detect-Return-Instance-Score: true"


#
# RedHat
#
docker-build:
docker build -f Dockerfile -t seldonio/${IMAGE}:${VERSION} .

IMAGE_NAME_BASE=alibi-detect-server
IMG_VERSION_REDHAT ?= ${IMAGE_NAME_BASE}-ubi8:${VERSION}
IMG_REDHAT ?= seldonio/${IMG_VERSION_REDHAT}
docker-push:
docker push seldonio/${IMAGE}:${VERSION}

# Build the docker image for Redhat
docker-build-redhat:
docker build . -f Dockerfile.redhat -t ${IMG_REDHAT}
kind_load: docker-build
kind load docker-image seldonio/${IMAGE}:${VERSION}

# Push the docker image
docker-push-redhat:
docker push ${IMG_REDHAT}
#
# RedHat
#

# password can be found at: https://connect.redhat.com/project/3993461/view
redhat-image-scan:
docker login -u unused scan.connect.redhat.com
docker tag ${IMG_REDHAT} scan.connect.redhat.com/ospid-32ed6498-bce5-4c3b-9486-fe1c6e2582d3/${IMG_VERSION_REDHAT}
docker push scan.connect.redhat.com/ospid-32ed6498-bce5-4c3b-9486-fe1c6e2582d3/${IMG_VERSION_REDHAT}
docker pull seldonio/${IMAGE}:${VERSION}
source ~/.config/seldon/seldon-core/redhat-image-passwords.sh && \
echo $${rh_password_alibi_detect} | docker login -u unused scan.connect.redhat.com --password-stdin
docker tag seldonio/${IMAGE}:${VERSION} scan.connect.redhat.com/ospid-32ed6498-bce5-4c3b-9486-fe1c6e2582d3/${IMAGE}:${VERSION}
docker push scan.connect.redhat.com/ospid-32ed6498-bce5-4c3b-9486-fe1c6e2582d3/${IMAGE}:${VERSION}
1 change: 1 addition & 0 deletions components/alibi-explain-server/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
kfserving
30 changes: 30 additions & 0 deletions components/alibi-explain-server/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
FROM registry.access.redhat.com/ubi8/python-36
LABEL name="Seldon Alibi Wrapper" \
vendor="Seldon Technologies" \
version="1.1.1-rc" \
release="1" \
summary="Alibi Explainer Wrapper for Seldon Core" \
description="Allows Seldon Core inference models to run with a black box model explanation model from the Alibi:Explain project"


COPY kfserving/python/alibiexplainer alibiexplainer
COPY kfserving/python/kfserving kfserving
COPY kfserving/python/third_party third_party

USER root
RUN pip install --upgrade pip && pip install -e ./kfserving
RUN git clone https://github.com/SeldonIO/alibi.git && \
cd alibi && \
pip install .
RUN pip install -e ./alibiexplainer

RUN chmod -R a+rwx /opt/app-root/lib/python3.6

# Add licences
RUN pip install pip-licenses
RUN mkdir ./licenses && pip-licenses --from=mixed --format=csv --output-file=./licenses/license_info.csv && \
pip-licenses --from=mixed --format=plain-vertical --with-license-file --no-license-path --output-file=./licenses/license.txt
RUN mv ./licenses /licenses
USER default

ENTRYPOINT ["python", "-m", "alibiexplainer"]
26 changes: 26 additions & 0 deletions components/alibi-explain-server/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
SHELL := /bin/bash
VERSION := $(shell cat ../../version.txt)
IMAGE=alibiexplainer

kfserving:
git clone -b seldon_grpc_explainer https://github.com/seldonio/kfserving.git

docker-build: kfserving
docker build --file=Dockerfile --force-rm=true -t seldonio/${IMAGE}:${VERSION} .

docker-push:
docker push seldonio/${IMAGE}:${VERSION}

kind_load: docker-build
kind load docker-image seldonio/${IMAGE}:${VERSION}

# password can be found at: https://connect.redhat.com/project/3987291/view
redhat-image-scan:
docker pull seldonio/${IMAGE}:${VERSION}
source ~/.config/seldon/seldon-core/redhat-image-passwords.sh && \
echo $${rh_password_alibi_explain} | docker login -u unused scan.connect.redhat.com --password-stdin
docker tag seldonio/${IMAGE}:${VERSION} scan.connect.redhat.com/ospid-02f3e15b-c16f-4353-affa-61d5f3c6408b/${IMAGE}:${VERSION}
docker push scan.connect.redhat.com/ospid-02f3e15b-c16f-4353-affa-61d5f3c6408b/${IMAGE}:${VERSION}

clean:
rm -rf kfserving
22 changes: 19 additions & 3 deletions components/seldon-request-logger/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,24 @@
FROM python:3.7-slim
COPY . /app
WORKDIR /app
FROM registry.access.redhat.com/ubi8/python-36
LABEL name="Seldon Request Logger" \
vendor="Seldon Technologies" \
version="1.1.1-rc" \
release="1" \
summary="The payload logger for Seldon Core" \
description="The Seldon Payload Logger allows request and response payloads from a Seldon Core inference graph to be processed and sent to an ELK endpoint"

COPY app app
COPY requirements.txt requirements.txt
RUN pip install -r requirements.txt
RUN pip install gunicorn

# Add licences
RUN pip install pip-licenses
RUN mkdir ./licenses && pip-licenses --from=mixed --format=csv --output-file=./licenses/license_info.csv && \
pip-licenses --from=mixed --format=plain-vertical --with-license-file --no-license-path --output-file=./licenses/license.txt
USER root
RUN mv ./licenses /licenses
USER default

EXPOSE 8080
ENTRYPOINT ["python"]
CMD ["app/default_logger.py"]
24 changes: 0 additions & 24 deletions components/seldon-request-logger/Dockerfile.redhat

This file was deleted.

Loading