Skip to content

Commit

Permalink
Merge pull request #120 from GoogleCloudPlatform/vertex-refactor-kfp-…
Browse files Browse the repository at this point in the history
…lab-03-exercises

Vertex refactor of the KFP lab 03 - Exercises
  • Loading branch information
BenoitDherin authored Aug 22, 2021
2 parents 347b1bd + d39dfda commit 54b9a77
Show file tree
Hide file tree
Showing 9 changed files with 773 additions and 0 deletions.
50 changes: 50 additions & 0 deletions immersion/kubeflow_pipelines/cicd/labs/cloudbuild_vertex.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Copyright 2021 Google LLC

# 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.

steps:
# Build the trainer image
- name: # TODO
args: # TODO
dir: # TODO


# Compile the pipeline
- name: 'gcr.io/$PROJECT_ID/kfp-cli-vertex'
args:
- '-c'
- |
dsl-compile-v2 # TODO
env:
- 'PIPELINE_ROOT=gs://$PROJECT_ID-vertex/pipeline'
- 'PROJECT_ID=$PROJECT_ID'
- 'REGION=$_REGION'
- 'SERVING_CONTAINER_IMAGE_URI=us-docker.pkg.dev/vertex-ai/prediction/sklearn-cpu.0-20:latest'
- 'TRAINING_CONTAINER_IMAGE_URI=gcr.io/$PROJECT_ID/trainer_image_covertype_vertex:latest'
- 'TRAINING_FILE_PATH=gs://$PROJECT_ID-vertex/data/training/dataset.csv'
- 'VALIDATION_FILE_PATH=gs://$PROJECT_ID-vertex/data/validation/dataset.csv'
dir: pipeline_vertex

# Run the pipeline
- name: 'gcr.io/$PROJECT_ID/kfp-cli-vertex'
args:
- '-c'
- |
python kfp-cli_vertex/run_pipeline.py # TODO
# Push the images to Container Registry
# TODO: List the images to be pushed to the project Docker registry
images: # TODO


# This is required since the pipeline run overflows the default timeout
timeout: 10800s
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Copyright 2021 Google LLC

# 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.
"""Run a compiled Kubeflow pipeline on Vertex AI."""
import fire
from google.cloud import aiplatform


def run_pipeline(project_id, region, template_path, display_name):

aiplatform.init(project=project_id, location=region)

pipeline = aiplatform.PipelineJob(
display_name=display_name,
template_path=template_path,
enable_caching=False,
)

pipeline.run()

if __name__ == '__main__':
fire.Fire(run_pipeline)
Loading

0 comments on commit 54b9a77

Please sign in to comment.