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

Simplify component imports #10

Merged
44 commits merged into from
May 17, 2023
Merged
Show file tree
Hide file tree
Changes from 31 commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
802e3cb
Move pipeline_components inside pipelines
felix-datatonic May 5, 2023
23b5a12
Move pipeline_components inside pipelines
felix-datatonic May 5, 2023
c2f39d2
Update cloud build actions
felix-datatonic May 5, 2023
ee14014
Fix e2e-test.yaml
felix-datatonic May 5, 2023
1da7b3e
Fix e2e-test.yaml
felix-datatonic May 5, 2023
075a9ce
Change to python packages
felix-datatonic May 8, 2023
4629ca2
Fix unit tests of components
felix-datatonic May 8, 2023
49f1fc3
Fix cloud build triggers
felix-datatonic May 8, 2023
79ced6d
Fix pipeline imports
felix-datatonic May 8, 2023
2a6b620
Fix e2e trigger
felix-datatonic May 8, 2023
063ad1c
Update e2e tests
felix-datatonic May 8, 2023
8512cc9
Update e2e tests
felix-datatonic May 8, 2023
f6eda20
Update source dir of cloud function
felix-datatonic May 8, 2023
91a01d3
Move pipeline_components inside pipelines
felix-datatonic May 5, 2023
6dceed0
Move pipeline_components inside pipelines
felix-datatonic May 5, 2023
547e4b7
Update cloud build actions
felix-datatonic May 5, 2023
b575fdb
Fix e2e-test.yaml
felix-datatonic May 5, 2023
1a0ed17
Fix e2e-test.yaml
felix-datatonic May 5, 2023
c090f31
Change to python packages
felix-datatonic May 8, 2023
abde0bc
Fix unit tests of components
felix-datatonic May 8, 2023
70ac57a
Fix cloud build triggers
felix-datatonic May 8, 2023
99a1c9f
Fix pipeline imports
felix-datatonic May 8, 2023
a43037a
Fix e2e trigger
felix-datatonic May 8, 2023
0b499cc
Update e2e tests
felix-datatonic May 8, 2023
bb4d008
Update e2e tests
felix-datatonic May 8, 2023
fe9369a
Update source dir of cloud function
felix-datatonic May 8, 2023
344496f
Merge remote-tracking branch 'origin/feature/simplify-component-impor…
felix-datatonic May 9, 2023
ebbbf66
Restore yaml linting
felix-datatonic May 9, 2023
9fbf2cf
Simplify component imports in unit tests
felix-datatonic May 9, 2023
0e761e0
Update dep's to match broader pytest requirement
felix-datatonic May 9, 2023
d3125e8
Create components folder and update make commands
felix-datatonic May 9, 2023
fc5f9fc
Minor change in e2e tests method parameters
felix-datatonic May 9, 2023
c4ee37c
Update docs
felix-datatonic May 9, 2023
0addf4f
Fix links in pipelines/README.md
felix-datatonic May 9, 2023
b80537c
Update deps and unit tests
felix-datatonic May 9, 2023
0c0d29c
Remove unused fixture in bigquery-components
felix-datatonic May 9, 2023
17e93b7
fix: fixed make e2e-tests command
May 9, 2023
534ba74
update .gitignore
May 9, 2023
aeb5b05
docs: update author with placeholder value
May 9, 2023
bd436d5
fix: update google-cloud-aiplatform for cloud function
May 9, 2023
deb3679
refactor: rename aiplatform-components to vertex-components for clarity
May 9, 2023
0b47e05
docs: typo
May 9, 2023
d60deba
docs: update docs for custom components
May 9, 2023
bd31667
docs: remove unused images
May 9, 2023
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
2 changes: 0 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ repos:
rev: v0.0.9
hooks:
- id: terraform-fmt
# - id: shellcheck

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v1.2.3
Expand All @@ -43,7 +42,6 @@ repos:
hooks:
- id: yamllint
args: [--format, parsable, --strict]
exclude: .*component.yaml

