kfp.Client class

class kfp.Client(host=None, client_id=None)[source]

Bases: object

API Client for KubeFlow Pipeline.

IN_CLUSTER_DNS_NAME = 'ml-pipeline.kubeflow.svc.cluster.local:8888'
create_experiment(name)[source]

Create a new experiment. :param name: the name of the experiment.

Returns:An Experiment object. Most important field is id.
get_experiment(experiment_id=None, experiment_name=None)[source]

Get details of an experiment Either experiment_id or experiment_name is required :param experiment_id: id of the experiment. (Optional) :param experiment_name: name of the experiment. (Optional)

Returns:A response object including details of a experiment.
Throws:
Exception if experiment is not found or None of the arguments is provided
get_run(run_id)[source]

Get run details. :param id of the run.:

Returns:A response object including details of a run.
Throws:
Exception if run is not found.
list_experiments(page_token='', page_size=10, sort_by='')[source]

List experiments. :param page_token: token for starting of the page. :param page_size: size of the page. :param sort_by: can be ‘[field_name]’, ‘[field_name] des’. For example, ‘name des’.

Returns:A response object including a list of experiments and next page token.
list_runs(page_token='', page_size=10, sort_by='', experiment_id=None)[source]

List runs. :param page_token: token for starting of the page. :param page_size: size of the page. :param sort_by: one of ‘field_name’, ‘field_name des’. For example, ‘name des’. :param experiment_id: experiment id to filter upon

Returns:A response object including a list of experiments and next page token.
run_pipeline(experiment_id, job_name, pipeline_package_path=None, params={}, pipeline_id=None)[source]

Run a specified pipeline.

Parameters:
  • experiment_id – The string id of an experiment.
  • job_name – name of the job.
  • pipeline_package_path – local path of the pipeline package(the filename should end with one of the following .tar.gz, .tgz, .zip, .yaml, .yml).
  • params – a dictionary with key (string) as param name and value (string) as as param value.
  • pipeline_id – the string ID of a pipeline.
Returns:

A run object. Most important field is id.

wait_for_run_completion(run_id, timeout)[source]

Wait for a run to complete. :param run_id: run id, returned from run_pipeline. :param timeout: timeout in seconds.

Returns:Most important fields are run and pipeline_runtime
Return type:A run detail object