Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
tensorflow
GitHub Repository: tensorflow/docs-l10n
Path: blob/master/site/ja/tfx/guide/cli.md
25118 views

TFX コマンドラインインターフェイスの使用

TFX コマンドラインインターフェース(CLI)は、Kubeflow Pipelines、Vertex Pipeline などのパイプラインオーケストレーターを使用して、あらゆるパイプラインアクションを実行します。また、ローカルオーケストレーターを使用して、開発やデバッグを高速化することもできます。Apache Beam と Apache airflow は事件機能としてサポートされています。たとえば、CLI を使って次のことを行えます。

  • パイプラインを作成、更新、削除する。

  • パイプラインを実行し、さまざまなオーケストレーターでの実行を監視する。

  • パイプラインとパイプラインの実行を一覧表示する。

注意: TFX CLI は現在、互換性を保証していません。新しいバージョンがリリースされると、CLI インターフェイスが変更される可能性があります。

TFX CLI の概要

TFX CLI は、TFX パッケージの一部としてインストールされます。すべての CLI コマンドは、以下の構造に従います。

tfx <var>command-group</var> <var>command</var> <var>flags</var>

現在、次の command-group オプションがサポートされています。

  • tfx pipeline - TFX パイプラインを作成および管理します。

  • tfx run - さまざまなオーケストレーションプラットフォームで TFX パイプラインの実行を作成および管理します。

  • tfx template - TFX パイプラインテンプレートを一覧表示およびコピーするための実験的なコマンド。

各コマンドグループは、一連のコマンドを提供します。これらのコマンドの使用方法の詳細については、パイプラインコマンド実行コマンド、およびテンプレートコマンドのセクションを参照してください。

警告:現在、すべてのコマンドはすべてのオーケストレーターでサポートされていません。すべてのオーケストレーターでサポートされていないコマンドでは、サポートされているエンジンについて記載されています。

フラグを使用すると、CLI コマンドに引数を渡すことができます。フラグ内の単語は、ハイフン(-)またはアンダースコア(_)で区切られます。例えば、パイプライン名フラグは、--pipeline-nameまたは-pipeline_nameのいずれかとして指定できます。このドキュメントでは、簡潔にするためにアンダースコア付きのフラグを指定しています。TFX CLI で使用されるフラグの詳細はこちらを参照してください

tfx pipeline

tfx pipelineコマンドグループのコマンドの構造は次のとおりです。

tfx pipeline <var>command</var> <var>required-flags</var> [<var>optional-flags</var>]

tfx pipelineコマンドグループのコマンドの詳細については次のセクションを参照してください。

create

指定したオーケストレーターに新しいパイプラインを作成します。

使用法:

tfx pipeline create --pipeline_path=<var>pipeline-path</var> [--endpoint=<var>endpoint</var> --engine=<var>engine</var> \
--iap_client_id=<var>iap-client-id</var> --namespace=<var>namespace</var> \
--build_image --build_base_image=<var>build-base-image</var>]
--pipeline_path=pipeline-path
パイプライン構成ファイルへのパス。
--endpoint=endpoint

(オプション)Kubeflow Pipelines API サービスのエンドポイント。Kubeflow Pipelines API サービスのエンドポイントは、Kubeflow Pipelines ダッシュボードの URL と同じです。エンドポイント値は次のようになります。

<pre>https://<var>host-name</var>/pipeline</pre> <p> If you do not know the endpoint for your Kubeflow Pipelines cluster, contact you cluster administrator. </p> <p> If the <code>--endpoint</code> is not specified, the in-cluster service DNS name is used as the default value. This name works only if the CLI command executes in a pod on the Kubeflow Pipelines cluster, such as a <a href="https://www.kubeflow.org/docs/components/notebooks/jupyter-tensorflow-examples/" class="external">Kubeflow Jupyter notebooks</a> instance. </p>
--engine=engine

(オプション)パイプラインに使用されるオーケストレーター。エンジンの値は、次のいずれかの値と一致する必要があります。

  • kubeflow: エンジンを Kubeflow に設定します
  • local: エンジンをローカルオーケストレーターに設定します
  • vertex: エンジンを Vertex Pipelines に設定します
  • airflow:(実験的)エンジンを Apache Airflow に設定します
  • beam:(実験的)エンジンを Apache Beam に設定します

エンジンが設定されていない場合、エンジンは環境に基づいて自動検出されます。

