Skip to content

Commit

Permalink
[API] Allow sorting pipelines when specifying project (mlrun#3310)
Browse files Browse the repository at this point in the history
  • Loading branch information
alonmr committed Mar 22, 2023
1 parent 7d8811c commit 98f4370
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions mlrun/api/crud/pipelines.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ def list_pipelines(
format_: mlrun.api.schemas.PipelinesFormat = mlrun.api.schemas.PipelinesFormat.metadata_only,
page_size: typing.Optional[int] = None,
) -> typing.Tuple[int, typing.Optional[int], typing.List[dict]]:
if project != "*" and (page_token or page_size or sort_by):
if project != "*" and (page_token or page_size):
raise mlrun.errors.MLRunInvalidArgumentError(
"Filtering by project can not be used together with pagination, or sorting"
"Filtering by project can not be used together with pagination"
)
if format_ == mlrun.api.schemas.PipelinesFormat.summary:
# we don't support summary format in list pipelines since the returned runs doesn't include the workflow
Expand All @@ -73,6 +73,7 @@ def list_pipelines(
response = kfp_client._run_api.list_runs(
page_token=page_token,
page_size=mlrun.api.schemas.PipelinesPagination.max_page_size,
sort_by=sort_by,
filter=filter_ if page_token == "" else "",
)
run_dicts.extend([run.to_dict() for run in response.runs or []])
Expand Down
4 changes: 2 additions & 2 deletions mlrun/db/httpdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -1425,9 +1425,9 @@ def list_pipelines(
:param page_size: Size of a single page when applying pagination.
"""

if project != "*" and (page_token or page_size or sort_by):
if project != "*" and (page_token or page_size):
raise mlrun.errors.MLRunInvalidArgumentError(
"Filtering by project can not be used together with pagination, or sorting"
"Filtering by project can not be used together with pagination"
)
params = {
"namespace": namespace,
Expand Down

0 comments on commit 98f4370

Please sign in to comment.