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

feat(components): Add v1beta1 Katib launcher and samples #4798

Merged
merged 12 commits into from
Dec 15, 2020
18 changes: 9 additions & 9 deletions components/kubeflow/katib-launcher/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
# Copyright 2019 The Kubeflow Authors
# Copyright 2020 kubeflow.org.
#
# Licensed 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
# 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 ubuntu:16.04

RUN apt-get update -y && \
apt-get install --no-install-recommends -y -q ca-certificates python-dev python-setuptools wget && \
easy_install pip && \
pip install pyyaml==3.12 kubernetes
FROM python:3.6

ADD build /ml
ENV APP_HOME /app
WORKDIR ${APP_HOME}

ENTRYPOINT ["python", "/ml/launch_experiment.py"]
ADD . ${APP_HOME}
RUN pip install --no-cache-dir -r requirements.txt

ENTRYPOINT ["python", "src/launch_experiment.py"]
5 changes: 3 additions & 2 deletions components/kubeflow/katib-launcher/OWNERS
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
approvers:
- andreyvelich
- gaocegege
- hougangliu
reviewers:
- hougangliu
- johnugeorge
46 changes: 6 additions & 40 deletions components/kubeflow/katib-launcher/build_image.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash -e
# Copyright 2019 Google LLC
# Copyright 2020 kubeflow.org.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps,

# Copyright 2020 The Kubeflow Authors

or

# Copyright 2020 Kubeflow contributors

#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -13,44 +13,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.

while getopts ":hp:t:i:" opt; do
case "${opt}" in
h) echo "-p: project name"
echo "-t: tag name"
echo "-i: image name. If provided, project name and tag name are not necessary"
exit
;;
p) PROJECT_ID=${OPTARG}
;;
t) TAG_NAME=${OPTARG}
;;
i) LAUNCHER_IMAGE_NAME=${OPTARG}
;;
\? ) echo "Usage: cmd [-p] project [-t] tag [-i] image"
exit
;;
esac
done
IMAGE="docker.io/kubeflowkatib/kubeflow-pipelines-launcher"

mkdir -p ./build
rsync -arvp ./src/ ./build/
rsync -arvp ../common/ ./build/
echo "Releasing image for the Katib Pipeline Launcher..."
echo -e "Image: ${IMAGE}\n"

LOCAL_LAUNCHER_IMAGE_NAME=ml-pipeline-kubeflow-experiment

docker build -t ${LOCAL_LAUNCHER_IMAGE_NAME} .
if [ -z "${TAG_NAME}" ]; then
TAG_NAME=$(date +v%Y%m%d)-$(git describe --tags --always --dirty)-$(git diff | shasum -a256 | cut -c -6)
fi
if [ -z "${LAUNCHER_IMAGE_NAME}" ]; then
if [ -z "${PROJECT_ID}" ]; then
PROJECT_ID=$(gcloud config config-helper --format "value(configuration.properties.core.project)")
fi
docker tag ${LOCAL_LAUNCHER_IMAGE_NAME} gcr.io/${PROJECT_ID}/${LOCAL_LAUNCHER_IMAGE_NAME}:${TAG_NAME}
docker push gcr.io/${PROJECT_ID}/${LOCAL_LAUNCHER_IMAGE_NAME}:${TAG_NAME}
else
docker tag ${LOCAL_LAUNCHER_IMAGE_NAME} ${LAUNCHER_IMAGE_NAME}:${TAG_NAME}
docker push ${LAUNCHER_IMAGE_NAME}:${TAG_NAME}
fi

