Skip to content

Commit

Permalink
Re-adds iterate_on_failure and deprecates it
Browse files Browse the repository at this point in the history
The lib._nvs api needs to be stable so we re-add the iterate_on_failure
argument to not break existing usage.

Instead whenever the argument is passed we issue a warning that it's
deprecated.
  • Loading branch information
IvoDD committed May 23, 2024
1 parent fabc8f7 commit 867d3be
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion python/arcticdb/version_store/_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -1969,6 +1969,7 @@ def list_versions(
symbol: Optional[str] = None,
snapshot: Optional[str] = None,
latest_only: Optional[bool] = False,
iterate_on_failure: Optional[bool] = False,
skip_snapshots: Optional[bool] = False,
) -> List[Dict]:
"""
Expand All @@ -1983,6 +1984,8 @@ def list_versions(
latest_only : `bool`
Only include the latest version for each returned symbol. Has no effect if `snapshot` argument is also
specified.
iterate_on_failure: `bool`
DEPRECATED: Passing this doesn't change behavior
skip_snapshots: `bool`
Don't populate version list with snapshot information.
Can improve performance significantly if there are many snapshots.
Expand All @@ -2009,6 +2012,9 @@ def list_versions(
`List[Dict]`
List of dictionaries describing the discovered versions in the library.
"""
if iterate_on_failure:
log.warning("The iterate_on_failure argument is deprecated and will soon be removed. It's safe to remove since it doesn't change behavior.")

if latest_only and snapshot and not NativeVersionStore._warned_about_list_version_latest_only_and_snapshot:
log.warning("latest_only has no effect when snapshot is specified")
NativeVersionStore._warned_about_list_version_latest_only_and_snapshot = True
Expand Down Expand Up @@ -2268,7 +2274,7 @@ def _prune_previous_versions(
log.info("Done deleting version: {}".format(str(v_info["version"])))

def has_symbol(
self, symbol: str, as_of: Optional[VersionQueryInput] = None
self, symbol: str, as_of: Optional[VersionQueryInput] = None, iterate_on_failure: Optional[bool] = False
) -> bool:
"""
Return True if the 'symbol' exists in this library AND the symbol isn't deleted in the specified as_of.
Expand All @@ -2280,12 +2286,16 @@ def has_symbol(
symbol name
as_of : `Optional[VersionQueryInput]`, default=None
See documentation of `read` method for more details.
iterate_on_failure: `Optional[bool]`, default=False
DEPRECATED: Passing this doesn't change behavior
Returns
-------
`bool`
True if the symbol exists as_of the specified revision, False otherwise.
"""
if iterate_on_failure:
log.warning("The iterate_on_failure argument is deprecated and will soon be removed. It's safe to remove since it doesn't change behavior.")

return (
self._find_version(symbol, as_of=as_of, raise_on_missing=False)
Expand Down

0 comments on commit 867d3be

Please sign in to comment.