Skip to content

Commit

Permalink
[Runs] Deprecate state arg (#5605)
Browse files Browse the repository at this point in the history
  • Loading branch information
roei3000b committed May 21, 2024
1 parent 3de848d commit 743ea32
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
9 changes: 8 additions & 1 deletion mlrun/db/httpdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -794,7 +794,7 @@ def list_runs(
:param labels: A list of labels to filter by. Label filters work by either filtering a specific value
of a label (i.e. list("key=value")) or by looking for the existence of a given
key (i.e. "key").
:param state: List only runs whose state is specified.
:param state: Deprecated - List only runs whose state is specified (will be removed in 1.9.0)
:param states: List only runs whose state is one of the provided states.
:param sort: Whether to sort the result according to their start time. Otherwise, results will be
returned by their internal order in the DB (order will not be guaranteed).
Expand Down Expand Up @@ -831,6 +831,13 @@ def list_runs(
FutureWarning,
)

if state:
# TODO: Remove this in 1.9.0
warnings.warn(
"'state' is deprecated and will be removed in 1.9.0. Use 'states' instead.",
FutureWarning,
)

if (
not name
and not uid
Expand Down
11 changes: 9 additions & 2 deletions mlrun/projects/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -3727,18 +3727,25 @@ def list_runs(
:param labels: A list of labels to filter by. Label filters work by either filtering a specific value
of a label (i.e. list("key=value")) or by looking for the existence of a given
key (i.e. "key").
:param state: List only runs whose state is specified.
:param state: Deprecated - List only runs whose state is specified.
:param states: List only runs whose state is one of the provided states.
:param sort: Whether to sort the result according to their start time. Otherwise, results will be
returned by their internal order in the DB (order will not be guaranteed).
:param last: Deprecated - currently not used (will be removed in 1.8.0).
:param last: Deprecated - currently not used (will be removed in 1.9.0).
:param iter: If ``True`` return runs from all iterations. Otherwise, return only runs whose ``iter`` is 0.
:param start_time_from: Filter by run start time in ``[start_time_from, start_time_to]``.
:param start_time_to: Filter by run start time in ``[start_time_from, start_time_to]``.
:param last_update_time_from: Filter by run last update time in ``(last_update_time_from,
last_update_time_to)``.
:param last_update_time_to: Filter by run last update time in ``(last_update_time_from, last_update_time_to)``.
"""
if state:
# TODO: Remove this in 1.9.0
warnings.warn(
"'state' is deprecated and will be removed in 1.9.0. Use 'states' instead.",
FutureWarning,
)

db = mlrun.db.get_run_db(secrets=self._secrets)
return db.list_runs(
name,
Expand Down

0 comments on commit 743ea32

Please sign in to comment.