-
Notifications
You must be signed in to change notification settings - Fork 404
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
Integration test examples on kubeflow pipelines #667
Changes from 134 commits
f1f7166
cc00030
6f2e032
cfd0434
95335e3
8e8aeac
cb219bd
755fcbc
692e817
865dad2
d1d5828
8c81304
5f65376
6c0439a
68ffd01
12e9468
f802982
9503332
81942bc
7617de3
2b46db8
de04397
dca63a8
de2e26e
64218c0
d71b0b3
ff72214
2eae728
e9788a3
75c3af3
ddfdb84
a004aa3
576f8d1
5a82fce
e382f5b
992b9b7
6f94c81
e3ec03f
e54682f
aaebb44
2831a93
b43124b
73d226f
6da047c
59a1dc1
1db096c
62bcf41
0f952b7
a954b23
6498dfd
c585f1c
a52badf
e47c48e
7159407
3425cc5
2ae279b
1b32b70
e2c472d
af267d0
a44b360
f699392
913a417
17333f8
bcafc60
4a83e70
a8c8876
9b200a9
9f30d7d
ac8cd93
af99671
c68ebaa
9193f82
384c841
d9c4b9a
20a098e
6238526
6b63131
882b11d
441bbef
022e246
cfcbd57
76250a3
8d54f1a
8ed1088
c5e9362
8391e09
9780192
e944ecb
1bf8e1f
fbc1bc7
c0bc2d5
f3e0741
ee877c0
8d35d98
902f41b
f16e179
69e9891
f3239b0
20dab60
a1227c8
de62187
0735c03
60144de
9b06c29
efdce52
a6b5c5b
08f7df9
fbef7c3
62ff8e9
e88c5dd
2cd5a64
9a7e6e3
27cd78b
4c58aba
1993ad4
884543e
6879261
2007d73
4e2ba38
1eac533
a075694
115947b
e617569
d30a91d
1c4ebea
402d2fd
ddfde04
54d6e60
2c39ece
1b6cab4
371288f
b539f89
d271042
38f8b80
a96ce11
25292ef
83b5448
8e73de5
5396d55
af4433e
c329985
5c139a5
8d6332e
034eb91
2ce5dab
6cee5cd
50d9590
34271d8
f12510f
8c5bf66
b75da8c
f3133f0
c4bade1
23bc855
d55f021
9d7601e
56bb89b
577f0b0
4312677
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
name: Test Examples on Remote Infrastructure | ||
|
||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
types: [ opened, synchronize ] | ||
issue_comment: | ||
types: [ created ] | ||
|
||
jobs: | ||
check_comments: | ||
runs-on: ubuntu-latest | ||
if: github.event.issue.pull_request | ||
outputs: | ||
kf_trigger: ${{ steps.check.outputs.triggered }} | ||
steps: | ||
- uses: khan/pull-request-comment-trigger@master | ||
id: check | ||
with: | ||
trigger: 'LTKF!' | ||
reaction: rocket | ||
env: | ||
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}' | ||
- run: 'echo Found LTKF! in the comments!' | ||
if: steps.check.outputs.triggered == 'true' | ||
|
||
kubeflow-tests: | ||
# needs: check_comments | ||
# Run this one automatically if 'LTKF! is in the PR comments | ||
# if: ${{ needs.check_comments.outputs.kf_trigger == 'true' }} | ||
uses: ./.github/workflows/kubeflow.yml | ||
secrets: inherit | ||
|
||
reply-on-pr: | ||
needs: kubeflow-tests | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Message success | ||
if: ${{ success() }} | ||
uses: actions/github-script@v4 | ||
with: | ||
script: | | ||
github.issues.createComment({ | ||
issue_number: context.issue.number, | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
body: 'Kubeflow tests succeeded! ✅', | ||
}); | ||
- name: Message failure | ||
if: ${{ failure() }} | ||
uses: actions/github-script@v4 | ||
with: | ||
script: | | ||
github.issues.createComment({ | ||
issue_number: context.issue.number, | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
body: 'Kubeflow tests failed! ❌', | ||
}); |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -13,6 +13,9 @@ jobs: | |||||
kubeflow_tests: | ||||||
name: kubeflow_tests | ||||||
runs-on: ubuntu-latest | ||||||
permissions: | ||||||
id-token: write | ||||||
contents: read | ||||||
env: | ||||||
ZENML_DEBUG: 1 | ||||||
ZENML_ANALYTICS_OPT_IN: false | ||||||
|
@@ -24,20 +27,29 @@ jobs: | |||||
# Workaround from FuseML (https://github.com/fuseml/fuseml/blob/main/.github/workflows/ci.yml) | ||||||
# as the TF images are too large for the GH action runner disk | ||||||
- name: Free disk space | ||||||
shell: bash | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Any reason that the android removal was deleted below? |
||||||
run: | | ||||||
echo "Available storage:" | ||||||
df -h | ||||||
echo | ||||||
echo -n " Removing: .NET (frees ~22GB)" | ||||||
sudo rm -rf /usr/share/dotnet | ||||||
echo "... done" | ||||||
echo -n " Removing: Android" | ||||||
sudo rm -rf /usr/local/lib/android | ||||||
echo "... done" | ||||||
echo | ||||||
echo "Available storage:" | ||||||
df -h | ||||||
|
||||||
- name: Install Linux System Dependencies | ||||||
if: runner.os=='Linux' | ||||||
run: sudo apt install graphviz | ||||||
|
||||||
- name: Configure AWS Credentials | ||||||
uses: aws-actions/configure-aws-credentials@v1 | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just out of curiosity, how can this work without using any secrets to authenticate? Or are those secret keys hardcoded somewhere and just not visible in this yaml file? |
||||||
with: | ||||||
role-to-assume: arn:aws:iam::715803424590:role/limited_kubeflow_sandbox_tests_role | ||||||
role-session-name: Kubeflow_Test_Session | ||||||
aws-region: us-east-1 | ||||||
|
||||||
- name: Setup environment with Poetry | ||||||
uses: ./.github/actions/setup_environment | ||||||
with: | ||||||
|
@@ -50,21 +62,33 @@ jobs: | |||||
sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl | ||||||
source $VENV | ||||||
zenml integration install kubeflow -y | ||||||
pip install notebook==6.4.11 | ||||||
|
||||||
- name: Install Linux System Dependencies | ||||||
if: runner.os=='Linux' | ||||||
run: sudo apt install graphviz | ||||||
- name: Perform docker login and get Kubecontext | ||||||
run: bash scripts/setup_kubeflow_aws_connection.sh | ||||||
|
||||||
- name: Build docker image | ||||||
# this step can be much faster if we use an image that copies the | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm guessing the current image now uses the lock file, can we remove the comment? |
||||||
# lockfile that was generated in the previous step | ||||||
run: docker build -t zenml-base-image:latest -f docker/base-dev.Dockerfile . | ||||||
run: docker build -t test-base-image:latest -f docker/base-test.Dockerfile . | ||||||
|
||||||
- name: Install Prerequisites | ||||||
run: | | ||||||
source $VENV | ||||||
zenml integration install s3 kubeflow \ | ||||||
evidently facets huggingface mlflow tensorflow sklearn xgboost lightgbm slack neural_prophet -f | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
||||||
- name: Setup tmate session | ||||||
if: ${{ github.event.inputs.tags }} | ||||||
uses: mxschmitt/action-tmate@v3 | ||||||
|
||||||
- name: Run tests | ||||||
env: | ||||||
TEST_MLFLOW_TRACKING_URI: https://ac8e6c63af207436194ab675ee71d85a-1399000870.us-east-1.elb.amazonaws.com | ||||||
TEST_MLFLOW_TRACKING_USERNAME: ${{ secrets.TEST_MLFLOW_TRACKING_USERNAME }} | ||||||
TEST_MLFLOW_TRACKING_PASSWORD: ${{ secrets.TEST_MLFLOW_TRACKING_PASSWORD }} | ||||||
TEST_SLACK_TOKEN: ${{ secrets.TEST_SLACK_TOKEN }} | ||||||
TEST_SLACK_CHANNEL_ID: ${{ secrets.TEST_SLACK_CHANNEL_ID }} | ||||||
run: | | ||||||
source $VENV | ||||||
pytest tests/integration/test_examples.py -s --on-kubeflow --use-virtualenv |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
FROM ubuntu:20.04 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does this image install anything in addition to the "default" one we have? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Actually I am not sure myself, didn't have an in-depth look at this |
||
|
||
WORKDIR /zenml | ||
|
||
# python | ||
ENV PYTHONFAULTHANDLER=1 \ | ||
PYTHONUNBUFFERED=1 \ | ||
PYTHONHASHSEED=random \ | ||
PIP_NO_CACHE_DIR=off \ | ||
PIP_DISABLE_PIP_VERSION_CHECK=on \ | ||
POETRY_HOME=/root/.local | ||
|
||
RUN apt-get update && \ | ||
apt-get install --no-install-recommends -q -y \ | ||
build-essential \ | ||
ca-certificates \ | ||
libsnappy-dev \ | ||
protobuf-compiler \ | ||
libprotobuf-dev \ | ||
python3 \ | ||
python3-dev \ | ||
python-is-python3 \ | ||
python3-venv \ | ||
python3-pip \ | ||
curl \ | ||
unzip \ | ||
git && \ | ||
apt-get autoclean && \ | ||
apt-get autoremove --purge | ||
|
||
RUN curl -sSL https://install.python-poetry.org | python | ||
|
||
# copy project requirement files here to ensure they will be cached. If poetry.lock file is present it is also copied. | ||
COPY pyproject.toml poetry.loc[k] /zenml/ | ||
|
||
ENV ZENML_DEBUG=true | ||
ENV ZENML_ANALYTICS_OPT_IN=false | ||
ENV VIRTUAL_ENV=/opt/venv | ||
ENV PATH="$VIRTUAL_ENV/bin:$POETRY_HOME/bin:$PATH" | ||
RUN python -m venv $VIRTUAL_ENV | ||
|
||
RUN pip install --no-cache-dir --upgrade --pre pip | ||
|
||
# install dependencies but don't install zenml yet | ||
# this improves caching as the dependencies don't have to be reinstalled everytime a src file changes | ||
RUN poetry install --no-root | ||
|
||
COPY . /zenml | ||
|
||
# install zenml | ||
RUN poetry update && poetry install |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Copyright (c) ZenML GmbH 2022. All Rights Reserved. | ||
# | ||
# 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: | ||
# | ||
# https://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. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Copyright (c) ZenML GmbH 2022. All Rights Reserved. | ||
# | ||
# 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: | ||
# | ||
# https://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. | ||
import numpy as np | ||
import tensorflow as tf | ||
|
||
from zenml.steps import Output, step | ||
|
||
|
||
@step | ||
def importer_mnist() -> Output( | ||
x_train=np.ndarray, y_train=np.ndarray, x_test=np.ndarray, y_test=np.ndarray | ||
): | ||
"""Download the MNIST data store it as an artifact""" | ||
(x_train, y_train), ( | ||
x_test, | ||
y_test, | ||
) = tf.keras.datasets.mnist.load_data() | ||
return x_train, y_train, x_test, y_test |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Copyright (c) ZenML GmbH 2022. All Rights Reserved. | ||
# | ||
# 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: | ||
# | ||
# https://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. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Copyright (c) ZenML GmbH 2020. All Rights Reserved. | ||
# | ||
# 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: | ||
# | ||
# https://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 zenml.integrations.constants import SKLEARN | ||
from zenml.pipelines import pipeline | ||
|
||
|
||
@pipeline(required_integrations=[SKLEARN]) | ||
def scipy_example_pipeline(importer, vectorizer, trainer, predictor): | ||
X_train, X_test, y_train, y_test = importer() | ||
vec_transformer, X_train_vec, X_test_vec = vectorizer(X_train, X_test) | ||
model = trainer(X_train_vec, y_train) | ||
predictor(vec_transformer, model, X_test) |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,7 @@ | |
# 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 .loader.loader_step import importer | ||
from .importer.importer_step import importer | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Any reason this is using relative imports now compared to the other examples? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was under the impression that most (if not all examples) use relative imports here, at least coudln't find one that doesn't There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You're completely right, I was somehow under the impression that we always used absolute imports. I just checked and it seems like
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if we want to do this uniformly I would capture it in a separate ticket if thats ok with you There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sounds good |
||
from .predictor.predictor_step import predictor | ||
from .trainer.trainer_step import trainer | ||
from .vectorizer.vectorizer_step import vectorizer | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Copyright (c) ZenML GmbH 2022. All Rights Reserved. | ||
# | ||
# 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: | ||
# | ||
# https://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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we make this test run only once by removing these triggers here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, once everything else works well together