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

Integration test examples on kubeflow pipelines #667

Closed
wants to merge 159 commits into from
Closed
Show file tree
Hide file tree
Changes from 134 commits
Commits
Show all changes
159 commits
Select commit Hold shift + click to select a range
f1f7166
Make LTKF work again
AlexejPenner May 30, 2022
cc00030
Skip LTKF trigger as it only works once on main
AlexejPenner May 30, 2022
6f2e032
Add synchronize pr as trigger
AlexejPenner May 30, 2022
cfd0434
Renamed new gh action workflow
AlexejPenner May 30, 2022
95335e3
Removed conditional kubeflow yml call
AlexejPenner May 30, 2022
8e8aeac
Experimental changes to the kubeflow.yml
AlexejPenner Jun 1, 2022
cb219bd
Best Practicify examples and move pipeline run into core code to make…
AlexejPenner Jun 1, 2022
755fcbc
Updated Wandb
AlexejPenner Jun 1, 2022
692e817
Updated scipy example
AlexejPenner Jun 1, 2022
865dad2
Added three more refactored examples
AlexejPenner Jun 1, 2022
d1d5828
Refactored lightgbm
AlexejPenner Jun 1, 2022
8c81304
refactored neural_prophet
AlexejPenner Jun 1, 2022
5f65376
Updated add_your_own
AlexejPenner Jun 1, 2022
6c0439a
Merge branch 'develop' into feature/ENG-939-make-examples-conform-to-bp
AlexejPenner Jun 1, 2022
68ffd01
Merge branch 'feature/ENG-939-make-examples-conform-to-bp' into featu…
AlexejPenner Jun 1, 2022
12e9468
First working local tests
AlexejPenner Jun 1, 2022
f802982
Linted and formatted
AlexejPenner Jun 1, 2022
9503332
Test running locally for xgboost, let's see how it works on gh action
AlexejPenner Jun 2, 2022
81942bc
Fixed mistake in kubeflow.yaml
AlexejPenner Jun 2, 2022
7617de3
Merge branch 'develop' into feature/ENG-939-LTKF
AlexejPenner Jun 2, 2022
2b46db8
Fixed wrong secret name
AlexejPenner Jun 2, 2022
de04397
Merge branch 'feature/ENG-939-LTKF' of github.com:zenml-io/zenml into…
AlexejPenner Jun 2, 2022
dca63a8
Install prerequisits
AlexejPenner Jun 2, 2022
de2e26e
Corrected step amount for scipy and added required integration installs
AlexejPenner Jun 2, 2022
64218c0
First two tests shall pass
AlexejPenner Jun 2, 2022
d71b0b3
Merge branch 'develop' into feature/ENG-939-make-examples-conform-to-bp
AlexejPenner Jun 2, 2022
ff72214
Removed examples folder in src and fixed docstring and linting issue
AlexejPenner Jun 2, 2022
2eae728
Merge remote-tracking branch 'origin/develop' into feature/ENG-939-ma…
strickvl Jun 3, 2022
e9788a3
Make `zenml pipeline run ... -c ...` work for non local orchestrators
AlexejPenner Jun 3, 2022
75c3af3
Added error about running outside zenml repo, init repo in tests
AlexejPenner Jun 3, 2022
ddfdb84
Added setup for kube context and docker login
AlexejPenner Jun 3, 2022
a004aa3
Using correct docker login
AlexejPenner Jun 3, 2022
576f8d1
update quickstart example
strickvl Jun 7, 2022
5a82fce
Merge remote-tracking branch 'origin/develop' into feature/ENG-939-ma…
strickvl Jun 7, 2022
e382f5b
Using OIDC for the sandbox role
AlexejPenner Jun 7, 2022
992b9b7
Using OIDC for the sandbox role with permissions defined
AlexejPenner Jun 7, 2022
6f94c81
Reordered workflow yml
AlexejPenner Jun 7, 2022
e3ec03f
More reordering
AlexejPenner Jun 7, 2022
e54682f
Using different sandbox role
AlexejPenner Jun 7, 2022
aaebb44
Switched to limited role
AlexejPenner Jun 7, 2022
2831a93
Update kubeflow.yml
AlexejPenner Jun 7, 2022
b43124b
Using base-test.Dockerfile to speed up testing, and install requirements
AlexejPenner Jun 7, 2022
73d226f
Merge branch 'develop' into feature/ENG-939-LTKF
AlexejPenner Jun 7, 2022
6da047c
Merge branch 'feature/ENG-939-LTKF' of github.com:zenml-io/zenml into…
AlexejPenner Jun 7, 2022
59a1dc1
Added test dockerfile
AlexejPenner Jun 7, 2022
1db096c
Use tmate session to debug failing kfp client
AlexejPenner Jun 7, 2022
62bcf41
Retry without tmate
AlexejPenner Jun 7, 2022
0f952b7
evidently example: move steps to correct files.
fa9r Jun 8, 2022
a954b23
Adjust slack_alert example to best practices.
fa9r Jun 8, 2022
6498dfd
Merge remote-tracking branch 'origin/develop' into feature/ENG-939-LTKF
AlexejPenner Jun 14, 2022
c585f1c
This might work, but in slooooooooooooooooowmo
AlexejPenner Jun 14, 2022
a52badf
Merge remote-tracking branch 'origin/develop' into feature/ENG-939-ma…
AlexejPenner Jun 14, 2022
e47c48e
Refactored step operator and vertex ai examples
AlexejPenner Jun 14, 2022
7159407
Merge branch 'feature/ENG-939-make-examples-conform-to-bp' of github.…
AlexejPenner Jun 14, 2022
3425cc5
Upgraded xgboost example to have shorter import paths
AlexejPenner Jun 14, 2022
2ae279b
Refactored whylogs and scipy
AlexejPenner Jun 14, 2022
1b32b70
Reformatted and linted
AlexejPenner Jun 14, 2022
e2c472d
Merge branch 'feature/ENG-939-make-examples-conform-to-bp' into featu…
AlexejPenner Jun 14, 2022
af267d0
Readded second example to test
AlexejPenner Jun 14, 2022
a44b360
Fixed linting issues
AlexejPenner Jun 14, 2022
f699392
Reformated
AlexejPenner Jun 15, 2022
913a417
Merge branch 'develop' into feature/ENG-939-make-examples-conform-to-bp
strickvl Jun 15, 2022
17333f8
Refactored scipy and xgboost
AlexejPenner Jun 15, 2022
bcafc60
Added neural prophet
AlexejPenner Jun 15, 2022
4a83e70
finish refactoring of feast example and fix broken integration
strickvl Jun 15, 2022
a8c8876
Full paths for all steps
AlexejPenner Jun 15, 2022
9b200a9
Reordered alphabetically
AlexejPenner Jun 15, 2022
9f30d7d
Only test sciüy
AlexejPenner Jun 15, 2022
ac8cd93
Avoid weird jupyter notebook error
AlexejPenner Jun 15, 2022
af99671
4 Examples tested
AlexejPenner Jun 15, 2022
c68ebaa
commented out slack import
AlexejPenner Jun 15, 2022
9193f82
Hopefully the tests work now
AlexejPenner Jun 15, 2022
384c841
refactor mlflow deployment example
safoinme Jun 16, 2022
d9c4b9a
refactor seldon deployment example
safoinme Jun 16, 2022
20a098e
Refactor pytorch example.
fa9r Jun 17, 2022
6238526
Refactor kubeflow example.
fa9r Jun 17, 2022
6b63131
Refactor airflow example.
fa9r Jun 17, 2022
882b11d
Make mlflow testable
AlexejPenner Jun 17, 2022
441bbef
Reformatted
AlexejPenner Jun 17, 2022
022e246
Added tensorflow install
AlexejPenner Jun 17, 2022
cfcbd57
Prepare secrets as env vars and change kubeflow timeout
AlexejPenner Jun 17, 2022
76250a3
Using GH Secrets
AlexejPenner Jun 17, 2022
8d54f1a
Added slack integration install
AlexejPenner Jun 17, 2022
8ed1088
Initial refactor huggingface
AlexejPenner Jun 17, 2022
c5e9362
Not working state
AlexejPenner Jun 17, 2022
8391e09
Load secrets
AlexejPenner Jun 17, 2022
9780192
Secret missing https
AlexejPenner Jun 17, 2022
e944ecb
Merge branch 'develop' into feature/ENG-939-make-examples-conform-to-bp
strickvl Jun 20, 2022
1bf8e1f
Refactored huggingface, stole changes from ENG-939-LTKF branch for ne…
AlexejPenner Jun 20, 2022
fbc1bc7
Merge branch 'feature/ENG-939-make-examples-conform-to-bp' of github.…
AlexejPenner Jun 20, 2022
c0bc2d5
Merge branch 'develop' into feature/ENG-939-make-examples-conform-to-bp
strickvl Jun 21, 2022
f3e0741
finalize seldon and mlflow deployment examples
safoinme Jun 21, 2022
ee877c0
Merge branch 'develop' into feature/ENG-939-make-examples-conform-to-bp
strickvl Jun 22, 2022
8d35d98
update ignored spellings
strickvl Jun 22, 2022
902f41b
Made tests work
AlexejPenner Jun 22, 2022
f16e179
Merge branch 'develop' into feature/ENG-939-make-examples-conform-to-bp
AlexejPenner Jun 22, 2022
69e9891
Post-merge woes
AlexejPenner Jun 22, 2022
f3239b0
Slack alerter slacks no more
AlexejPenner Jun 22, 2022
20dab60
fixing the formatting
bcdurak Jun 24, 2022
a1227c8
Merge branch 'develop' into feature/ENG-939-make-examples-conform-to-bp
AlexejPenner Jun 27, 2022
de62187
Reverted Airflow
AlexejPenner Jun 27, 2022
0735c03
Merge branch 'feature/ENG-939-make-examples-conform-to-bp' of github.…
AlexejPenner Jun 27, 2022
60144de
Removed facets example for now
AlexejPenner Jun 27, 2022
9b06c29
Merge remote-tracking branch 'origin/develop' into feature/ENG-939-ma…
AlexejPenner Jun 28, 2022
efdce52
Reverted airflow example to non bp, as the imports don't work with ai…
AlexejPenner Jun 29, 2022
a6b5c5b
Added instructions to run with config.yaml
AlexejPenner Jun 29, 2022
08f7df9
Fixed possible mistake in evidently example
AlexejPenner Jun 29, 2022
fbef7c3
Added info regarding the zenml pipeline run to the READMEs
AlexejPenner Jun 30, 2022
62ff8e9
Merge branch 'feature/ENG-939-make-examples-conform-to-bp' into featu…
AlexejPenner Jun 30, 2022
e88c5dd
Try testing mlflow
AlexejPenner Jun 30, 2022
2cd5a64
Added more simple examples
AlexejPenner Jun 30, 2022
9a7e6e3
Test only slack
AlexejPenner Jun 30, 2022
27cd78b
Made config yamls work again for slack alerter
AlexejPenner Jun 30, 2022
4c58aba
Implemented changes from PR
AlexejPenner Jun 30, 2022
1993ad4
Merge branch 'feature/ENG-939-make-examples-conform-to-bp' into featu…
AlexejPenner Jun 30, 2022
884543e
Test 5 examples
AlexejPenner Jun 30, 2022
6879261
Added two more tests
AlexejPenner Jun 30, 2022
2007d73
Added huggingface example
AlexejPenner Jun 30, 2022
4e2ba38
Doing huggingface correctly, try, finally to stop cascading fails
AlexejPenner Jun 30, 2022
1eac533
Added neural_prophet
AlexejPenner Jun 30, 2022
a075694
Clear space
AlexejPenner Jun 30, 2022
115947b
Skip Huggingface
AlexejPenner Jul 1, 2022
e617569
Always remove space
AlexejPenner Jul 1, 2022
d30a91d
Merge branch 'develop' into feature/ENG-939-LTKF
AlexejPenner Jul 8, 2022
1c4ebea
Merge missed one file
AlexejPenner Jul 8, 2022
402d2fd
Remove more files
AlexejPenner Jul 8, 2022
ddfde04
Try cleaning up after each test
AlexejPenner Jul 12, 2022
54d6e60
Runs tests to analyze memory issues
AlexejPenner Jul 12, 2022
2c39ece
Commented out docker prune
AlexejPenner Jul 12, 2022
1b6cab4
Testing some more to verfy the failed cleanup
AlexejPenner Jul 12, 2022
371288f
Cleanup of virtualenv
AlexejPenner Jul 12, 2022
b539f89
Stop failing on exception catches
AlexejPenner Jul 12, 2022
d271042
Tentative test everything
AlexejPenner Jul 12, 2022
38f8b80
Merge branch 'develop' into feature/ENG-939-LTKF
AlexejPenner Jul 14, 2022
a96ce11
Reenabled validations
AlexejPenner Jul 22, 2022
25292ef
Merge branch 'develop' into feature/ENG-939-LTKF
AlexejPenner Jul 22, 2022
83b5448
Post-merge voes
AlexejPenner Jul 22, 2022
8e73de5
Reformatted
AlexejPenner Jul 22, 2022
5396d55
Update tests/integration/test_examples.py
AlexejPenner Jul 25, 2022
af4433e
Update tests/integration/test_examples.py
AlexejPenner Jul 25, 2022
c329985
Removed old commented out code
AlexejPenner Jul 25, 2022
5c139a5
Merge branch 'feature/ENG-939-LTKF' of github.com:zenml-io/zenml into…
AlexejPenner Jul 25, 2022
8d6332e
Make integration tests work again
AlexejPenner Jul 26, 2022
034eb91
Added more examples
AlexejPenner Jul 26, 2022
2ce5dab
Removed virtualenv as it currently is useless
AlexejPenner Jul 26, 2022
6cee5cd
Added ge
AlexejPenner Jul 26, 2022
50d9590
Reformatted test
AlexejPenner Jul 26, 2022
34271d8
Merge branch 'develop' into feature/ENG-939-LTKF
AlexejPenner Jul 26, 2022
f12510f
Revert to using the test image
AlexejPenner Jul 26, 2022
8c5bf66
Handle errors during shutil.rmtree
AlexejPenner Jul 27, 2022
b75da8c
No longer have to handle exception, hopefully
AlexejPenner Jul 27, 2022
f3133f0
Linted
AlexejPenner Jul 27, 2022
c4bade1
Merge branch 'develop' into feature/ENG-939-LTKF
AlexejPenner Jul 27, 2022
23bc855
Maybe Windows will work with this
AlexejPenner Jul 28, 2022
d55f021
Maybe Windows will work with this
AlexejPenner Jul 28, 2022
9d7601e
Does this work?
AlexejPenner Jul 28, 2022
56bb89b
When all else fails, go shell
AlexejPenner Jul 28, 2022
577f0b0
Reformatted
AlexejPenner Jul 29, 2022
4312677
Merge branch 'develop' into feature/ENG-939-LTKF
AlexejPenner Jul 31, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
26 changes: 0 additions & 26 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,29 +35,3 @@ jobs:
needs: poetry-install
uses: ./.github/workflows/integration-test.yml
secrets: inherit

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: [poetry-install, 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

spell-check:
uses: ./.github/workflows/spellcheck.yml
59 changes: 59 additions & 0 deletions .github/workflows/infrastructure_tests.yml
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 ]
Copy link
Contributor

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?

