You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@submarine.apache.org by pi...@apache.org on 2021/03/12 01:25:32 UTC

[submarine] branch master updated: SUBMARINE-743. Support MLflow server on Submarine

This is an automated email from the ASF dual-hosted git repository.

pingsutw pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/submarine.git


The following commit(s) were added to refs/heads/master by this push:
     new cd56759  SUBMARINE-743. Support MLflow server on Submarine
cd56759 is described below

commit cd56759dc14e6e4a2eab5c0374fa4d98c14e76cf
Author: kobe860219 <ko...@gmail.com>
AuthorDate: Thu Mar 11 03:57:49 2021 -0800

    SUBMARINE-743. Support MLflow server on Submarine
    
    ### What is this PR for?
    When helm install submarine, a mlflow server will installed as a pod. Set tracking_server_uri environment variable in jupyter notebook image, it will log parameters and metrics to mlflow server. Then user could browse the logs through mlflow ui.
    
    ### What type of PR is it?
    [Feature]
    
    ### Todos
    * [x] - Submarine MLflow image
    * [x] - Update submarine jupyter image
    * [ ] - Screenshots
    
    ### What is the Jira issue?
    https://issues.apache.org/jira/browse/SUBMARINE-743
    
    ### How should this be tested?
    https://travis-ci.org/github/kobe860219/submarine/builds/762162178
    
    ### Screenshots (if appropriate)
    
    ### Questions:
    * Does the licenses files need update? No
    * Is there breaking changes for older versions? No
    * Does this needs documentation? No
    
    Author: kobe860219 <ko...@gmail.com>
    Author: Kevin Su <pi...@gmail.com>
    
    Signed-off-by: Kevin <pi...@apache.org>
    
    Closes #531 from kobe860219/SUBMARINE-743 and squashes the following commits:
    
    49a18438 [Kevin Su] Update helm-charts/submarine/templates/submarine-mlflow.yaml
    319b48a5 [kobe860219] Chmod 744 for build.sh
    85156283 [kobe860219] Add mlflow docker image and  github action
    d0f4531f [kobe860219] SUBMARINE-743. Support MLflow server on Submarine
---
 .github/workflows/deploy_docker_images.yml         |  15 ++-
 dev-support/docker-images/jupyter/Dockerfile       |   3 +
 dev-support/docker-images/mlflow/Dockerfile        |  28 ++++++
 dev-support/docker-images/mlflow/build.sh          |  32 +++++++
 .../submarine/templates/submarine-mlflow.yaml      | 106 +++++++++++++++++++++
 helm-charts/submarine/values.yaml                  |   3 +
 6 files changed, 182 insertions(+), 5 deletions(-)

diff --git a/.github/workflows/deploy_docker_images.yml b/.github/workflows/deploy_docker_images.yml
index 264db32..ca7a444 100644
--- a/.github/workflows/deploy_docker_images.yml
+++ b/.github/workflows/deploy_docker_images.yml
@@ -11,11 +11,11 @@ jobs:
     strategy:
       fail-fast: true
     env:
-      SUBMARINE_VERSION: 0.6.0-SNAPSHOT 
+      SUBMARINE_VERSION: 0.6.0-SNAPSHOT
     steps:
       - name: Check out code
         uses: actions/checkout@v2
-        with: 
+        with:
           repository: apache/submarine
       - uses: docker/login-action@v1
         name: Login to Docker Hub
@@ -34,18 +34,23 @@ jobs:
         run: ./dev-support/docker-images/submarine/build.sh
       - name: Push submarine-server docker image
         run: docker push apache/submarine:server-$SUBMARINE_VERSION
-      
+
       - name: Build submarine database
         run: ./dev-support/docker-images/database/build.sh
       - name: Push submarine-database docker image
         run: docker push apache/submarine:database-$SUBMARINE_VERSION
-      
+
       - name: Build submarine jupyter
         run: ./dev-support/docker-images/jupyter/build.sh
       - name: Push submarine-jupyter docker image
         run: docker push apache/submarine:jupyter-notebook-$SUBMARINE_VERSION
-      
+
       - name: Build submarine operator
         run: ./dev-support/docker-images/operator/build.sh
       - name: Push submarine-operator docker image
         run: docker push apache/submarine:operator-$SUBMARINE_VERSION
+
+      - name: Build submarine mlflow
+        run: ./dev-support/docker-images/mlflow/build.sh
+      - name: Push submarine-mlflow docker image
+        run: docker push apache/submarine:mlflow-$SUBMARINE_VERSION
diff --git a/dev-support/docker-images/jupyter/Dockerfile b/dev-support/docker-images/jupyter/Dockerfile
index 8592e70..ad7aea3 100644
--- a/dev-support/docker-images/jupyter/Dockerfile
+++ b/dev-support/docker-images/jupyter/Dockerfile
@@ -19,6 +19,7 @@ ARG NB_USER="jovyan"
 ARG NB_UID="1000"
 ARG NB_PREFIX="/"
 ARG NB_PORT=8888
+ARG MLFLOW_TRACKING_URI="http://10.96.0.3:8080"
 
 USER root
 
@@ -55,6 +56,8 @@ ENV NB_USER=$NB_USER \
 ENV PATH=$CONDA_DIR/bin:$PATH \
     HOME=/home/$NB_USER
 
