Skip to content

Commit

Permalink
replace num_entries with limit for resource history API (#399)
Browse files Browse the repository at this point in the history
  • Loading branch information
jlewitt1 authored Jan 26, 2024
1 parent b75ca5c commit 81f0067
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions runhouse/resources/resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,9 +293,10 @@ def unname(self):
self.delete_configs()
self._name = None

def history(self, num_entries: int = None) -> List[Dict]:
def history(self, limit: int = None) -> List[Dict]:
"""Return the history of the resource, including specific config fields (e.g. blob path) and which runs
have overwritten it."""
have overwritten it.
If ``limit`` is specified, return the last ``limit`` number of entries in the history."""
if not self.rns_address:
raise ValueError("Resource must have a name in order to have a history")

Expand All @@ -306,7 +307,7 @@ def history(self, num_entries: int = None) -> List[Dict]:

resource_uri = rns_client.resource_uri(self.rns_address)
base_uri = f"{rns_client.api_server_url}/resource/history/{resource_uri}"
uri = f"{base_uri}?num_entries={num_entries}" if num_entries else base_uri
uri = f"{base_uri}?limit={limit}" if limit else base_uri

resp = requests.get(uri, headers=rns_client.request_headers())
if resp.status_code != 200:
Expand Down

0 comments on commit 81f0067

Please sign in to comment.