- repo: https://github.com/psf/black
rev: 22.3.0
Expand Down
32 changes: 3 additions & 29 deletions .yamllint
Original file line number Diff line number Diff line change
Expand Up @@ -14,34 +14,8 @@

---

yaml-files:
- '*.yaml'
- '*.yml'
- .yamllint
extends: default

rules:
braces: enable
brackets: enable
colons: enable
commas: enable
comments:
level: warning
comments-indentation:
level: warning
document-end: disable
document-start:
level: warning
empty-lines: enable
empty-values: disable
hyphens: enable
indentation: enable
key-duplicates: enable
key-ordering: disable
line-length: disable
new-line-at-end-of-file: enable
new-lines: enable
octal-values: disable
quoted-strings: disable
trailing-spaces: enable
truthy:
level: warning
line-length:
max: 120
35 changes: 14 additions & 21 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,36 +29,31 @@ setup: ## Set up local environment for Python development on pipelines

test-trigger: ## Runs unit tests for the pipeline trigger code
@cd pipelines && \
pipenv install --dev && \
pipenv run python -m pytest tests/trigger

compile-pipeline: ## Compile the pipeline to training.json or prediction.json. Must specify pipeline=<training|prediction>
@cd pipelines && \
@cd pipelines/src && \
pipenv run python -m pipelines.${PIPELINE_TEMPLATE}.${pipeline}.pipeline