+ENV MLFLOW_TRACKING_URI=$MLFLOW_TRACKING_URI
+
 # Create NB_USER user with UID=1000 and in the 'users' group
 RUN useradd -M -s /bin/bash -N -u $NB_UID $NB_USER && \
     chown -R ${NB_USER}:users /usr/local/bin && \
diff --git a/dev-support/docker-images/mlflow/Dockerfile b/dev-support/docker-images/mlflow/Dockerfile
new file mode 100644
index 0000000..e316cfc
--- /dev/null
+++ b/dev-support/docker-images/mlflow/Dockerfile
@@ -0,0 +1,28 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+FROM python:3.7.0-slim
+
+RUN pip install mlflow
+
+RUN mkdir /submarine-mlflow
+
+WORKDIR /submarine-mlflow
+
+EXPOSE 5000
+
+CMD mlflow server \
+    --host 0.0.0.0 \
+    --static-prefix "/mlflow"
\ No newline at end of file
diff --git a/dev-support/docker-images/mlflow/build.sh b/dev-support/docker-images/mlflow/build.sh
new file mode 100755
index 0000000..0a663dc
--- /dev/null
+++ b/dev-support/docker-images/mlflow/build.sh
@@ -0,0 +1,32 @@
+#!/usr/bin/env bash
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+set -euxo pipefail
+
+MLFLOW_IMAGE="apache/submarine:mlflow-0.6.0-SNAPSHOT"
+
+if [ -L ${BASH_SOURCE-$0} ]; then
+  PWD=$(dirname $(readlink "${BASH_SOURCE-$0}"))
+else
+  PWD=$(dirname ${BASH_SOURCE-$0})
+fi
+export CURRENT_PATH=$(cd "${PWD}">/dev/null; pwd)
+export SUBMARINE_HOME=${CURRENT_PATH}/../../..
+
+# build image
+echo "Start building the ${MLFLOW_IMAGE} docker image ..."
+cd ${CURRENT_PATH}
+docker build -t ${MLFLOW_IMAGE} .
\ No newline at end of file
diff --git a/helm-charts/submarine/templates/submarine-mlflow.yaml b/helm-charts/submarine/templates/submarine-mlflow.yaml
new file mode 100644
index 0000000..bd90a60
--- /dev/null
+++ b/helm-charts/submarine/templates/submarine-mlflow.yaml
@@ -0,0 +1,106 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+apiVersion: v1
+kind: PersistentVolume
+metadata:
+  name: submarine-mlflow-pv
+spec:
+  accessModes:
+    - ReadWriteMany
+  capacity:
+    storage: "{{ .Values.submarine.mlflow.storage }}"
+{{- with .Values.submarine.storage }}
+  {{- if eq (.type | lower) "nfs" }}
+  nfs:
+    server: {{ .nfs.ip }}
+    path: {{ .nfs.path }}
+  {{- else }}
+  hostPath:
+    path: "{{ .host.path }}"
+    type: DirectoryOrCreate
+  {{- end }}
+{{- end}}
+---
+apiVersion: v1
+kind: PersistentVolumeClaim
+metadata:
+  name: submarine-mlflow-pvc
+spec:
+  accessModes:
+    - ReadWriteMany
+  storageClassName: ""
+  resources:
+    requests:
+      storage: "{{ .Values.submarine.mlflow.storage }}"
+  volumeName: submarine-mlflow-pv
+---
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+  name: submarine-mlflow
+spec:
+  selector:
+    matchLabels:
+      app: submarine-mlflow-pod
+  template:
+    metadata:
+      labels:
+        app: submarine-mlflow-pod
+    spec:
+      containers:
+      - name: submarine-mlflow-container
+        image: apache/submarine:mlflow-0.6.0-SNAPSHOT
+        imagePullPolicy: IfNotPresent
+        ports:
+        - containerPort: 5000
+        volumeMounts:
+          - mountPath: "/logs"
+            name: "volume"
+            subPath: "submarine-mlflow"
+      volumes:
+        - name: "volume"
+          persistentVolumeClaim:
+            claimName: "submarine-mlflow-pvc"
+---
+apiVersion: v1
+kind: Service
+metadata:
+  name: submarine-mlflow-service
+spec:
+  clusterIP: 10.96.0.3
+  selector:
+    app: submarine-mlflow-pod
+  ports:
+  - protocol: TCP
+    port: 5000
+    targetPort: 5000
+---
+apiVersion: traefik.containo.us/v1alpha1
+kind: IngressRoute
+metadata:
+  name: submarine-mlflow-ingressroute
+spec:
+  entryPoints:
+    - web
+  routes:
+  - kind: Rule
+    match: "PathPrefix(`{{ .Values.submarine.mlflow.ingressPath }}`)"
+    services:
+    - kind: Service
+      name: submarine-mlflow-service
+      port: 5000
diff --git a/helm-charts/submarine/values.yaml b/helm-charts/submarine/values.yaml
index 9bb1d5a..763a3fb 100644
--- a/helm-charts/submarine/values.yaml
+++ b/helm-charts/submarine/values.yaml
@@ -36,6 +36,9 @@ submarine:
   tensorboard:
     storage: 10Gi
     ingressPath: "/tensorboard"
+  mlflow:
+    storage: 10Gi
+    ingressPath: "/mlflow"
   storage:
     type: host # "host" or "nfs"
     host:


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@submarine.apache.org
For additional commands, e-mail: dev-help@submarine.apache.org