Kubeflow Pipelines SDK を使用した AI Platform Pipelines への接続

Kubeflow Pipelines SDK を使用すると、AI Platform Pipelines クラスタでの以下のようなアクティビティの管理、自動化ができます。

  • パイプラインの AI Platform Pipelines クラスタへのロード
  • パイプラインの実行
  • パイプラインと実行に関する情報の取得

このガイドでは、Kubeflow Pipelines SDK を使用して AI Platform Pipelines クラスタに接続する方法を説明します。

始める前に

Kubeflow Pipelines SDK を使用してクラスタに接続する前に、まず、AI Platform Pipelines クラスタを設定し、Kubeflow Pipelines SDK をインストールして、AI Platform Pipelines クラスタにアクセスするための十分な権限を確保する必要があります。

  1. ガイドに沿って AI Platform Pipelines クラスタを設定します。

  2. Kubeflow Pipelines SDK をインストールするか、バージョン 0.5.21.0.4 以降にアップグレードします。

  3. Kubeflow Pipelines SDK を使用して AI Platform Pipelines クラスタにアクセスするには、Google Kubernetes Engine クラスタのサービス アカウント用のサービス アカウント ユーザー ロールが必要です。

    詳しくは、ユーザーに AI Platform Pipelines へのアクセスを許可するをご覧ください。

Kubeflow Pipelines SDK を使用して AI Platform Pipelines クラスタに接続する

Kubeflow Pipelines SDK を使用して AI Platform Pipelines クラスタに接続するには、以下の手順を行います。

  1. Google Cloud コンソールで AI Platform Pipelines を開きます。

    AI Platform Pipelines に移動

  2. Kubeflow Pipelines クラスタの [パイプライン ダッシュボードを開く] をクリックします。Kubeflow Pipelines のユーザー インターフェースが新しいタブで開きます。

  3. ホスト名と URL スキームは、Kubeflow Pipelines ダッシュボードの URL で確認できます。ホスト名とスキームは、URL の一部(URL の先頭と /#/start の間)です。ホスト名とスキームは https://*.pipelines.googleusercontent.com のパターンに一致する必要があります。

  4. Jupyter ノートブックまたは Python クライアントから AI Platform Pipelines クラスタに接続するには、Kubeflow Pipelines SDK を使用します。

    import kfp
    client = kfp.Client(host='https://example.com')
    

    https://example.com は、クラスタのホスト名とスキームに置き換えます。

  5. これで、Kubeflow Pipelines SDK を使用してクラスタを操作できるようになりました。たとえば、次のコマンドはクラスタのパイプラインを一覧表示します。

    client.list_pipelines()
    

次のステップ