From 282786c37f4e04dc4256a1c72dca05dc016c6d3b Mon Sep 17 00:00:00 2001 From: Forrest Collman Date: Tue, 24 Oct 2023 07:45:13 +0900 Subject: [PATCH 1/4] add expired boolean to get_verisons --- caveclient/materializationengine.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/caveclient/materializationengine.py b/caveclient/materializationengine.py index a4452a25..aa950ae5 100644 --- a/caveclient/materializationengine.py +++ b/caveclient/materializationengine.py @@ -292,7 +292,7 @@ def most_recent_version(self, datastack_name=None): versions = self.get_versions(datastack_name=datastack_name) return np.max(np.array(versions)) - def get_versions(self, datastack_name=None): + def get_versions(self, datastack_name=None, expired=False): """get versions available Args: @@ -303,7 +303,8 @@ def get_versions(self, datastack_name=None): endpoint_mapping = self.default_url_mapping endpoint_mapping["datastack_name"] = datastack_name url = self._endpoints["versions"].format_map(endpoint_mapping) - response = self.session.get(url) + query_args = {"expired": expired} + response = self.session.get(url, params=query_args) self.raise_for_status(response) return response.json() From ac134eaba64db91be4184f4ca732bba32352dcef Mon Sep 17 00:00:00 2001 From: Forrest Collman Date: Tue, 24 Oct 2023 07:48:34 +0900 Subject: [PATCH 2/4] add expired flag to get all metatada --- caveclient/materializationengine.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/caveclient/materializationengine.py b/caveclient/materializationengine.py index aa950ae5..f9260bd6 100644 --- a/caveclient/materializationengine.py +++ b/caveclient/materializationengine.py @@ -423,11 +423,12 @@ def get_timestamp(self, version: int = None, datastack_name: str = None): return convert_timestamp(meta["time_stamp"]) @cached(cache=TTLCache(maxsize=100, ttl=60 * 60 * 12)) - def get_versions_metadata(self, datastack_name=None): + def get_versions_metadata(self, datastack_name=None, expired=False): """get the metadata for all the versions that are presently available and valid Args: datastack_name (str, optional): datastack to query. If None, defaults to the value set in the client. + expired (bool, optional): whether to include expired versions. Defaults to False. Returns: list[dict]: a list of metadata dictionaries @@ -437,7 +438,8 @@ def get_versions_metadata(self, datastack_name=None): endpoint_mapping = self.default_url_mapping endpoint_mapping["datastack_name"] = datastack_name url = self._endpoints["versions_metadata"].format_map(endpoint_mapping) - response = self.session.get(url) + query_args = {"expired": expired} + response = self.session.get(url, params=query_args) d = handle_response(response) for md in d: md["time_stamp"] = convert_timestamp(md["time_stamp"]) From ff6cd8af687ef2541c926c259d81cf7ed47b7b7f Mon Sep 17 00:00:00 2001 From: Forrest Collman Date: Tue, 24 Oct 2023 08:04:55 +0900 Subject: [PATCH 3/4] change endpoints --- caveclient/endpoints.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/caveclient/endpoints.py b/caveclient/endpoints.py index 34340212..81cf9a77 100644 --- a/caveclient/endpoints.py +++ b/caveclient/endpoints.py @@ -61,15 +61,15 @@ "join_query": mat_v3_api + "/datastack/{datastack_name}/version/{version}/query", "table_count": mat_v2_api + "/datastack/{datastack_name}/version/{version}/table/{table_name}/count", - "versions": mat_v2_api + "/datastack/{datastack_name}/versions", - "version_metadata": mat_v2_api + "/datastack/{datastack_name}/version/{version}", + "versions": mat_v3_api + "/datastack/{datastack_name}/versions", + "version_metadata": mat_v3_api + "/datastack/{datastack_name}/version/{version}", "tables": mat_v2_api + "/datastack/{datastack_name}/version/{version}/tables", "metadata": mat_v3_api + "/datastack/{datastack_name}/version/{version}/table/{table_name}/metadata", "all_tables_metadata": mat_v3_api + "/datastack/{datastack_name}/version/{version}/tables/metadata", - "versions_metadata": mat_v2_api + "/datastack/{datastack_name}/metadata", - "ingest_annotation_table": mat_v2_api + "versions_metadata": mat_v3_api + "/datastack/{datastack_name}/metadata", + "ingest_annotation_table": mat_v3_api + "/materialize/run/ingest_annotations/datastack/{datastack_name}/{table_name}", "segmentation_metadata": mat_v3_api + "/datastack/{datastack_name}/table/{table_name}/segmentation_metadata", From c25fe28f05836dd01b0d1149eee22729fad828bd Mon Sep 17 00:00:00 2001 From: Forrest Collman Date: Tue, 24 Oct 2023 08:08:13 +0900 Subject: [PATCH 4/4] fix ingest_annotation_table endpoint --- caveclient/endpoints.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/caveclient/endpoints.py b/caveclient/endpoints.py index 81cf9a77..a5f3644b 100644 --- a/caveclient/endpoints.py +++ b/caveclient/endpoints.py @@ -69,7 +69,7 @@ "all_tables_metadata": mat_v3_api + "/datastack/{datastack_name}/version/{version}/tables/metadata", "versions_metadata": mat_v3_api + "/datastack/{datastack_name}/metadata", - "ingest_annotation_table": mat_v3_api + "ingest_annotation_table": mat_v2_api + "/materialize/run/ingest_annotations/datastack/{datastack_name}/{table_name}", "segmentation_metadata": mat_v3_api + "/datastack/{datastack_name}/table/{table_name}/segmentation_metadata",