compile-components: ## Compile all the components in a component group
@cd pipeline_components/${GROUP} && \
pipenv install && \
for component in ${GROUP}/*/component.py ; do \
pipenv run python $$component ; \
done
setup-components: ## Run unit tests for a component group
@cd "components/${GROUP}" && \
pipenv install --dev

compile-all-components: ## Compile all pipeline components
setup-all-components: ## Run unit tests for all pipeline components
@set -e && \
for component_group in pipeline_components/*/ ; do \
echo "Compiling components under $$component_group" && \
$(MAKE) compile-components GROUP=$$(basename $$component_group) ; \
for component_group in components/*/ ; do \
echo "Setup components under $$component_group" && \
$(MAKE) setup-components GROUP=$$(basename $$component_group) ; \
done

test-components: ## Run unit tests for a component group
@cd pipeline_components/${GROUP} && \
pipenv install --dev && \
@cd "components/${GROUP}" && \
pipenv run pytest

test-all-components: ## Run unit tests for all pipeline components
@set -e && \
for component_group in pipeline_components/*/ ; do \
echo "Running unit tests for components under $$component_group" && \
for component_group in components/*/ ; do \
echo "Test components under $$component_group" && \
$(MAKE) test-components GROUP=$$(basename $$component_group) ; \
done

Expand All @@ -70,14 +65,12 @@ sync-assets: ## Sync assets folder to GCS. Must specify pipeline=<training|predi
run: ## Compile pipeline, copy assets to GCS, and run pipeline in sandbox environment. Must specify pipeline=<training|prediction>. Optionally specify enable_pipeline_caching=<true|false> (defaults to default Vertex caching behaviour)
@ $(MAKE) compile-pipeline && \
$(MAKE) sync-assets && \
cd pipelines && \
pipenv run python -m trigger.main --template_path=./$(pipeline).json --enable_caching=$(enable_pipeline_caching)
cd pipelines/src && \
pipenv run python -m pipelines.trigger --template_path=./$(pipeline).json --enable_caching=$(enable_pipeline_caching)

e2e-tests: ## Compile pipeline, copy assets to GCS, and perform end-to-end (E2E) pipeline tests. Must specify pipeline=<training|prediction>. Optionally specify enable_pipeline_caching=<true|false> (defaults to default Vertex caching behaviour)
@ $(MAKE) compile-pipeline && \
$(MAKE) sync-assets && \
cd pipelines && \
pipenv run python -m pytest --log-cli-level=INFO tests/${PIPELINE_TEMPLATE}/$(pipeline) --enable_caching=$(enable_pipeline_caching)
pipenv run pytest --log-cli-level=INFO tests/${PIPELINE_TEMPLATE}/$(pipeline) --enable_caching=$(enable_pipeline_caching)
This conversation was marked as resolved.
Show resolved Hide resolved

env ?= dev
deploy-infra: ## Deploy the Terraform infrastructure to your project. Requires VERTEX_PROJECT_ID and VERTEX_LOCATION env variables to be set in env.sh. Optionally specify env=<dev|test|prod> (default = dev)
Expand Down
17 changes: 5 additions & 12 deletions cloudbuild/e2e-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,27 +24,20 @@ steps:
- |
mkdir -p ${COMMIT_SHA}/training/assets && \
mkdir -p ${COMMIT_SHA}/prediction/assets && \
cp -r pipelines/pipelines/${_PIPELINE_TEMPLATE}/training/assets ${COMMIT_SHA}/training/ && \
cp -r pipelines/pipelines/${_PIPELINE_TEMPLATE}/prediction/assets ${COMMIT_SHA}/prediction/ && \
cp -r pipelines/src/pipelines/${_PIPELINE_TEMPLATE}/training/assets ${COMMIT_SHA}/training/ && \
cp -r pipelines/src/pipelines/${_PIPELINE_TEMPLATE}/prediction/assets ${COMMIT_SHA}/prediction/ && \
gsutil cp -r ${COMMIT_SHA} ${_PIPELINE_PUBLISH_GCS_PATH}/${COMMIT_SHA}

# Install Python deps
# Run end-to-end (E2E) pipeline tests on both pipelines
- name: python:3.7
entrypoint: /bin/sh
dir: pipelines
args:
- -c
- |
pip install pipenv && \
pipenv install --dev && \
cd ../ && \
make compile-all-components && \
make compile-pipeline pipeline=training && \
make compile-pipeline pipeline=prediction && \
cd pipelines && \
pipenv run python -m pytest --log-cli-level=INFO tests/${_PIPELINE_TEMPLATE}/training --enable_caching=${_TEST_ENABLE_PIPELINE_CACHING} && \
pipenv run python -m pytest --log-cli-level=INFO tests/${_PIPELINE_TEMPLATE}/prediction --enable_caching=${_TEST_ENABLE_PIPELINE_CACHING}
make setup && \
make e2e-tests pipeline=training enable_pipeline_caching=False && \
make e2e-tests pipeline=prediction enable_pipeline_caching=False
env:
- VERTEX_LOCATION=${_TEST_VERTEX_LOCATION}
- VERTEX_PROJECT_ID=${_TEST_VERTEX_PROJECT_ID}
Expand Down
6 changes: 3 additions & 3 deletions cloudbuild/pr-checks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ steps:
git init && \
git add . && \
make pre-commit && \
make compile-all-components && \
make test-all-components && \
make compile-pipeline pipeline=training && \
make compile-pipeline pipeline=prediction
make compile-pipeline pipeline=prediction && \
make setup-all-components && \
make test-all-components
env:
- SKIP=terraform-fmt,git-dirty
- PIPELINE_TEMPLATE=${_PIPELINE_TEMPLATE}
Expand Down
2 changes: 1 addition & 1 deletion cloudbuild/trigger-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ steps:
args:
- '-c'
- |
pip install pipenv && \
make setup && \
make test-trigger
entrypoint: /bin/sh

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ verify_ssl = true
name = "pypi"

[packages]
kfp = "==1.8.9"
google-cloud-pipeline-components = ">=1.0.0,<2.0.0"
google-cloud-aiplatform = ">=1.24.1,<2.0.0"
kfp = "==1.8.21"

[dev-packages]
pytest = ">=6.2.4,<7.0.0"
google-cloud-aiplatform = ">= 1.24.1,<2.0.0"
google-cloud-pipeline-components = ">= 1.0.0,<2.0.0"
felix-datatonic marked this conversation as resolved.
Show resolved Hide resolved
pytest = ">=7.3.1,<8.0.0"
pre-commit = ">=2.14.1,<3.0.0"

[requires]
Expand Down
Loading