Skip to content

Commit

Permalink
SDK/CLI: Implement CLI delete pipeline command (kubeflow#2879)
Browse files Browse the repository at this point in the history
* feat: add delete pipeline command

* fix: docstring
  • Loading branch information
sh-tatsuno authored and Jeffwan committed Dec 9, 2020
1 parent 72728c3 commit d2a8e4a
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 4 deletions.
4 changes: 0 additions & 4 deletions sdk/python/kfp/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,5 @@
# kfp compile (migrate from dsl-compile)
# kfp experiment (manage experiments)

# TODO: kfp pipeline delete
# Calling client._pipelines_api.delete_pipeline(id=pipeline_id) throws
# exception: module 'kfp_server_api.models' has no attribute 'ERRORUNKNOWN'

if __name__ == '__main__':
main()
12 changes: 12 additions & 0 deletions sdk/python/kfp/_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -560,3 +560,15 @@ def get_pipeline(self, pipeline_id):
Exception if pipeline is not found.
"""
return self._pipelines_api.get_pipeline(id=pipeline_id)

def delete_pipeline(self, pipeline_id):
"""Delete pipeline.
Args:
id of the pipeline.
Returns:
Object. If the method is called asynchronously,
returns the request thread.
Throws:
Exception if pipeline is not found.
"""
return self._pipelines_api.delete_pipeline(id=pipeline_id)
11 changes: 11 additions & 0 deletions sdk/python/kfp/cli/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,17 @@ def get(ctx, pipeline_id):
_display_pipeline(pipeline)


@pipeline.command()
@click.argument("pipeline-id")
@click.pass_context
def delete(ctx, pipeline_id):
"""Delete an uploaded KFP pipeline"""
client = ctx.obj["client"]

client.delete_pipeline(pipeline_id)
print(f"{pipeline_id} is deleted")


def _print_pipelines(pipelines):
headers = ["Pipeline ID", "Name", "Uploaded at"]
data = [[
Expand Down

0 comments on commit d2a8e4a

Please sign in to comment.