Copy link
Contributor Author

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

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! ❌',
});
3 changes: 3 additions & 0 deletions .github/workflows/integration-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ jobs:
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
Expand Down
38 changes: 31 additions & 7 deletions .github/workflows/kubeflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Copy link
Contributor

Choose a reason for hiding this comment

The 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
Copy link
Contributor

Choose a reason for hiding this comment

The 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:
Expand All @@ -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
Copy link
Contributor

Choose a reason for hiding this comment

The 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
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
evidently facets huggingface mlflow tensorflow sklearn xgboost lightgbm slack neural_prophet -f
evidently facets huggingface mlflow tensorflow sklearn xgboost lightgbm slack neural_prophet -y


- 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
51 changes: 51 additions & 0 deletions docker/base-test.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
FROM ubuntu:20.04
Copy link
Contributor

Choose a reason for hiding this comment

The 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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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
13 changes: 13 additions & 0 deletions examples/mlflow_tracking/steps/preprocessor/__init__.py
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.
29 changes: 29 additions & 0 deletions examples/mlflow_tracking/steps/preprocessor/preprocessor.py
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
5 changes: 5 additions & 0 deletions examples/neural_prophet/pipelines/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,8 @@
# 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 .neural_prophet_pipeline.neural_prophet_pipeline import (
neural_prophet_pipeline,
)