**要注意: パイプライン構成ファイルの DagRunner に必要とされるオーケストレーターは、選択されたエンジンまたは自動検出されたエンジンと一致する必要があります。エンジンの自動検出は、ユーザー環境に基づいています。Apache Airflow と Kubeflow Pipelines がインストールされていない場合、デフォルトでローカルオーケストレーターが使用されます。

--iap_client_id=iap-client-id
(オプション)Kubeflow Pipelines を使用している場合に、IAP で保護されたエンドポイントのクライアント ID。
--namespace=namespace
(オプション)Kubeflow Pipelines API に接続するための Kubernetes 名前空間。名前空間が指定されていない場合、値はデフォルトでkubeflowになります。
--build_image

(オプション)enginekubeflow または vertex である場合、TFX はパイプラインのコンテナイメージが指定されていればそれを作成します。現在のディレクトリの `Dockerfile` が使用され、存在しない場合は TFX が自動的に生成します。

ビルドイメージは `KubeflowDagRunnerConfig` または `KubeflowV2DagRunnerConfig` に指定されているリモートレジストリにプッシュされます。

--build_base_image=build-base-image

(オプション)エンジンkubeflow の場合、TFX はパイプラインのコンテナイメージを作成します。ビルドベースイメージは、パイプラインコンテナイメージをビルドするときに使用するベースコンテナイメージを指定します。

例:

Kubeflow:

tfx pipeline create --engine=kubeflow --pipeline_path=<var>pipeline-path</var> \
--iap_client_id=<var>iap-client-id</var> --namespace=<var>namespace</var> --endpoint=<var>endpoint</var> \
--build_image

ローカル:

tfx pipeline create --engine=local --pipeline_path=<var>pipeline-path</var>

Vertex:

tfx pipeline create --engine=vertex --pipeline_path=<var>pipeline-path</var> \
--build_image

ユーザー環境からエンジンを自動検出するには、以下の例のようなエンジンフラグの使用を避けてください。詳細については、フラグのセクションを参照してください。

tfx pipeline create --pipeline_path=<var>pipeline-path</var>

update

指定されたオーケストレーターの既存のパイプラインを更新します。

使用法:

tfx pipeline update --pipeline_path=<var>pipeline-path</var> [--endpoint=<var>endpoint</var> --engine=<var>engine</var> \
--iap_client_id=<var>iap-client-id</var> --namespace=<var>namespace</var> --build_image]
--pipeline_path=pipeline-path
パイプライン構成ファイルへのパス。
--endpoint=endpoint

(オプション)Kubeflow Pipelines API サービスのエンドポイント。Kubeflow Pipelines API サービスのエンドポイントは、Kubeflow Pipelines ダッシュボードの URL と同じです。エンドポイント値は次のようになります。

<pre>https://<var>host-name</var>/pipeline</pre> <p> If you do not know the endpoint for your Kubeflow Pipelines cluster, contact you cluster administrator. </p> <p> If the <code>--endpoint</code> is not specified, the in-cluster service DNS name is used as the default value. This name works only if the CLI command executes in a pod on the Kubeflow Pipelines cluster, such as a <a href="https://www.kubeflow.org/docs/components/notebooks/jupyter-tensorflow-examples/" class="external">Kubeflow Jupyter notebooks</a> instance. </p>
--engine=engine

(オプション)パイプラインに使用されるオーケストレーター。エンジンの値は、次のいずれかの値と一致する必要があります。

  • kubeflow: エンジンを Kubeflow に設定します
  • local: エンジンをローカルオーケストレーターに設定します
  • vertex: エンジンを Vertex Pipelines に設定します
  • airflow:(実験的)エンジンを Apache Airflow に設定します
  • beam:(実験的)エンジンを Apache Beam に設定します

エンジンが設定されていない場合、エンジンは環境に基づいて自動検出されます。

**要注意: パイプライン構成ファイルの DagRunner に必要とされるオーケストレーターは、選択されたエンジンまたは自動検出されたエンジンと一致する必要があります。エンジンの自動検出は、ユーザー環境に基づいています。Apache Airflow と Kubeflow Pipelines がインストールされていない場合、デフォルトでローカルオーケストレーターが使用されます。

--iap_client_id=iap-client-id
(オプション)IAP で保護されたエンドポイントのクライアント ID。
--namespace=namespace
(オプション)Kubeflow Pipelines API に接続するための Kubernetes 名前空間。名前空間が指定されていない場合、値はデフォルトで kubeflow になります。
--build_image

(オプション)enginekubeflow または vertex である場合、TFX はパイプラインのコンテナイメージが指定されていればそれを作成します。

