From 763db16fb833502870deadc9591c0874d203a59d Mon Sep 17 00:00:00 2001 From: Nikolaos Loukas Date: Wed, 13 Jul 2022 20:52:32 +0300 Subject: [PATCH 1/2] Extend Katib GH action to also create an experiment and assert it succeeds. (#2248) --- .github/workflows/katib_kind_test.yaml | 6 ++ tests/gh-actions/katib_test.yaml | 78 ++++++++++++++++++++++++++ 2 files changed, 84 insertions(+) create mode 100644 tests/gh-actions/katib_test.yaml diff --git a/.github/workflows/katib_kind_test.yaml b/.github/workflows/katib_kind_test.yaml index 6ceabc7771..c10943c55f 100644 --- a/.github/workflows/katib_kind_test.yaml +++ b/.github/workflows/katib_kind_test.yaml @@ -32,3 +32,9 @@ jobs: kubectl create ns kubeflow kustomize build installs/katib-with-kubeflow | kubectl apply -f - kubectl wait --for=condition=Ready pods --all --all-namespaces --timeout 180s + + - name: Create katib experiment + run: | + kubectl apply -f tests/gh-actions/katib_test.yaml + kubectl wait --for=condition=Succeeded trials.kubeflow.org -n kubeflow-user --all --timeout 300s + kubectl wait --for=condition=Succeeded experiments.kubeflow.org -n kubeflow-user --all --timeout 300s diff --git a/tests/gh-actions/katib_test.yaml b/tests/gh-actions/katib_test.yaml new file mode 100644 index 0000000000..5d0c4a97d7 --- /dev/null +++ b/tests/gh-actions/katib_test.yaml @@ -0,0 +1,78 @@ +--- +apiVersion: kubeflow.org/v1beta1 +kind: Experiment +metadata: + name: grid-example + namespace: kubeflow-user +spec: + parameters: + - name: lr + parameterType: double + feasibleSpace: + max: '0.01' + min: '0.001' + step: '0.001' + - name: num-layers + parameterType: int + feasibleSpace: + max: '3' + min: '2' + - name: optimizer + parameterType: categorical + feasibleSpace: + list: + - adam + objective: + type: maximize + goal: 0.80 + objectiveMetricName: Validation-accuracy + additionalMetricNames: + - Train-accuracy + metricStrategies: + - name: Validation-accuracy + value: max + - name: Train-accuracy + value: max + algorithm: + algorithmName: grid + trialTemplate: + trialSpec: + apiVersion: batch/v1 + kind: Job + spec: + template: + metadata: + labels: + sidecar.istio.io/inject: 'false' + spec: + containers: + - command: + - python3 + - /opt/mxnet-mnist/mnist.py + - '--batch-size=64' + - '--lr=${trialParameters.learningRate}' + - '--num-layers=${trialParameters.numberLayers}' + - '--optimizer=${trialParameters.optimizer}' + image: docker.io/kubeflowkatib/mxnet-mnist:latest + name: training-container + restartPolicy: Never + trialParameters: + - name: learningRate + description: Learning rate for the training model + reference: lr + - name: numberLayers + description: Number of training model layers + reference: num-layers + - name: optimizer + description: Training model optimizer (sdg, adam or ftrl) + reference: optimizer + primaryContainerName: training-container + successCondition: status.conditions.#(type=="Complete")#|#(status=="True")# + failureCondition: status.conditions.#(type=="Failed")#|#(status=="True")# + parallelTrialCount: 1 + maxTrialCount: 1 + maxFailedTrialCount: 1 + metricsCollectorSpec: + collector: + kind: StdOut + resumePolicy: LongRunning \ No newline at end of file From 4226333cca278941458111f6d411278990e28257 Mon Sep 17 00:00:00 2001 From: Nikolaos Loukas Date: Thu, 14 Jul 2022 18:19:01 +0300 Subject: [PATCH 2/2] Rearrange folders for KF objects in tests. --- tests/gh-actions/{ => kf-objects}/katib_test.yaml | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename tests/gh-actions/{ => kf-objects}/katib_test.yaml (100%) diff --git a/tests/gh-actions/katib_test.yaml b/tests/gh-actions/kf-objects/katib_test.yaml similarity index 100% rename from tests/gh-actions/katib_test.yaml rename to tests/gh-actions/kf-objects/katib_test.yaml