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

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

on:
push: {}
pull_request: {}
workflow_dispatch: {}

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

jobs:
e2e:
runs-on: ubuntu-latest
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"
papermill-args-yaml: "namespace: kubeflow"
63 changes: 63 additions & 0 deletions .github/workflows/template-e2e-notebook-test/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Notebook test template
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
papermill-args-yaml:
description: 'Additional arguments to pass to Papermill in yaml format'
required: false
default: ""
Comment on lines +12 to +15
Copy link
Member

Choose a reason for hiding this comment

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

It seems that we didn't pass parameters to these two notebook examples. Not sure if it meets our requirements

cc👀 @andreyvelich @tenzen-y @yehudit1987


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
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.27.3
minikube-version: 1.31.1
start-args: --wait-timeout=120s

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

- 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 }}"
# Loop through each notebook path
for NOTEBOOK in "${NOTEBOOK_ARRAY[@]}"; do
OUTPUT_FILE="${NOTEBOOK%.ipynb}_output.ipynb"
echo "Running notebook: $NOTEBOOK"
papermill "$NOTEBOOK" "$OUTPUT_FILE" --parameters_yaml "${{ inputs.papermill-args-yaml }}" --log-output --kernel python3 || {
echo "Papermill failed for notebook: $NOTEBOOK"
exit 1
}
done
Original file line number Diff line number Diff line change
Expand Up @@ -671,4 +671,4 @@
},
"nbformat": 4,
"nbformat_minor": 4
}
}
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
}
}

Loading