Skip to content

fix(sdk): fix CLI upload pipeline version #7722

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

Merged
Merged
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
fix cli upload pipeline version
  • Loading branch information
connor-mccarthy committed May 12, 2022
commit 712c7cac50d8a52d74adee26a26df677b9f37c26
30 changes: 20 additions & 10 deletions sdk/python/kfp/cli/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# limitations under the License.

import json
from optparse import Option
from typing import Any, Dict, List, Optional, Union

import click
Expand Down Expand Up @@ -65,6 +66,14 @@ def create(ctx: click.Context,


@pipeline.command()
@click.argument('package-file', type=click.Path(exists=True, dir_okay=False))
@click.option(
'-v',
'--pipeline-version',
help=parsing.get_param_descr(client.Client.upload_pipeline_version,
'pipeline_version_name'),
required=True,
)
@click.option(
'-p',
'--pipeline-id',
Expand All @@ -79,19 +88,17 @@ def create(ctx: click.Context,
'pipeline_name') + ' ' + either_option_required
)
@click.option(
'-v',
'--pipeline-version',
'-d',
'--description',
help=parsing.get_param_descr(client.Client.upload_pipeline_version,
'pipeline_version_name'),
required=True,
)
@click.argument('package-file', type=click.Path(exists=True, dir_okay=False))
'description'))
@click.pass_context
def create_version(ctx: click.Context,
package_file: str,
pipeline_version: str,
pipeline_id: Optional[str] = None,
pipeline_name: Optional[str] = None):
pipeline_name: Optional[str] = None,
description: Optional[str] = None):
"""Upload a version of a pipeline."""
client = ctx.obj['client']
output_format = ctx.obj['output']
Expand All @@ -102,9 +109,12 @@ def create_version(ctx: click.Context,
if pipeline_id is None:
raise ValueError(
f"Can't find a pipeline with name: {pipeline_name}")
# TODO: this is broken
version = client.pipeline_uploads.upload_pipeline_version(
package_file, name=pipeline_version, pipelineid=pipeline_id)
version = client.upload_pipeline_version(
pipeline_package_path=package_file,
pipeline_version_name=pipeline_version,
pipeline_id=pipeline_id,
pipeline_name=pipeline_name,
description=description)
_display_pipeline_version(version, output_format)
click.echo(f'Created pipeline version {version.id}.')

Expand Down