Skip to content
This repository has been archived by the owner on Oct 6, 2023. It is now read-only.

Commit

Permalink
Merge pull request #50 from akchinSTC/v3.12.0
Browse files Browse the repository at this point in the history
Refactor for use with new notebook launcher
  • Loading branch information
harshad16 authored Nov 8, 2022
2 parents 5e215f8 + 1321bf5 commit f811bf1
Show file tree
Hide file tree
Showing 10 changed files with 100 additions and 1,940 deletions.
4 changes: 2 additions & 2 deletions .aicoe-ci.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
check:
- thoth-build
build:
base-image: "quay.io/thoth-station/s2i-minimal-py38-notebook:v0.3.0"
build-stratergy: "Source"
build-strategy: Dockerfile
dockerfile-path: Dockerfile
custom-tag: "latest"
registry: "quay.io"
registry-org: "thoth-station"
Expand Down
17 changes: 0 additions & 17 deletions .s2i/bin/assemble

This file was deleted.

2 changes: 0 additions & 2 deletions .s2i/environment

This file was deleted.

2 changes: 1 addition & 1 deletion .thoth.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
host: khemenu.thoth-station.ninja
tls_verify: false
requirements_format: pipenv
requirements_format: pip

runtime_environments:
- name: 'ubi8'
Expand Down
16 changes: 16 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM quay.io/thoth-station/s2i-minimal-py38-notebook:v0.5.0

ENV JUPYTER_ENABLE_LAB=true
ENV CRIO_RUNTIME=true

WORKDIR /opt/app-root/bin

COPY setup-elyra.sh start-notebook.sh requirements.txt ./

RUN python3 -m pip install -r requirements.txt && \
rm -f requirements.txt

RUN chmod -R g+w /opt/app-root/lib/python3.8/site-packages && \
fix-permissions /opt/app-root -P

WORKDIR /opt/app-root/bin
15 changes: 0 additions & 15 deletions Pipfile

This file was deleted.

1,895 changes: 0 additions & 1,895 deletions Pipfile.lock

This file was deleted.

2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Notebook requirements
elyra[kfp-tekton]==3.12.0
17 changes: 9 additions & 8 deletions .s2i/bin/run → setup-elyra.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,23 @@ export COS_BUCKET=${COS_BUCKET:-default}
# If Kubeflow credentials are not supplied, use default Kubeflow installation credentials
KF_USERNAME="${KF_USERNAME:=user@example.com}"
KF_PASSWORD="${KF_PASSWORD:=12341234}"
KF_DEPLOYMENT_NAMESPACE=$(env | grep JUPYTER_IMAGE | cut -d'/' -f2)
AWS_ACCESS_KEY_ID="${AWS_ACCESS_KEY_ID:minio}"
AWS_SECRET_ACCESS_KEY="${AWS_SECRET_ACCESS_KEY:minio123}"

if [[ ! -f "$DEFAULT_RUNTIME_FILE" ]]; then
elyra-metadata install runtimes --schema_name=kfp \
--name=my_kfp \
--display_name="Default Kubeflow Pipeline Runtime" \
--user_namespace="kubeflow-user-example-com" \
--auth_type="DEX_STATIC_PASSWORDS" \
--api_endpoint=http://ml-pipeline-ui.kubeflow/pipeline \
--display_name=Default \
--user_namespace="$KF_DEPLOYMENT_NAMESPACE" \
--auth_type=DEX_STATIC_PASSWORDS \
--api_endpoint=http://ml-pipeline."$KF_DEPLOYMENT_NAMESPACE"/pipeline \
--api_username="$KF_USERNAME" \
--api_password="$KF_PASSWORD" \
--cos_endpoint=http://minio-service.kubeflow:9000 \
--cos_auth_type="USER_CREDENTIALS" \
--cos_endpoint=http://minio-service."$KF_DEPLOYMENT_NAMESPACE":9000 \
--cos_auth_type=USER_CREDENTIALS \
--cos_username="$AWS_ACCESS_KEY_ID" \
--cos_password="$AWS_SECRET_ACCESS_KEY" \
--cos_bucket="$COS_BUCKET" \
--engine=Tekton
fi

