Skip to content

Commit

Permalink
clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
connor-mccarthy committed Apr 27, 2022
1 parent 6df6274 commit 5897046
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 36 deletions.
2 changes: 0 additions & 2 deletions sdk/python/kfp/cli/cli_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,6 @@ class TestSmokeTestAllCommandsWithHelp(parameterized.TestCase):
def setUpClass(cls):
cls.runner = testing.CliRunner()

cls.vals = [('run', 'list')]

@parameterized.parameters(*noun_verb_list)
def test(self, noun: str, verb: str):
with mock.patch('kfp.cli.cli.client.Client'):
Expand Down
2 changes: 0 additions & 2 deletions sdk/python/kfp/cli/diagnose_me_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,10 @@
@click.option(
'-p',
'--project-id',
type=Text,
help='Target project id. It will use environment default if not specified.')
@click.option(
'-n',
'--namespace',
type=Text,
help='Namespace to use for Kubernetes cluster.all-namespaces is used if not specified.'
)
@click.pass_context
Expand Down
7 changes: 3 additions & 4 deletions sdk/python/kfp/cli/experiment.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ def create(ctx: click.Context, description: str, name: str):
'-m',
'--max-size',
default=100,
type=int,
help=parsing.get_param_descr(client.Client.list_experiments, 'page_size'))
@click.option(
'--sort-by',
Expand Down Expand Up @@ -147,8 +148,7 @@ def archive(ctx: click.Context, experiment_id: str, experiment_name: str):
client = ctx.obj['client']

if (experiment_id is None) == (experiment_name is None):
raise ValueError(
'Either --experiment-id or --experiment-name is required.')
raise ValueError(either_option_required)

if not experiment_id:
experiment = client.get_experiment(experiment_name=experiment_name)
Expand All @@ -175,8 +175,7 @@ def unarchive(ctx: click.Context, experiment_id: str, experiment_name: str):
client = ctx.obj['client']

if (experiment_id is None) == (experiment_name is None):
raise ValueError(
'Either --expriment-id or --experiment-name is required.')
raise ValueError(either_option_required)

if not experiment_id:
experiment = client.get_experiment(experiment_name=experiment_name)
Expand Down
20 changes: 6 additions & 14 deletions sdk/python/kfp/cli/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,10 @@ def upload_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)
_display_pipeline_version(version, output_format)