ビルドイメージは `KubeflowDagRunnerConfig` または `KubeflowV2DagRunnerConfig` に指定されているリモートレジストリにプッシュされます。

例:

Kubeflow:

tfx pipeline update --engine=kubeflow --pipeline_path=<var>pipeline-path</var> \
--iap_client_id=<var>iap-client-id</var> --namespace=<var>namespace</var> --endpoint=<var>endpoint</var> \
--build_image

ローカル:

tfx pipeline update --engine=local --pipeline_path=<var>pipeline-path</var>

Vertex:

tfx pipeline update --engine=vertex --pipeline_path=<var>pipeline-path</var> \
--build_image

compile

パイプライン構成ファイルをコンパイルして Kubeflow にワークフローファイルを作成し、コンパイル時に次のチェックを実行します。

  1. パイプラインパスが有効かどうかを確認します。

  2. パイプラインの詳細がパイプライン構成ファイルから正常に抽出されているかどうかを確認します。

  3. パイプライン構成の DagRunner がエンジンと一致するかどうかを確認します。

  4. 指定されたパッケージパスにワークフローファイルが正常に作成されているかどうかを確認します(Kubeflow の場合のみ)。

パイプラインを作成または更新する前に使用することが推薦されます。

使用法:

tfx pipeline compile --pipeline_path=<var>pipeline-path</var> [--engine=<var>engine</var>]
--pipeline_path=pipeline-path
パイプライン構成ファイルへのパス。
--engine=engine

(オプション)パイプラインに使用されるオーケストレーター。エンジンの値は、次のいずれかの値と一致する必要があります。

  • kubeflow: エンジンを Kubeflow に設定します
  • local: エンジンをローカルオーケストレーターに設定します
  • vertex: エンジンを Vertex Pipelines に設定します
  • airflow:(実験的)エンジンを Apache Airflow に設定します
  • beam:(実験的)エンジンを Apache Beam に設定します

エンジンが設定されていない場合、エンジンは環境に基づいて自動検出されます。

**要注意: パイプライン構成ファイルの DagRunner に必要とされるオーケストレーターは、選択されたエンジンまたは自動検出されたエンジンと一致する必要があります。エンジンの自動検出は、ユーザー環境に基づいています。Apache Airflow と Kubeflow Pipelines がインストールされていない場合、デフォルトでローカルオーケストレーターが使用されます。

例:

Kubeflow:

tfx pipeline compile --engine=kubeflow --pipeline_path=<var>pipeline-path</var>

ローカル:

tfx pipeline compile --engine=local --pipeline_path=<var>pipeline-path</var>

Vertex:

tfx pipeline compile --engine=vertex --pipeline_path=<var>pipeline-path</var>

delete

指定されたオーケストレーターからパイプラインを削除します。

使用法:

tfx pipeline delete --pipeline_path=<var>pipeline-path</var> [--endpoint=<var>endpoint</var> --engine=<var>engine</var> \
--iap_client_id=<var>iap-client-id</var> --namespace=<var>namespace</var>]
--pipeline_path=pipeline-path
パイプライン構成ファイルへのパス。
--endpoint=endpoint

(オプション)Kubeflow Pipelines API サービスのエンドポイント。Kubeflow Pipelines API サービスのエンドポイントは、Kubeflow Pipelines ダッシュボードの URL と同じです。エンドポイント値は次のようになります。

<pre>https://<var>host-name</var>/pipeline</pre> <p> If you do not know the endpoint for your Kubeflow Pipelines cluster, contact you cluster administrator. </p> <p> If the <code>--endpoint</code> is not specified, the in-cluster service DNS name is used as the default value. This name works only if the CLI command executes in a pod on the Kubeflow Pipelines cluster, such as a <a href="https://www.kubeflow.org/docs/components/notebooks/jupyter-tensorflow-examples/" class="external">Kubeflow Jupyter notebooks</a> instance. </p>
--engine=engine

(オプション)パイプラインに使用されるオーケストレーター。エンジンの値は、次のいずれかの値と一致する必要があります。

  • kubeflow: エンジンを Kubeflow に設定します
  • local: エンジンをローカルオーケストレーターに設定します
  • vertex: エンジンを Vertex Pipelines に設定します
  • airflow:(実験的)エンジンを Apache Airflow に設定します
  • beam:(実験的)エンジンを Apache Beam に設定します

エンジンが設定されていない場合、エンジンは環境に基づいて自動検出されます。

