Skip to content

Commit

Permalink
feat: client gets list_models, too. (#8425)
Browse files Browse the repository at this point in the history
When we added `list_models` to `Determined`, we forgot to add it to
`client`. Meant that users got `Determined.get_models` deprecation
notices (via `client.get_models`) that they couldn't do anything about.

MLG-1301

(cherry picked from commit 2e0a5a2)
  • Loading branch information
wes-turner authored and determined-ci committed Nov 16, 2023
1 parent b8c1be7 commit 9f727fe
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions harness/determined/experimental/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,47 @@ def get_models(
return _determined.get_models(sort_by, order_by, name, description)


@_require_singleton
def list_models(
sort_by: ModelSortBy = ModelSortBy.NAME,
order_by: OrderBy = OrderBy.ASCENDING,
name: Optional[str] = None,
description: Optional[str] = None,
model_id: Optional[int] = None,
workspace_names: Optional[List[str]] = None,
workspace_ids: Optional[List[int]] = None,
) -> List[Model]:
"""Get a list of all models in the model registry.
Arguments:
sort_by: Which field to sort by. See :class:`~determined.experimental.ModelSortBy`.
order_by: Whether to sort in ascending or descending order. See
:class:`~determined.experimental.OrderBy`.
name: If this parameter is set, models will be filtered to only
include models with names matching this parameter.
description: If this parameter is set, models will be filtered to
only include models with descriptions matching this parameter.
model_id: If this parameter is set, models will be filtered to
only include the model with this unique numeric id.
workspace_names: Only return models with names in this list.
workspace_ids: Only return models with workspace IDs in this list.
Returns:
A list of :class:`~determined.experimental.client.Model` objects matching any passed
filters.
"""
assert _determined is not None
return _determined.list_models(
sort_by=sort_by,
order_by=order_by,
name=name,
description=description,
model_id=model_id,
workspace_names=workspace_names,
workspace_ids=workspace_ids,
)


@_require_singleton
def get_model_labels() -> List[str]:
"""Get a list of labels used on any models in the model registry.
Expand Down

0 comments on commit 9f727fe

Please sign in to comment.