__all__ = ["neural_prophet_pipeline"]
8 changes: 2 additions & 6 deletions examples/neural_prophet/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,8 @@
# 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 pipelines.neural_prophet_pipeline.neural_prophet_pipeline import (
neural_prophet_pipeline,
)
from steps.data_loader.data_loader_step import data_loader
from steps.predictor.predictor_step import predictor
from steps.trainer.trainer_step import trainer
from pipelines import neural_prophet_pipeline
from steps import data_loader, predictor, trainer

if __name__ == "__main__":
pipeline = neural_prophet_pipeline(
Expand Down
5 changes: 5 additions & 0 deletions examples/neural_prophet/steps/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,8 @@
# 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 .data_loader.data_loader_step import data_loader
from .predictor.predictor_step import predictor
from .trainer.trainer_step import trainer

__all__ = ["data_loader", "trainer", "predictor"]
13 changes: 13 additions & 0 deletions examples/scipy/pipelines/scipy_example_pipeline/__init__.py
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)
2 changes: 1 addition & 1 deletion examples/scipy/steps/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Contributor

Choose a reason for hiding this comment

The 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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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

Copy link
Contributor

Choose a reason for hiding this comment

The 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

  • some examples import nothing in these init files
  • kubernetes and the quickstart do absolute imports
  • the rest does relative imports

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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

Copy link
Contributor

Choose a reason for hiding this comment

The 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
Expand Down
13 changes: 13 additions & 0 deletions examples/scipy/steps/importer/__init__.py
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.