**要注意: パイプライン構成ファイルの DagRunner に必要とされるオーケストレーターは、選択されたエンジンまたは自動検出されたエンジンと一致する必要があります。エンジンの自動検出は、ユーザー環境に基づいています。Apache Airflow と Kubeflow Pipelines がインストールされていない場合、デフォルトでローカルオーケストレーターが使用されます。

--iap_client_id=iap-client-id
(オプション)IAP で保護されたエンドポイントのクライアント ID。
--namespace=namespace
(オプション)Kubeflow Pipelines API に接続するための Kubernetes 名前空間。名前空間が指定されていない場合、値はデフォルトで kubeflow になります。

例:

Kubeflow:

tfx pipeline delete --engine=kubeflow --pipeline_name=<var>pipeline-name</var> \
--iap_client_id=<var>iap-client-id</var> --namespace=<var>namespace</var> --endpoint=<var>endpoint</var>

ローカル:

tfx pipeline delete --engine=local --pipeline_name=<var>pipeline-name</var>

Vertex:

tfx pipeline delete --engine=vertex --pipeline_name=<var>pipeline-name</var>

list

指定されたオーケストレーター内のすべてのパイプラインを一覧表示します。

使用法:

tfx pipeline list [--endpoint=<var>endpoint</var> --engine=<var>engine</var> \
--iap_client_id=<var>iap-client-id</var> --namespace=<var>namespace</var>]
--endpoint=endpoint

(オプション)Kubeflow Pipelines API サービスのエンドポイント。Kubeflow Pipelines API サービスのエンドポイントは、Kubeflow Pipelines ダッシュボードの URL と同じです。エンドポイント値は次のようになります。

<pre>https://<var>host-name</var>/pipeline</pre> <p> If you do not know the endpoint for your Kubeflow Pipelines cluster, contact you cluster administrator. </p> <p> If the <code>--endpoint</code> is not specified, the in-cluster service DNS name is used as the default value. This name works only if the CLI command executes in a pod on the Kubeflow Pipelines cluster, such as a <a href="https://www.kubeflow.org/docs/components/notebooks/jupyter-tensorflow-examples/" class="external">Kubeflow Jupyter notebooks</a> instance. </p>
--engine=engine

(オプション)パイプラインに使用されるオーケストレーター。エンジンの値は、次のいずれかの値と一致する必要があります。

  • kubeflow: エンジンを Kubeflow に設定します
  • local: エンジンをローカルオーケストレーターに設定します
  • vertex: エンジンを Vertex Pipelines に設定します
  • airflow:(実験的)エンジンを Apache Airflow に設定します
  • beam:(実験的)エンジンを Apache Beam に設定します

エンジンが設定されていない場合、エンジンは環境に基づいて自動検出されます。

**要注意: パイプライン構成ファイルの DagRunner に必要とされるオーケストレーターは、選択されたエンジンまたは自動検出されたエンジンと一致する必要があります。エンジンの自動検出は、ユーザー環境に基づいています。Apache Airflow と Kubeflow Pipelines がインストールされていない場合、デフォルトでローカルオーケストレーターが使用されます。

--iap_client_id=iap-client-id
(オプション)IAP で保護されたエンドポイントのクライアント ID。
--namespace=namespace
(オプション)Kubeflow Pipelines API に接続するための Kubernetes 名前空間。名前空間が指定されていない場合、値はデフォルトで kubeflow になります。

例:

Kubeflow:

tfx pipeline list --engine=kubeflow --iap_client_id=<var>iap-client-id</var> \
--namespace=<var>namespace</var> --endpoint=<var>endpoint</var>

ローカル:

tfx pipeline list --engine=local

Vertex:

tfx pipeline list --engine=vertex

tfx run

tfx run コマンドグループのコマンドの構造は次のとおりです。

tfx run <var>command</var> <var>required-flags</var> [<var>optional-flags</var>]

tfx run コマンドグループのコマンドの詳細については次のセクションを参照してください。

create

オーケストレーターでパイプラインの新しい実行インスタンスを作成します。Kubeflow の場合、クラスター内のパイプラインの最新のパイプラインバージョンが使用されます。

使用法:

tfx run create --pipeline_name=<var>pipeline-name</var> [--endpoint=<var>endpoint</var> \
--engine=<var>engine</var> --iap_client_id=<var>iap-client-id</var> --namespace=<var>namespace</var>]
--pipeline_name=pipeline-name
パイプラインの名前。
--endpoint=endpoint

