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

Sdk tests with papermill #2448

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
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
28 changes: 28 additions & 0 deletions .github/workflows/sdk-e2e-tests-with-papermill.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: E2E Tests with Notebooks
Copy link
Member

Choose a reason for hiding this comment

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

Let's call this file:

e2e-test-notebooks.yaml


on:
push: {}
pull_request: {}
workflow_dispatch: {}
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
on:
push: {}
pull_request: {}
workflow_dispatch: {}
on:
- pull_request


concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
e2e:
runs-on: ubuntu-22.04
timeout-minutes: 30
strategy:
fail-fast: true
matrix:
python-version: ["3.9", "3.10", "3.11"]
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Test Notebook
uses: ./.github/workflows/template-e2e-notebook-test
with:
python-version: ${{ matrix.python-version }}
notebook-input: "examples/v1beta1/sdk/cmaes-and-resume-policies.ipynb,examples/v1beta1/sdk/tune-train-from-func.ipynb"
54 changes: 54 additions & 0 deletions .github/workflows/template-e2e-notebook-test/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Notebook test template
Copy link
Member

Choose a reason for hiding this comment

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

You don't need template if we keep all Notebooks test jobs in the single file.

description: A composite action to setup and run example notebooks using Papermill

inputs:
python-version:
required: false
description: Python version
default: "3.9"
notebook-input:
description: 'List of paths to the input notebooks, separated by commas'
required: true

runs:
using: composite
steps:

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ inputs.python-version }}

- name: Install dependencies
shell: bash
run: |
python -m pip install --upgrade pip
pip install papermill kubeflow-katib jupyter ipykernel
Copy link
Member

Choose a reason for hiding this comment

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

kubeflow-katib SDK should be installed from source.

Copy link
Author

Choose a reason for hiding this comment

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

Hey @andreyvelich, thanks for the review!
Great points, I’ve fixed them. Let me know if anything else is needed.

python -m ipykernel install --user --name python3 --display-name "Python 3"

- name: Setup Minikube Cluster
uses: medyagh/[email protected]
with:
network-plugin: cni
cni: flannel
driver: none
kubernetes-version: v1.29.2
minikube-version: 1.34.0
start-args: --wait-timeout=120s
Copy link
Member

Choose a reason for hiding this comment

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

You can re-use setup-e2e-test template for that, similar to this:

- name: Setup Test Env
uses: ./.github/workflows/template-setup-e2e-test
with:
kubernetes-version: ${{ matrix.kubernetes-version }}
python-version: "3.10"


- name: Setup Minikube
shell: bash
run: ./test/e2e/v1beta1/scripts/gh-actions/setup-minikube.sh true true "" "" "cmaes"
Copy link
Member

Choose a reason for hiding this comment

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

Can we re-use this template for this action, but passing the appropriate values to it:
https://github.com/kubeflow/katib/blob/683608f6a61e7b10218b7084f310af42334d8e65/.github/workflows/template-e2e-test/action.yaml
We can have one more input for notebooks tests that triggers run-notebook.sh.


- name: Setup Katib
shell: bash
run: ./test/e2e/v1beta1/scripts/gh-actions/setup-katib.sh true true postgres

- name: Run Jupyter Notebook with Papermill
shell: bash
run: |
IFS=',' read -r -a NOTEBOOK_ARRAY <<< "${{ inputs.notebook-input }}"
for NOTEBOOK in "${NOTEBOOK_ARRAY[@]}"; do
echo "Running notebook: $NOTEBOOK"
./test/e2e/v1beta1/scripts/gh-actions/run-notebook.sh -i "$NOTEBOOK" -n kubeflow
done
Loading
Loading