exec /usr/libexec/s2i/run
70 changes: 70 additions & 0 deletions start-notebook.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
#!/bin/bash

set -x

set -eo pipefail

if [[ ! -z "${JUPYTER_ENABLE_KERNELGATEWAY}" ]]; then
exec /opt/app-root/bin/start-kernelgateway.sh "$@"
fi

if [ x"$JUPYTER_MASTER_FILES" != x"" ]; then
if [ x"$JUPYTER_WORKSPACE_NAME" != x"" ]; then
JUPYTER_WORKSPACE_PATH=/opt/app-root/src/$JUPYTER_WORKSPACE_NAME
setup-volume.sh $JUPYTER_MASTER_FILES $JUPYTER_WORKSPACE_PATH
fi
fi

JUPYTER_PROGRAM_ARGS="$JUPYTER_PROGRAM_ARGS $NOTEBOOK_ARGS"

JUPYTER_NOTEBOOK_INTERFACE=${JUPYTER_NOTEBOOK_INTERFACE:-classic}

if [ x"$JUPYTER_ENABLE_LAB" = x"" ]; then
if [ x"$JUPYTER_NOTEBOOK_INTERFACE" = x"lab" ]; then
JUPYTER_ENABLE_LAB=true
fi
fi

JUPYTER_ENABLE_LAB=`echo "$JUPYTER_ENABLE_LAB" | tr '[A-Z]' '[a-z]'`

if [[ "$JUPYTER_ENABLE_LAB" =~ ^(true|yes|y|1)$ ]]; then
JUPYTER_PROGRAM_ARGS="$JUPYTER_PROGRAM_ARGS --NotebookApp.default_url=/lab"
else
if [ x"$JUPYTER_WORKSPACE_NAME" != x"" ]; then
JUPYTER_PROGRAM_ARGS="$JUPYTER_PROGRAM_ARGS --NotebookApp.default_url=/tree/$JUPYTER_WORKSPACE_NAME"
fi
fi

if [[ "$JUPYTER_ENABLE_LAB" =~ ^(true|yes|y|1)$ ]]; then
JUPYTER_PROGRAM_ARGS="$JUPYTER_PROGRAM_ARGS --config=/opt/app-root/etc/jupyter_server_config.py"
else
JUPYTER_PROGRAM_ARGS="$JUPYTER_PROGRAM_ARGS --config=/opt/app-root/etc/jupyter_notebook_config.py"
fi

if [[ "$JUPYTER_PROGRAM_ARGS $@" != *"--ip="* ]]; then
JUPYTER_PROGRAM_ARGS="--ip=0.0.0.0 $JUPYTER_PROGRAM_ARGS"
fi

if [[ ! -z "${JUPYTERHUB_API_TOKEN}" ]]; then
if [[ "$JUPYTER_ENABLE_LAB" =~ ^(true|yes|y|1)$ ]]; then
JUPYTER_PROGRAM="jupyter labhub"
else
JUPYTER_PROGRAM="jupyterhub-singleuser"
fi
else
if [[ "$JUPYTER_ENABLE_LAB" =~ ^(true|yes|y|1)$ ]]; then
JUPYTER_PROGRAM="jupyter lab"
else
JUPYTER_PROGRAM="jupyter notebook"
fi
fi

. /opt/app-root/bin/setup-environ.sh

if [ -f /opt/app-root/src/.jupyter/jupyter_notebook_config.sh ]; then
. /opt/app-root/src/.jupyter/jupyter_notebook_config.sh
fi

. /opt/app-root/bin/setup-elyra.sh

exec /opt/app-root/bin/start.sh $JUPYTER_PROGRAM $JUPYTER_PROGRAM_ARGS "$@"

0 comments on commit f811bf1

Please sign in to comment.