(オプション)Kubeflow Pipelines API サービスのエンドポイント。Kubeflow Pipelines API サービスのエンドポイントは、Kubeflow Pipelines ダッシュボードの URL と同じです。エンドポイント値は次のようになります。

<pre>https://<var>host-name</var>/pipeline</pre> <p> If you do not know the endpoint for your Kubeflow Pipelines cluster, contact you cluster administrator. </p> <p> If the <code>--endpoint</code> is not specified, the in-cluster service DNS name is used as the default value. This name works only if the CLI command executes in a pod on the Kubeflow Pipelines cluster, such as a <a href="https://www.kubeflow.org/docs/components/notebooks/jupyter-tensorflow-examples/" class="external">Kubeflow Jupyter notebooks</a> instance. </p>
--engine=engine

(オプション)パイプラインに使用されるオーケストレーター。エンジンの値は、次のいずれかの値と一致する必要があります。

  • kubeflow: エンジンを Kubeflow に設定します
  • local: エンジンをローカルオーケストレーターに設定します
  • vertex: エンジンを Vertex Pipelines に設定します
  • airflow:(実験的)エンジンを Apache Airflow に設定します
  • beam:(実験的)エンジンを Apache Beam に設定します

エンジンが設定されていない場合、エンジンは環境に基づいて自動検出されます。

**要注意: パイプライン構成ファイルの DagRunner に必要とされるオーケストレーターは、選択されたエンジンまたは自動検出されたエンジンと一致する必要があります。エンジンの自動検出は、ユーザー環境に基づいています。Apache Airflow と Kubeflow Pipelines がインストールされていない場合、デフォルトでローカルオーケストレーターが使用されます。

