Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(sdk): add .list_pipeline_versions and .unarchive_experiment methods to Client #7563

Merged
merged 2 commits into from
Apr 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions sdk/RELEASE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Current Version (Still in Development)

## Major Features and Improvements
* feat(sdk): add .list_pipeline_versions and .unarchive_experiment methods to Client [\#7563](https://github.com/kubeflow/pipelines/pull/7563)

## Breaking Changes

Expand Down
30 changes: 26 additions & 4 deletions sdk/python/kfp/client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -585,16 +585,21 @@ def get_experiment(self,
experiment_name))
return result.experiments[0]

def archive_experiment(self, experiment_id: str):
def archive_experiment(self, experiment_id: str) -> None:
"""Archives an experiment.

Args:
experiment_id: id of the experiment.
"""
self._experiment_api.archive_experiment(id=experiment_id)

Raises:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we still have raises part for those?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could not get this to raise an exception, so I removed from the docstring. Test case:

from kfp.client import Client

client = Client()
# does not raise an exception
assert client.archive_experiment(experiment_id="dummy_id") is None

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good, thank you!!

kfp_server_api.ApiException: If experiment is not found.
def unarchive_experiment(self, experiment_id: str) -> None:
"""Unarchives an experiment.

Args:
experiment_id: id of the experiment.
"""
self._experiment_api.archive_experiment(experiment_id)
self._experiment_api.unarchive_experiment(id=experiment_id)

def delete_experiment(self, experiment_id):
"""Delete experiment.
Expand Down Expand Up @@ -1486,6 +1491,23 @@ def list_pipeline_versions(
resource_key_id=pipeline_id,
filter=filter)

def get_pipeline_version(
self, version_id: str
) -> kfp_server_api.models.api_pipeline_version.ApiPipelineVersion:
"""Gets a pipeline version.

Args:
version_id: id of the pipeline version.

Returns:
Object. If the method is called asynchronously, returns the request
thread.

Raises:
kfp_server_api.ApiException: If pipeline version is not found.
"""
return self._pipelines_api.get_pipeline_version(version_id=version_id)

def delete_pipeline_version(self, version_id: str):
"""Deletes a pipeline version.

Expand Down