Run a Pipeline
Overview
Kubeflow Pipelines (KFP) provides several ways to trigger a pipeline run:
Tip
This guide only covers how to trigger an immediate pipeline run. For more advanced scheduling options please see the “Recurring Runs” section of the dashboard and API.Run Pipeline - KFP Dashboard
The first and easiest way to run a pipeline is by submitting it via the KFP dashboard.
To submit a pipeline for an immediate run:
Compile a pipeline to IR YAML.
From the “Pipelines” tab in the dashboard, select
+ Upload pipeline
:Upload the pipeline
.yaml
,.zip
or.tar.gz
file, populate the upload form, then clickCreate
.From the “Runs” tab, select
+ Create run
:Select the pipeline you want to run, populate the run form, then click
Start
:
Run Pipeline - KFP SDK Client
You may also programmatically submit pipeline runs from the KFP SDK client. The client supports two ways of submitting runs: from IR YAML or from a Python pipeline function.
Note
See the Connect the SDK to the API guide for more information about creating a KFP client.For either approach, start by instantiating a kfp.Client()
:
import kfp
# TIP: you may need to authenticate with the KFP instance
kfp_client = kfp.Client()
To submit IR YAML for execution use the .create_run_from_pipeline_package()
method:
#from kfp import compiler, dsl
#
#@dsl.component
#def add(a: float, b: float) -> float:
# return a + b
#
#@dsl.pipeline(name="Add two Numbers")
#def add_pipeline(a: float, b: float):
# add_task = add(a=a, b=b)
#
#compiler.Compiler().compile(
# add_pipeline,
# package_path="./add-pipeline.yaml"
#)
kfp_client.create_run_from_pipeline_package(
"./add-pipeline.yaml",
arguments={
"a": 1,
"b": 2,
}
)
To submit a python pipeline function for execution use the .create_run_from_pipeline_func()
convenience method, which wraps compilation and run submission into one method:
#from kfp import dsl
#
#@dsl.component
#def add(a: float, b: float) -> float:
# return a + b
#
#@dsl.pipeline(name="Add two Numbers")
#def add_pipeline(a: float, b: float):
# add_task = add(a=a, b=b)
kfp_client.create_run_from_pipeline_func(
add_pipeline,
arguments={
"a": 1,
"b": 2,
}
)
Run Pipeline - KFP CLI
The kfp run create
command allows you to submit a pipeline from the command line.
Here is the output of kfp run create --help
:
kfp run create [OPTIONS] [ARGS]...
For example, the following command submits the ./path/to/pipeline.yaml
IR YAML to the KFP backend:
kfp run create \
--experiment-name "my-experiment" \
--package-file "./path/to/pipeline.yaml"
For more information about the kfp
CLI, please see:
Feedback
Was this page helpful?
Thank you for your feedback!
We're sorry this page wasn't helpful. If you have a moment, please share your feedback so we can improve.