Expand All @@ -112,6 +113,7 @@ def upload_version(ctx: click.Context,
'-m',
'--max-size',
default=100,
type=int,
help=parsing.get_param_descr(client.Client.list_pipelines, 'page_size'))
@click.option(
'--sort-by',
Expand Down Expand Up @@ -191,17 +193,7 @@ def list_versions(ctx: click.Context, pipeline_id: str, page_token: str,
@click.argument('version-id')
@click.pass_context
def delete_version(ctx: click.Context, version_id: str):
"""Delete a version of a pipeline.
Args:
version_id: id of the pipeline version.
Returns:
Object. If the method is called asynchronously, returns the request thread.
Throws:
Exception if pipeline version is not found.
"""
"""Delete a version of a pipeline."""
confirmation = f'Are you sure you want to delete pipeline version {version_id}?'
if not click.confirm(confirmation):
return
Expand Down
7 changes: 6 additions & 1 deletion sdk/python/kfp/cli/recurring_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ def recurring_run():
'job_name'))
@click.option(
'--interval-second',
type=int,
help=parsing.get_param_descr(client.Client.create_recurring_run,
'interval_second'))
@click.option(
Expand All @@ -97,7 +98,10 @@ def recurring_run():
'--start-time',
help=parsing.get_param_descr(client.Client.create_recurring_run,
'start_time'))
@click.option('--version-id', help='The id of a pipeline version.')
@click.option(
'--version-id',
help=parsing.get_param_descr(client.Client.create_recurring_run,
'version_id'))
@click.argument('args', nargs=-1)
@click.pass_context
def create(ctx: click.Context,
Expand Down Expand Up @@ -165,6 +169,7 @@ def create(ctx: click.Context,
'-m',
'--max-size',
default=100,
type=int,
help=parsing.get_param_descr(client.Client.list_recurring_runs,
'page_size'))
@click.option(
Expand Down
7 changes: 4 additions & 3 deletions sdk/python/kfp/cli/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ def run():
'-m',
'--max-size',
default=100,
type=int,
help=parsing.get_param_descr(client.Client.list_runs, 'page_size'))
@click.option(
'--sort-by',
Expand Down Expand Up @@ -110,8 +111,8 @@ def list(ctx: click.Context, experiment_id: str, page_token: str, max_size: int,
'-t',
'--timeout',
default=0,
help='Wait for a run to complete until timeout in seconds.',
type=int)
type=int,
help='Wait for a run to complete until timeout in seconds.')
@click.argument('args', nargs=-1)
@click.pass_context
def submit(ctx: click.Context, experiment_name: str, run_name: str,
Expand Down Expand Up @@ -161,7 +162,7 @@ def submit(ctx: click.Context, experiment_name: str, run_name: str,
'--detail',
is_flag=True,
default=False,
help='Get detailed information of the run in json format.')
help='Get detailed information of the run in JSON format.')
@click.argument('run-id')
@click.pass_context
def get(ctx: click.Context, watch: bool, detail: bool, run_id: str):
Expand Down
17 changes: 7 additions & 10 deletions sdk/python/kfp/client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -678,7 +678,7 @@ def list_pipelines(
Args:
page_token: Token for starting of the page.
page_size: Size of the page.
sort_by: one of 'field_name', 'field_name desc'. For example,
sort_by: One of 'field_name', 'field_name desc'. For example,
'name desc'.
filter: A url-encoded, JSON-serialized Filter protocol buffer
(see [filter.proto](https://github.com/kubeflow/pipelines/blob/master/backend/api/filter.proto)).
Expand Down Expand Up @@ -1019,7 +1019,7 @@ def create_run_from_pipeline_func(
pipeline_func: A function that describes a pipeline by calling
components and composing them into execution graph.
arguments: Arguments to the pipeline function provided as a dict.
run_name (Optional): Name of the run to be shown in the UI.
run_name (Optional): Name of the run.
experiment_name (Optional): Name of the experiment to add the run to.
namespace: Kubernetes namespace where the pipeline runs are created.
For single user deployment, leave it as None;
Expand Down Expand Up @@ -1076,7 +1076,7 @@ def create_run_from_pipeline_package(
Args:
pipeline_file: A compiled pipeline package file.
arguments: Arguments to the pipeline function provided as a dict.
run_name (Optional): Name of the run to be shown in the UI.
run_name (Optional): Name of the run.
experiment_name (Optional): Name of the experiment to add the run to.
namespace (Optional): Kubernetes namespace where the pipeline runs are created.
For single user deployment, leave it as None;
Expand Down Expand Up @@ -1385,9 +1385,8 @@ def upload_pipeline(
Args:
pipeline_package_path: Local path to the pipeline package.
pipeline_name (Optional): Name of the pipeline to be shown in the UI.
description (Optional): Description of the pipeline to be shown in
the UI.
pipeline_name (Optional): Name of the pipeline.
description (Optional): Description of the pipeline..
Returns:
Server response object containing pipleine id and other information.
Expand All @@ -1414,12 +1413,10 @@ def upload_pipeline_version(
Args:
pipeline_package_path: Local path to the pipeline package.
pipeline_version_name: Name of the pipeline version to be shown in
the UI.
pipeline_version_name: Name of the pipeline version.
pipeline_id (Optional): Id of the pipeline.
pipeline_name (Optional): Name of the pipeline.
description (Optional): Description of the pipeline version to be
shown in the UI.
description (Optional): Description of the pipeline version.
Returns:
Server response object containing pipleine id and other information.
Expand Down

0 comments on commit 5897046

Please sign in to comment.