Skip to content

Commit

Permalink
fix(sdk): revert premature client changes (#8507)
Browse files Browse the repository at this point in the history
* revert _v1 client changes

* do not install kfp_server_api from source
  • Loading branch information
connor-mccarthy authored Nov 30, 2022
1 parent 3ef66ea commit 834bfbe
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 32 deletions.
54 changes: 26 additions & 28 deletions sdk/python/kfp/client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -474,8 +474,7 @@ def create_experiment(
name=name,
description=description,
resource_references=resource_references)
experiment = self._experiment_api.create_experiment_v1(
body=experiment)
experiment = self._experiment_api.create_experiment(body=experiment)

link = f'{self._get_url_prefix()}/#/experiments/details/{experiment.id}'
if self._is_ipython():
Expand Down Expand Up @@ -503,7 +502,7 @@ def get_pipeline_id(self, name: str) -> Optional[str]:
'stringValue': name,
}]
})
result = self._pipelines_api.list_pipelines_v1(filter=pipeline_filter)
result = self._pipelines_api.list_pipelines(filter=pipeline_filter)
if result.pipelines is None:
return None
if len(result.pipelines) == 1:
Expand Down Expand Up @@ -546,7 +545,7 @@ def list_experiments(
``ApiListExperimentsResponse`` object.
"""
namespace = namespace or self.get_user_namespace()
response = self._experiment_api.list_experiments_v1(
response = self._experiment_api.list_experiment(
page_token=page_token,
page_size=page_size,
sort_by=sort_by,
Expand Down Expand Up @@ -577,7 +576,7 @@ def get_experiment(self,
raise ValueError(
'Either experiment_id or experiment_name is required')
if experiment_id is not None:
return self._experiment_api.get_experiment_v1(id=experiment_id)
return self._experiment_api.get_experiment(id=experiment_id)
experiment_filter = json.dumps({
'predicates': [{
'op': _FILTER_OPERATIONS['EQUALS'],
Expand All @@ -586,13 +585,13 @@ def get_experiment(self,
}]
})
if namespace:
result = self._experiment_api.list_experiments_v1(
result = self._experiment_api.list_experiment(
filter=experiment_filter,
resource_reference_key_type=kfp_server_api.ApiResourceType
.NAMESPACE,
resource_reference_key_id=namespace)
else:
result = self._experiment_api.list_experiments_v1(
result = self._experiment_api.list_experiment(
filter=experiment_filter)
if not result.experiments:
raise ValueError(
Expand All @@ -611,7 +610,7 @@ def archive_experiment(self, experiment_id: str) -> dict:
Returns:
Empty dictionary.
"""
return self._experiment_api.archive_experiment_v1(id=experiment_id)
return self._experiment_api.archive_experiment(id=experiment_id)

def unarchive_experiment(self, experiment_id: str) -> dict:
"""Unarchives an experiment.
Expand All @@ -622,7 +621,7 @@ def unarchive_experiment(self, experiment_id: str) -> dict:
Returns:
Empty dictionary.
"""
return self._experiment_api.unarchive_experiment_v1(id=experiment_id)
return self._experiment_api.unarchive_experiment(id=experiment_id)

def delete_experiment(self, experiment_id: str) -> dict:
"""Delete experiment.
Expand All @@ -633,7 +632,7 @@ def delete_experiment(self, experiment_id: str) -> dict:
Returns:
Empty dictionary.
"""
return self._experiment_api.delete_experiment_v1(id=experiment_id)
return self._experiment_api.delete_experiment(id=experiment_id)

def _extract_pipeline_yaml(self, package_file: str) -> dict:

Expand Down Expand Up @@ -718,7 +717,7 @@ def list_pipelines(
Returns:
``ApiListPipelinesResponse`` object.
"""
return self._pipelines_api.list_pipelines_v1(
return self._pipelines_api.list_pipelines(
page_token=page_token,
page_size=page_size,
sort_by=sort_by,
Expand Down Expand Up @@ -782,7 +781,7 @@ def run_pipeline(
name=job_name,
service_account=service_account)

response = self._run_api.create_run_v1(body=run_body)
response = self._run_api.create_run(body=run_body)

link = f'{self._get_url_prefix()}/#/runs/details/{response.run.id}'
if self._is_ipython():
Expand All @@ -803,7 +802,7 @@ def archive_run(self, run_id: str) -> dict:
Returns:
Empty dictionary.
"""
return self._run_api.archive_run_v1(id=run_id)
return self._run_api.archive_run(id=run_id)

def unarchive_run(self, run_id: str) -> dict:
"""Restores an archived run.
Expand All @@ -814,7 +813,7 @@ def unarchive_run(self, run_id: str) -> dict:
Returns:
Empty dictionary.
"""
return self._run_api.unarchive_run_v1(id=run_id)
return self._run_api.unarchive_run(id=run_id)

def delete_run(self, run_id: str) -> dict:
"""Deletes a run.
Expand All @@ -825,7 +824,7 @@ def delete_run(self, run_id: str) -> dict:
Returns:
Empty dictionary.
"""
return self._run_api.delete_run_v1(id=run_id)
return self._run_api.delete_run(id=run_id)

def terminate_run(self, run_id: str) -> dict:
"""Terminates a run.
Expand All @@ -836,7 +835,7 @@ def terminate_run(self, run_id: str) -> dict:
Returns:
Empty dictionary.
"""
return self._run_api.terminate_run_v1(run_id=run_id)
return self._run_api.terminate_run(run_id=run_id)

def create_recurring_run(
self,
Expand Down Expand Up @@ -1206,7 +1205,7 @@ def list_runs(
"""
namespace = namespace or self.get_user_namespace()
if experiment_id is not None:
response = self._run_api.list_runs_v1(
response = self._run_api.list_runs(
page_token=page_token,
page_size=page_size,
sort_by=sort_by,
Expand All @@ -1215,7 +1214,7 @@ def list_runs(
resource_reference_key_id=experiment_id,
filter=filter)
elif namespace:
response = self._run_api.list_runs_v1(
response = self._run_api.list_runs(
page_token=page_token,
page_size=page_size,
sort_by=sort_by,
Expand All @@ -1224,7 +1223,7 @@ def list_runs(
resource_reference_key_id=namespace,
filter=filter)
else:
response = self._run_api.list_runs_v1(
response = self._run_api.list_runs(
page_token=page_token,
page_size=page_size,
sort_by=sort_by,
Expand Down Expand Up @@ -1298,7 +1297,7 @@ def get_run(self, run_id: str) -> kfp_server_api.ApiRun:
Returns:
``ApiRun`` object.
"""
return self._run_api.get_run_v1(run_id=run_id)
return self._run_api.get_run(run_id=run_id)

def wait_for_run_completion(self, run_id: str,
timeout: int) -> kfp_server_api.ApiRun:
Expand All @@ -1319,7 +1318,7 @@ def wait_for_run_completion(self, run_id: str,
while (status is None or status.lower()
not in ['succeeded', 'failed', 'skipped', 'error']):
try:
get_run_response = self._run_api.get_run_v1(run_id=run_id)
get_run_response = self._run_api.get_run(run_id=run_id)
is_valid_token = True
except kfp_server_api.ApiException as api_ex:
# if the token is valid but receiving 401 Unauthorized error
Expand Down Expand Up @@ -1348,7 +1347,7 @@ def _get_workflow_json(self, run_id: str) -> dict:
Returns:
Workflow JSON.
"""
get_run_response = self._run_api.get_run_v1(run_id=run_id)
get_run_response = self._run_api.get_run(run_id=run_id)
workflow = get_run_response.pipeline_runtime.workflow_manifest
workflow_json = json.loads(workflow)
return workflow_json
Expand Down Expand Up @@ -1445,7 +1444,7 @@ def get_pipeline(self, pipeline_id: str) -> kfp_server_api.ApiPipeline:
Returns:
``ApiPipeline`` object.
"""
return self._pipelines_api.get_pipeline_v1(id=pipeline_id)
return self._pipelines_api.get_pipeline(id=pipeline_id)

def delete_pipeline(self, pipeline_id: str) -> dict:
"""Deletes a pipeline.
Expand All @@ -1456,7 +1455,7 @@ def delete_pipeline(self, pipeline_id: str) -> dict:
Returns:
Empty dictionary.
"""
return self._pipelines_api.delete_pipeline_v1(id=pipeline_id)
return self._pipelines_api.delete_pipeline(id=pipeline_id)

def list_pipeline_versions(
self,
Expand Down Expand Up @@ -1490,7 +1489,7 @@ def list_pipeline_versions(
``ApiListPipelineVersionsResponse`` object.
"""

return self._pipelines_api.list_pipeline_versions_v1(
return self._pipelines_api.list_pipeline_versions(
page_token=page_token,
page_size=page_size,
sort_by=sort_by,
Expand All @@ -1508,8 +1507,7 @@ def get_pipeline_version(
Returns:
``ApiPipelineVersion`` object.
"""
return self._pipelines_api.get_pipeline_version_v1(
version_id=version_id)
return self._pipelines_api.get_pipeline_version(version_id=version_id)

def delete_pipeline_version(self, version_id: str) -> dict:
"""Deletes a pipeline version.
Expand All @@ -1520,7 +1518,7 @@ def delete_pipeline_version(self, version_id: str) -> dict:
Returns:
Empty dictionary.
"""
return self._pipelines_api.delete_pipeline_version_v1(
return self._pipelines_api.delete_pipeline_version(
version_id=version_id)


Expand Down
4 changes: 0 additions & 4 deletions test/presubmit-sdk-execution-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@ python3 -m pip install --upgrade pip
python3 -m pip install $source_root/sdk/python
python3 -m pip install -r $source_root/test/sdk-execution-tests/requirements.txt

# Install KFP server API from commit.
cp -r $source_root/backend/api/v1beta1/python_http_client /python_http_client
python3 -m pip install /python_http_client


export KFP_ENDPOINT="https://$(curl https://raw.githubusercontent.com/kubeflow/testing/master/test-infra/kfp/endpoint)"
export TIMEOUT_SECONDS=2700
Expand Down

0 comments on commit 834bfbe

Please sign in to comment.