【问题标题】:Is there a way to automate the build of kubeflow pipeline in gcp有没有办法在 gcp 中自动构建 kubeflow 管道
【发布时间】:2020-12-25 20:05:15
【问题描述】:

这是我的 cloudbuild.yaml 文件

- name: 'gcr.io/cloud-builders/docker'
  args: ['build', '-t', 'gcr.io/$PROJECT_ID/$_TRAINER_IMAGE_NAME:$TAG_NAME', '.']
  dir: $_PIPELINE_FOLDER/trainer_image
  
# Build the base image for lightweight components
- name: 'gcr.io/cloud-builders/docker'
  args: ['build', '-t', 'gcr.io/$PROJECT_ID/$_BASE_IMAGE_NAME:$TAG_NAME', '.']
  dir: $_PIPELINE_FOLDER/base_image

# Compile the pipeline
- name: 'gcr.io/$PROJECT_ID/kfp-cli'
  args:
  - '-c'
  - |
    dsl-compile --py $_PIPELINE_DSL --output $_PIPELINE_PACKAGE
  env:
  - 'BASE_IMAGE=gcr.io/$PROJECT_ID/$_BASE_IMAGE_NAME:$TAG_NAME'
  - 'TRAINER_IMAGE=gcr.io/$PROJECT_ID/$_TRAINER_IMAGE_NAME:$TAG_NAME'
  - 'RUNTIME_VERSION=$_RUNTIME_VERSION'
  - 'PYTHON_VERSION=$_PYTHON_VERSION'
  - 'COMPONENT_URL_SEARCH_PREFIX=$_COMPONENT_URL_SEARCH_PREFIX'
  - 'USE_KFP_SA=$_USE_KFP_SA'
  dir: $_PIPELINE_FOLDER/pipeline
  
 # Upload the pipeline
- name: 'gcr.io/$PROJECT_ID/kfp-cli'
  args:
  - '-c'
  - |
    kfp --endpoint $_ENDPOINT pipeline upload -p ${_PIPELINE_NAME}_$TAG_NAME $_PIPELINE_PACKAGE
  dir: $_PIPELINE_FOLDER/pipeline


# Push the images to Container Registry 
images: ['gcr.io/$PROJECT_ID/$_TRAINER_IMAGE_NAME:$TAG_NAME', 'gcr.io/$PROJECT_ID/$_BASE_IMAGE_NAME:$TAG_NAME']

所以基本上我要做的是编写一个包含所有变量的 bash 脚本,并且在我推送更改时,云构建应该自动触发。

【问题讨论】:

  • 不是machine-learning 问题,请不要发送不相关的标签(已删除)。
  • 这个问题的答案(就像现在一样)是“是的,有办法”。

标签: docker google-cloud-platform kubeflow kubeflow-pipelines


【解决方案1】:

您可以在 bash 的管道中添加另一个步骤。如下所示。

steps:
  - name: 'bash'
    args: ['echo', 'I am bash']

【讨论】:

  • 所以如果在我的 bash 中我声明了一些变量。它会在我的 cloudbuild.yaml 文件中提供吗?
  • 是的,您可以在云构建的触发设置中声明变量并提及值。
【解决方案2】:

您似乎将编译和上传拆分为两个单独的步骤。我不是 100% 确定这在 CloudBuild 中是否有效(我不确定文件是否共享)。

您可能希望合并这些步骤。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-09-05
    • 2019-09-03
    • 1970-01-01
    • 2022-01-16
    • 1970-01-01
    • 1970-01-01
    • 2020-05-19
    • 1970-01-01
    相关资源
    最近更新 更多