--runtime_parameter=parameter-name=parameter-value
(オプション)ランタイムパラメータ値を設定します。複数の変数の値を設定するために、複数回、設定できます。`airflow`、`kubeflow`、および `vertex` エンジンのみに適用できます。
--iap_client_id=iap-client-id
(オプション)IAP で保護されたエンドポイントのクライアント ID。
--namespace=namespace
(オプション)Kubeflow Pipelines API に接続するための Kubernetes 名前空間。名前空間が指定されていない場合、値はデフォルトで kubeflow になります。
--project=GCP-project-id
(Vertex では必須)vertex パイプラインの GCP プロジェクト ID。
--region=GCP-region
(Vertex では必須)us-central1 などの GCP リージョン名。利用できるリージョンは、「Vertex ドキュメント」(https://cloud.google.com/vertex-ai/docs/general/locations)をご覧ください。

例:

Kubeflow:

tfx run create --engine=kubeflow --pipeline_name=<var>pipeline-name</var> --iap_client_id=<var>iap-client-id</var> \
--namespace=<var>namespace</var> --endpoint=<var>endpoint</var>

ローカル:


tfx run create --engine=local --pipeline_name=<var>pipeline-name</var>

Vertex:


tfx run create --engine=vertex --pipeline_name=<var>pipeline-name</var> \
  --runtime_parameter=<var>var_name</var>=<var>var_value</var> \
  --project=<var>gcp-project-id</var> --region=<var>gcp-region</var>

terminate

指定されたパイプラインの実行を停止します。

** 要注意: 現在、Kubeflow でのみサポートされています。

使用法:


tfx run terminate --run_id=<var>run-id</var> [--endpoint=<var>endpoint</var> --engine=<var>engine</var> \
--iap_client_id=<var>iap-client-id</var> --namespace=<var>namespace</var>]
--run_id=run-id
パイプライン実行の一意の識別子。
--endpoint=endpoint

(オプション)Kubeflow Pipelines API サービスのエンドポイント。Kubeflow Pipelines API サービスのエンドポイントは、Kubeflow Pipelines ダッシュボードの URL と同じです。エンドポイント値は次のようになります。

<pre>https://<var>host-name</var>/pipeline</pre> <p> If you do not know the endpoint for your Kubeflow Pipelines cluster, contact you cluster administrator. </p> <p> If the <code>--endpoint</code> is not specified, the in-cluster service DNS name is used as the default value. This name works only if the CLI command executes in a pod on the Kubeflow Pipelines cluster, such as a <a href="https://www.kubeflow.org/docs/components/notebooks/jupyter-tensorflow-examples/" class="external">Kubeflow Jupyter notebooks</a> instance. </p>
--engine=engine

(オプション)パイプラインに使用されるオーケストレーター。エンジンの値は、次のいずれかの値と一致する必要があります。

  • kubeflow: エンジンを Kubeflow に設定します

エンジンが設定されていない場合、エンジンは環境に基づいて自動検出されます。

**要注意: パイプライン構成ファイルの DagRunner に必要とされるオーケストレーターは、選択されたエンジンまたは自動検出されたエンジンと一致する必要があります。エンジンの自動検出は、ユーザー環境に基づいています。Apache Airflow と Kubeflow Pipelines がインストールされていない場合、デフォルトでローカルオーケストレーターが使用されます。

--iap_client_id=iap-client-id
(オプション)IAP で保護されたエンドポイントのクライアント ID。
--namespace=namespace
(オプション)Kubeflow Pipelines API に接続するための Kubernetes 名前空間。名前空間が指定されていない場合、値はデフォルトでkubeflowになります。

例:

Kubeflow:

tfx run delete --engine=kubeflow --run_id=<var>run-id</var> --iap_client_id=<var>iap-client-id</var> \
--namespace=<var>namespace</var> --endpoint=<var>endpoint</var>

list

パイプラインのすべての実行を一覧表示します。

** 要注意: 現在、ローカルおよび Apache Beam ではサポートされていません。

使用法:


tfx run list --pipeline_name=<var>pipeline-name</var> [--endpoint=<var>endpoint</var> \
--engine=<var>engine</var> --iap_client_id=<var>iap-client-id</var> --namespace=<var>namespace</var>]
--pipeline_name=pipeline-name
パイプラインの名前。
--endpoint=endpoint

(オプション)Kubeflow Pipelines API サービスのエンドポイント。Kubeflow Pipelines API サービスのエンドポイントは、Kubeflow Pipelines ダッシュボードの URL と同じです。エンドポイント値は次のようになります。

<pre>https://<var>host-name</var>/pipeline</pre> <p> If you do not know the endpoint for your Kubeflow Pipelines cluster, contact you cluster administrator. </p> <p> If the <code>--endpoint</code> is not specified, the in-cluster service DNS name is used as the default value. This name works only if the CLI command executes in a pod on the Kubeflow Pipelines cluster, such as a <a href="https://www.kubeflow.org/docs/components/notebooks/jupyter-tensorflow-examples/" class="external">Kubeflow Jupyter notebooks</a> instance. </p>
--engine=engine

(オプション)パイプラインに使用されるオーケストレーター。エンジンの値は、次のいずれかの値と一致する必要があります。

  • kubeflow: エンジンを Kubeflow に設定します
  • airflow:(実験的)エンジンを Apache Airflow に設定します

エンジンが設定されていない場合、エンジンは環境に基づいて自動検出されます。

**要注意: パイプライン構成ファイルの DagRunner に必要とされるオーケストレーターは、選択されたエンジンまたは自動検出されたエンジンと一致する必要があります。エンジンの自動検出は、ユーザー環境に基づいています。Apache Airflow と Kubeflow Pipelines がインストールされていない場合、デフォルトでローカルオーケストレーターが使用されます。

--iap_client_id=iap-client-id
(オプション)IAP で保護されたエンドポイントのクライアント ID。
--namespace=namespace
(オプション)Kubeflow Pipelines API に接続するための Kubernetes 名前空間。名前空間が指定されていない場合、値はデフォルトでkubeflowになります。

例:

Kubeflow:

tfx run list --engine=kubeflow --pipeline_name=<var>pipeline-name</var> --iap_client_id=<var>iap-client-id</var> \
--namespace=<var>namespace</var> --endpoint=<var>endpoint</var>

status

現在の実行のステータスを返します。

** 要注意: 現在、ローカルおよび Apache Beam ではサポートされていません。

使用法:


tfx run status --pipeline_name=<var>pipeline-name</var> --run_id=<var>run-id</var> [--endpoint=<var>endpoint</var> \
--engine=<var>engine</var> --iap_client_id=<var>iap-client-id</var> --namespace=<var>namespace</var>]
--pipeline_name=pipeline-name
パイプラインの名前。
--run_id=run-id
パイプライン実行の一意の識別子。
--endpoint=endpoint

(オプション)Kubeflow Pipelines API サービスのエンドポイント。Kubeflow Pipelines API サービスのエンドポイントは、Kubeflow Pipelines ダッシュボードの URL と同じです。エンドポイント値は次のようになります。

<pre>https://<var>host-name</var>/pipeline</pre> <p> If you do not know the endpoint for your Kubeflow Pipelines cluster, contact you cluster administrator. </p> <p> If the <code>--endpoint</code> is not specified, the in-cluster service DNS name is used as the default value. This name works only if the CLI command executes in a pod on the Kubeflow Pipelines cluster, such as a <a href="https://www.kubeflow.org/docs/components/notebooks/jupyter-tensorflow-examples/" class="external">Kubeflow Jupyter notebooks</a> instance. </p>
--engine=engine

(オプション)パイプラインに使用されるオーケストレーター。エンジンの値は、次のいずれかの値と一致する必要があります。

  • kubeflow: エンジンを Kubeflow に設定します
  • airflow:(実験的)エンジンを Apache Airflow に設定します

エンジンが設定されていない場合、エンジンは環境に基づいて自動検出されます。

**要注意: パイプライン構成ファイルの DagRunner に必要とされるオーケストレーターは、選択されたエンジンまたは自動検出されたエンジンと一致する必要があります。エンジンの自動検出は、ユーザー環境に基づいています。Apache Airflow と Kubeflow Pipelines がインストールされていない場合、デフォルトでローカルオーケストレーターが使用されます。

--iap_client_id=iap-client-id
(オプション)IAP で保護されたエンドポイントのクライアント ID。
--namespace=namespace
(オプション)Kubeflow Pipelines API に接続するための Kubernetes 名前空間。名前空間が指定されていない場合、値はデフォルトでkubeflowになります。

例:

Kubeflow:

tfx run status --engine=kubeflow --run_id=<var>run-id</var> --pipeline_name=<var>pipeline-name</var> \
--iap_client_id=<var>iap-client-id</var> --namespace=<var>namespace</var> --endpoint=<var>endpoint</var>

delete

指定されたパイプラインの実行を削除します。

** 要注意: 現在、Kubeflow でのみサポートされています。

使用法:


tfx run delete --run_id=<var>run-id</var> [--engine=<var>engine</var> --iap_client_id=<var>iap-client-id</var> \
--namespace=<var>namespace</var> --endpoint=<var>endpoint</var>]
--run_id=run-id
パイプライン実行の一意の識別子。
--endpoint=endpoint

(オプション)Kubeflow Pipelines API サービスのエンドポイント。Kubeflow Pipelines API サービスのエンドポイントは、Kubeflow Pipelines ダッシュボードの URL と同じです。エンドポイント値は次のようになります。

<pre>https://<var>host-name</var>/pipeline</pre> <p> If you do not know the endpoint for your Kubeflow Pipelines cluster, contact you cluster administrator. </p> <p> If the <code>--endpoint</code> is not specified, the in-cluster service DNS name is used as the default value. This name works only if the CLI command executes in a pod on the Kubeflow Pipelines cluster, such as a <a href="https://www.kubeflow.org/docs/components/notebooks/jupyter-tensorflow-examples/" class="external">Kubeflow Jupyter notebooks</a> instance. </p>
--engine=engine

(オプション)パイプラインに使用されるオーケストレーター。エンジンの値は、次のいずれかの値と一致する必要があります。

  • kubeflow: エンジンを Kubeflow に設定します

エンジンが設定されていない場合、エンジンは環境に基づいて自動検出されます。

**要注意: パイプライン構成ファイルの DagRunner に必要とされるオーケストレーターは、選択されたエンジンまたは自動検出されたエンジンと一致する必要があります。エンジンの自動検出は、ユーザー環境に基づいています。Apache Airflow と Kubeflow Pipelines がインストールされていない場合、デフォルトでローカルオーケストレーターが使用されます。

--iap_client_id=iap-client-id
(オプション)IAP で保護されたエンドポイントのクライアント ID。
--namespace=namespace
(オプション)Kubeflow Pipelines API に接続するための Kubernetes 名前空間。名前空間が指定されていない場合、値はデフォルトでkubeflowになります。

例:

Kubeflow:

tfx run delete --engine=kubeflow --run_id=<var>run-id</var> --iap_client_id=<var>iap-client-id</var> \
--namespace=<var>namespace</var> --endpoint=<var>endpoint</var>

tfx template[実験的]

tfx templateコマンドグループのコマンドの構造は次のとおりです。


tfx template <var>command</var> <var>required-flags</var> [<var>optional-flags</var>]

tfx templateコマンドグループのコマンドの詳細は次のセクションを参照してください。テンプレートは実験的な機能であり、随時変更される可能性があります。

list

利用可能な TFX パイプラインテンプレートを一覧表示します。

使用法:


tfx template list

copy

テンプレートを宛先ディレクトリにコピーします。

使用法:


tfx template copy --model=<var>model</var> --pipeline_name=<var>pipeline-name</var> \
--destination_path=<var>destination-path</var>
--model=model
パイプラインテンプレートにより構築されたモデルの名前。
--pipeline_name=pipeline-name
パイプラインの名前。
--destination_path=destination-path
テンプレートのコピー先のパス。

TFX CLI フラグを理解する

一般的なフラグ

--engine=engine

パイプラインに使用されるオーケストレーター。エンジンの値は、次のいずれかの値と一致する必要があります。

  • kubeflow: エンジンを Kubeflow に設定します
  • local: エンジンをローカルオーケストレーターに設定します
  • vertex: エンジンを Vertex Pipelines に設定します
  • airflow:(実験的)エンジンを Apache Airflow に設定します
  • beam:(実験的)エンジンを Apache Beam に設定します

エンジンが設定されていない場合、エンジンは環境に基づいて自動検出されます。

**要注意: パイプライン構成ファイルの DagRunner に必要とされるオーケストレーターは、選択されたエンジンまたは自動検出されたエンジンと一致する必要があります。エンジンの自動検出は、ユーザー環境に基づいています。Apache Airflow と Kubeflow Pipelines がインストールされていない場合、デフォルトでローカルオーケストレーターが使用されます。

--pipeline_name=pipeline-name
パイプラインの名前。
--pipeline_path=pipeline-path
パイプライン構成ファイルへのパス。
--run_id=run-id
パイプライン実行の一意の識別子。

Kubeflow 特定のフラグ

--endpoint=endpoint

Kubeflow Pipelines API サービスのエンドポイント。Kubeflow Pipelines API サービスのエンドポイントは、Kubeflow Pipelines ダッシュボードの URL と同じです。エンドポイント値は次のようになります。

<pre>https://<var>host-name</var>/pipeline</pre> <p> If you do not know the endpoint for your Kubeflow Pipelines cluster, contact you cluster administrator. </p> <p> If the <code>--endpoint</code> is not specified, the in-cluster service DNS name is used as the default value. This name works only if the CLI command executes in a pod on the Kubeflow Pipelines cluster, such as a <a href="https://www.kubeflow.org/docs/components/notebooks/jupyter-tensorflow-examples/" class="external">Kubeflow Jupyter notebooks</a> instance. </p>
--iap_client_id=iap-client-id
IAP で保護されたエンドポイントのクライアント ID。
--namespace=namespace
Kubeflow Pipelines API に接続するための Kubernetes 名前空間。名前空間が指定されていない場合、値はデフォルトで kubeflow になります。

TFX CLI により生成されたファイル

パイプラインが作成されて実行されると、パイプライン管理用に複数のファイルが生成されます。

  • ${HOME}/tfx/local, beam, airflow, vertex

    • 構成から読み取られたパイプラインメタデータは、${HOME}/tfx/${ORCHESTRATION_ENGINE}/${PIPELINE_NAME}に保存されます。AIRFLOW_HOMEKUBEFLOW_HOMEなどの環境変数を設定することでこの場所をカスタマイズできます。この動作は、将来のリリースで変更される可能性があります。このディレクトリは、実行の作成またはパイプラインの更新に必要なパイプライン情報(パイプライン ID を含む)を Kubeflow Pipelines クラスタに格納するために使用されます。

    • TFX 0.25 より前では、これらのファイルは${HOME}/${ORCHESTRATION_ENGINE}の下にありました。スムーズに移行するために、TFX 0.25 では、古い場所にあるファイルは自動的に新しい場所に移動されます。

    • TFX 0.27 以降、kubeflow はこれらのメタデータファイルをローカルファイルシステムに作成しません。kubeflow が作成する他のファイルについては、以下を参照してください。

  • (Kubeflow のみ)Dockerfile とコンテナイメージ

    • Kubeflow Pipelines では、パイプラインに 2 種類の入力が必要です。これらのファイルは、現行のディレクトリの TFX により生成されます。

    • 1 つはパイプラインでコンポーネントを実行するために使用されるコンテナイメージです。このコンテナイメージは、Kubeflow Pipelines のパイプラインが --build-image フラグ付きで作成されたか更新された場合にビルドされます。存在しない場合は TFX CLI によって Dockerfile が作成され、コンテナイメージを KubeflowDagRunnerConfig に指定されたレジストリにビルドしてプッシュします。