Command Line Interface
This section provides a summary of the available commands in the KFP CLI. For more comprehensive documentation about all the available commands in the KFP CLI, see Command Line Interface in the KFP SDK reference documentation.
Usage
The KFP CLI is installed with the KFP SDK as kfp
.
Check availability of KFP CLI
To check whether KFP CLI is installed in your environment, run the following command:
kfp --version
General syntax
All commands in the KFP CLI use the following general syntax:
kfp [OPTIONS] COMMAND [ARGS]...
For example, to list all runs for a specific endpoint, run the following command:
kfp --endpoint http://my_kfp_endpoint.com run list
Get help for a command
To get help for a specific command, use the argument --help
directly in the command line. For example, to view guidance about the kfp run
command, type the following command:
kfp run --help
Main functons of the KFP CLI
You can use the KFP CLI to do the following:
Interact with KFP resources
The majority of the KFP CLI commands let you create, read, update, or delete KFP resources from the KFP backend. All of these commands use the following general syntax:
kfp <resource_name> <action>
The <resource_name>
argument can be one of the following:
run
recurring-run
pipeline
experiment
For all values of the <resource_name>
argument, the <action>
argument can be one of the following:
create
list
get
delete
Some resource names have additional resource-specific actions. The following table lists a few examples of resource-specific actions:
Resource name | Additional resource-specific actions |
---|---|
run |
|
recurring-run |
|
experiment |
|
pipeline |
|
Compile pipelines
You can use the kfp dsl compile
command to compile pipelines or components defined in a Python file to IR YAML.
-
To compile a pipeline definition defined in a Python file, run the following command.
kfp dsl compile --py [PATH_TO_INPUT_PYTHON] --output [PATH_TO_OUTPUT_YAML] --function [PIPELINE_NAME]
For example:
kfp dsl compile --py path/to/pipeline.py --output path/to/output.yaml
To compile a single pipeline or component from a Python file containing multiple pipeline or component definitions, use the
--function
argument.For example:
kfp dsl compile --py path/to/pipeline.py --output path/to/output.yaml --function my_pipeline
kfp dsl compile --py path/to/pipeline.py --output path/to/output.yaml --function my_component
-
To specify pipeline parameters, use the
--pipeline-parameters
argument and provide the parameters as JSON.kfp dsl compile [PATH_TO_INPUT_PYTHON] --output [PATH_TO_OUTPUT_YAML] --pipeline-parameters [PIPELINE_PARAMETERS_JSON]
For example:
kfp dsl compile --py path/to/pipeline.py --output path/to/output.yaml --pipeline-parameters '{"param1": 2.0, "param2": "my_val"}'
Build containerized Python components
You can author Containerized Python Components in the KFP SDK. This lets you use handle more source code with better code organization than the simpler Lightweight Python Component authoring experience.
Before you begin
Run the following command to install the KFP SDK with the additional Docker dependency:
pip install --pre kfp[all]
Build the component
To build a containerized Python component, use the following convenience command in the KFP CLI. Using this command, you can build an image with all the source code found in COMPONENTS_DIRECTORY
. The command uses the component found in the directory as the component runtime entrypoint.
kfp component build [OPTIONS] [COMPONENTS_DIRECTORY] [ARGS]...
For example:
kfp component build src/ --component-filepattern my_component --push-image
For more information about the arguments and flags supported by the kfp component build
command, see build in the KFP SDK API reference. For more information about creating containerized Python components, see Authoring Python Containerized Components.
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.