API Reference¶
Reference documentation for the Pipelines client and related types.
All classes below are available via from kubeflow.pipelines import ....
Pipelines Client¶
- class kubeflow.pipelines.PipelinesClient(backend_config: KubernetesBackendConfig | None = None) None[source]¶
Bases:
objectSimplified, name-first client for Kubeflow Pipelines.
Provides the core author → compile → upload → run → monitor workflow from a single import. Designed to be re-exported by the Kubeflow SDK at
kubeflow.pipelines.PipelinesClient.- Parameters:
backend_config (
KubernetesBackendConfig|None) – Connection parameters for the KFP API server. WhenNone, usesKubernetesBackendConfig()(zero-arg construction with auto-discovery).
- upload_pipeline(pipeline: Callable | str, *, name: str | None = None, version: str | None = None, description: str | None = None) PipelineVersion[source]¶
Upload a pipeline (or new version) to the server.
Handles callable functions, file paths, new pipelines, and new versions through a single unified method.
Note
When creating a new pipeline with an explicit
versionname, the server auto-generates the first version name during upload. A best-effort rename is attempted afterward; if the rename fails (e.g. due to permissions), a warning is logged and the returned version retains the server-generated name.- Parameters:
pipeline (
Callable|str) – A@dsl.pipeline-decorated function or a path to a compiled pipeline YAML file.name (
str|None) – Display name for the pipeline. If omitted, auto-generated from the function’s@dsl.pipeline(name=...)value or the filename without extension.version (
str|None) – Version label. If omitted, auto-generated. Callingupload_pipelineagain with the samenameand no explicitversioncreates a new version each time.
- Returns:
A
PipelineVersionobject representing the uploaded version.
- get_pipeline(name: str) Pipeline[source]¶
Get a pipeline by name.
- Parameters:
name (
str) – Pipeline display name.- Returns:
A
Pipelineobject.- Raises:
ValueError – If no pipeline matches or multiple pipelines match.
- get_pipeline_version(name: str, version: str) PipelineVersion[source]¶
Get a specific pipeline version by pipeline name and version name.
- Parameters:
- Returns:
A
PipelineVersionobject.- Raises:
ValueError – If the pipeline or version is not found.
- list_pipelines(*, page_token: str = '', page_size: int = 10) ListPipelinesResponse[source]¶
List pipelines available on the server.
- list_pipeline_versions(name: str, *, page_token: str = '', page_size: int = 10) ListPipelineVersionsResponse[source]¶
List versions of a pipeline by name.
- delete_pipeline(name: str, *, version: str | None = None, force: bool = False) None[source]¶
Delete a pipeline or a specific pipeline version.
- Parameters:
- Raises:
ValueError – If the pipeline has multiple versions and
force=False.
- run(pipeline: str | Callable | Pipeline | PipelineVersion, *, params: dict[str, Any] | None = None, name: str | None = None, experiment: str | None = None, version: str | None = None) Run[source]¶
Run a pipeline.
Supports multiple input types: - A pipeline name (
strwithout file extension): resolves theuploaded pipeline on the server.
A path to a compiled YAML file (
strending in.yaml/.yml): compile-and-submit inline, no upload.A
@dsl.pipeline-decorated callable: compile-and-submit inline.A
PipelineorPipelineVersionobject (fromget_pipeline/upload_pipeline).
Note
String inputs are classified as file paths when they end in
.yamlor.yml. If you have an uploaded pipeline whose display name ends with such an extension, pass thePipelineobject fromget_pipeline()instead.- Parameters:
pipeline (
str|Callable|Pipeline|PipelineVersion) – Pipeline to run (see above).params (
dict[str,Any] |None) – Pipeline parameters as a dict.name (
str|None) – Run display name. Auto-generated if omitted.experiment (
str|None) – Experiment name. IfNone, the server’s default experiment is used. If provided and the experiment does not exist, raisesValueError.version (
str|None) – Pipeline version name (used whenpipelineis a name string or aPipelineobject). Uses latest version if omitted.
- Returns:
A
Runobject.
- get_run(run_id: str) Run[source]¶
Get a run by ID.
- Parameters:
run_id (
str) – The run identifier.- Returns:
A
Runobject.
- list_runs(*, pipeline: str | None = None, experiment: str | None = None, status: str | None = None, page_token: str = '', page_size: int = 10) ListRunsResponse[source]¶
List runs, optionally filtered by pipeline, experiment, or status.
Note
The
pipelinefilter is applied client-side because the KFP v2beta1 API does not support server-side filtering by pipeline ID. When used, the returned page may contain fewer items thanpage_size— including zero items with a non-emptynext_page_tokenif all runs on that server page belong to other pipelines. Callers should continue paginating untilnext_page_tokenis empty.- Parameters:
- Returns:
A
ListRunsResponsewith.runsand.next_page_token.
- wait_for_run_status(run: str | Run, *, status: set[str] | None = None, timeout: int | None = 600, polling_interval: int = 5, callbacks: list[Callable[[Run], None]] | None = None) Run[source]¶
Wait for a run to reach a target state.
- Parameters:
run (
str|Run) – ARunobject or a run ID string.status (
set[str] |None) – Set of states to wait for. Defaults to{constants.RUN_COMPLETE}("succeeded"). The wait always exits immediately on any terminal state regardless of this parameter.timeout (
int|None) – Maximum seconds to wait. Defaults to 600 (10 minutes). PassNoneto wait indefinitely.polling_interval (
int) – Seconds between status checks.callbacks (
list[Callable[[Run],None]] |None) – Called with the finalRunobject when the wait ends (on any stop condition).
- Returns:
The
Runobject at the time the wait concluded.- Raises:
TimeoutError – If
timeoutexpires before reaching a stop condition.
- create_experiment(name: str, *, description: str | None = None) Experiment[source]¶
Create a new experiment.
If an experiment with the given name already exists, returns it.
- get_experiment(name: str) Experiment[source]¶
Get an experiment by name.
- Parameters:
name (
str) – Experiment display name.- Returns:
An
Experimentobject.- Raises:
ValueError – If no experiment with that name is found.
- list_experiments(*, page_token: str = '', page_size: int = 10) ListExperimentsResponse[source]¶
List experiments.
- delete_experiment(name: str) None[source]¶
Delete an experiment by name.
- Parameters:
name (
str) – Experiment display name.- Raises:
ValueError – If no experiment with that name is found.
- property kfp_client: Client¶
Access the underlying
kfp.Clientfor advanced operations.Lazily constructed on first access, sharing connection parameters from
KubernetesBackendConfig.
Backend Configuration¶
- class kubeflow.pipelines.KubernetesBackendConfig(base_url: str | None = None, user_token: str | None = None, is_secure: bool | None = None, custom_ca: str | None = None, namespace: str | None = None) None[source]¶
Bases:
objectConnection configuration for the KFP API server.
- Parameters:
base_url (
str|None) – KFP API server URL including scheme and port (e.g.https://ml-pipeline.example.com:8080). If omitted, auto-discovered following kfp.Client conventions (in-cluster DNS or kubeconfig proxy).is_secure (
bool|None) – Whether to verify TLS certificates (controlsverify_sslon the underlying HTTP client). Does not control whether the connection uses TLS — that is determined by the URL scheme. Inferred from scheme if omitted (Truefor https,Falsefor http).custom_ca (
str|None) – Path to PEM-encoded root certificates.namespace (
str|None) – Kubernetes namespace. If omitted, auto-detected.
Types¶
Available via from kubeflow.pipelines import Pipeline, PipelineVersion, Run, Experiment.
These are type aliases for the auto-generated kfp_server_api model classes:
Pipeline— a pipeline registered on the serverPipelineVersion— an immutable snapshot of a pipelineRun— a single execution of a pipelineExperiment— a logical grouping of runsListPipelinesResponse— paginated list of pipelinesListPipelineVersionsResponse— paginated list of pipeline versionsListRunsResponse— paginated list of runsListExperimentsResponse— paginated list of experiments
Constants¶
Available via from kubeflow.pipelines import constants.
- kubeflow.pipelines.constants.RUN_SUCCEEDED¶
'succeeded'
- kubeflow.pipelines.constants.RUN_FAILED¶
'failed'
- kubeflow.pipelines.constants.RUN_SKIPPED¶
'skipped'
- kubeflow.pipelines.constants.RUN_CANCELED¶
'canceled'
- kubeflow.pipelines.constants.RUN_CANCELING¶
'canceling'
- kubeflow.pipelines.constants.RUN_RUNNING¶
'running'
- kubeflow.pipelines.constants.RUN_PENDING¶
'pending'
- kubeflow.pipelines.constants.RUN_PAUSED¶
'paused'
- kubeflow.pipelines.constants.RUN_COMPLETE¶
Alias for
RUN_SUCCEEDED.
- kubeflow.pipelines.constants.TERMINAL_STATES¶
frozenset({'succeeded', 'failed', 'skipped', 'canceled'})