rm -rf ./build
docker build . -f Dockerfile -t ${IMAGE}
docker push ${IMAGE}
48 changes: 16 additions & 32 deletions components/kubeflow/katib-launcher/component.yaml
Original file line number Diff line number Diff line change
@@ -1,38 +1,22 @@
name: Kubeflow - Launch Experiment
description: Kubeflow Experiment launcher
name: Katib - Launch Experiment
description: Katib Experiment launcher
inputs:
- {name: Experiment Name, type: String, description: 'Experiment name.'}
- {name: Experiment Namespace, type: String, default: kubeflow, description: 'Experiment namespace.'}
- {name: Experiment Version, type: String, default: v1alpha3, description: 'Experiment version.'}
- {name: Max Trial Count, type: Integer, description: 'How many trials can be executed at most.'}
- {name: Max Failed Trial Count, type: Integer, default: 3, description: 'How many trials can fail at most.'}
- {name: Parallel Trial Count, type: Integer, default: 3, description: 'How many trials can be running in parallel at most.'}
- {name: Objective, type: JSON, description: 'Experiment objective.'}
- {name: Algorithm, type: JSON, description: 'Experiment algorithm.'}
- {name: Trial Template, type: JSON, description: 'Experiment trialTemplate.'}
- {name: Parameters, type: JSON, description: 'Experiment Parameter configuration.'}
- {name: Metrics Collector, type: JSON, default: '{}', description: 'Experiment metricsCollector.'}
- {name: Experiment Timeout Minutes, type: Integer, default: 1440, description: 'Time in minutes to wait for the Experiment to complete.'}
- {name: Delete Finished Experiment, type: Bool, default: 'True', description: 'Whether to delete the experiment after it is finished.'}
- {name: Experiment Name, type: String, default: '', description: 'Experiment name'}
- {name: Experiment Namespace, type: String, default: anonymous, description: 'Experiment namespace'}
- {name: Experiment Spec, type: JsonObject, default: '{}', description: 'Experiment specification in dict format'}
- {name: Experiment Timeout Minutes, type: Integer, default: 1440, description: 'Time in minutes to wait for the Experiment to complete'}
- {name: Delete Finished Experiment, type: Bool, default: 'True', description: 'Whether to delete the Experiment after it is finished'}
outputs:
- {name: Best Parameter Set, type: JSON, description: 'The parameter set of the best Experiment trial.'}
- {name: Best Parameter Set, type: JSON, description: 'The hyperparameter set of the best Experiment Trial'}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

JsonObject maybe?

implementation:
container:
image: liuhougangxa/katib-experiment-launcher:latest
command: [python, /ml/launch_experiment.py]
image: docker.io/kubeflowkatib/kubeflow-pipelines-launcher
command: [python, src/launch_experiment.py]
args: [
--name, {inputValue: Experiment Name},
--namespace, {inputValue: Experiment Namespace},
--version, {inputValue: Experiment Version},
--maxTrialCount, {inputValue: Max Trial Count},
--maxFailedTrialCount, {inputValue: Max Failed Trial Count},
--parallelTrialCount, {inputValue: Parallel Trial Count},
--objectiveConfig, {inputValue: Objective},
--algorithmConfig, {inputValue: Algorithm},
--trialTemplate, {inputValue: Trial Template},
--parameters, {inputValue: Parameters},
--metricsCollector, {inputValue: Metrics Collector},
--experimentTimeoutMinutes, {inputValue: Experiment Timeout Minutes},
--deleteAfterDone, {inputValue: Delete Finished Experiment},
--outputFile, {outputPath: Best Parameter Set},
--experiment-name, {inputValue: Experiment Name},
--experiment-namespace, {inputValue: Experiment Namespace},
--experiment-spec, {inputValue: Experiment Spec},
--experiment-timeout-minutes, {inputValue: Experiment Timeout Minutes},
--delete-after-done, {inputValue: Delete Finished Experiment},
--output-file, {outputPath: Best Parameter Set},
]
2 changes: 2 additions & 0 deletions components/kubeflow/katib-launcher/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
kubernetes==10.0.1
kubeflow-katib==0.10.1
114 changes: 0 additions & 114 deletions components/kubeflow/katib-launcher/sample.py

This file was deleted.

80 changes: 0 additions & 80 deletions components/kubeflow/katib-launcher/sample2.py

This file was deleted.

2 changes: 1 addition & 1 deletion components/kubeflow/katib-launcher/src/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2019 Google LLC
# Copyright 2020 kubeflow.org.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
Loading