Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skeleton dev3 #289

Merged
merged 6 commits into from
Dec 17, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Added deprecation TODO comments to bulk async skeleton GET endpoints.
kebwi committed Dec 16, 2024
commit 00a9301a4d66033174078cf00c6a81941cbf9534
4 changes: 4 additions & 0 deletions caveclient/endpoints.py
Original file line number Diff line number Diff line change
@@ -320,8 +320,12 @@
+ "/{datastack_name}/bulk/get_skeletons/{output_format}/{gen_missing_sks}/{root_ids}",
"get_bulk_skeletons_via_skvn_rids": skeleton_v1
+ "/{datastack_name}/bulk/get_skeletons/{skeleton_version}/{output_format}/{gen_missing_sks}/{root_ids}",
# DEPRECATED: This endpoint is deprecated and will be removed in the future.
# Please use the POST endpoint in the future.
"gen_bulk_skeletons_via_rids": skeleton_v1
+ "/{datastack_name}/bulk/gen_skeletons/{root_ids}",
# DEPRECATED: This endpoint is deprecated and will be removed in the future.
# Please use the POST endpoint in the future.
"gen_bulk_skeletons_via_skvn_rids": skeleton_v1
+ "/{datastack_name}/bulk/gen_skeletons/{skeleton_version}/{root_ids}",
"gen_bulk_skeletons_via_rids_as_post": skeleton_v1
4 changes: 3 additions & 1 deletion caveclient/skeletonservice.py
Original file line number Diff line number Diff line change
@@ -307,19 +307,21 @@

endpoint_mapping = self.default_url_mapping
endpoint_mapping["datastack_name"] = datastack_name
if not post:

Check warning on line 310 in caveclient/skeletonservice.py

Codecov / codecov/patch

caveclient/skeletonservice.py#L310

Added line #L310 was not covered by tests
# DEPRECATED: This endpoint is deprecated and will be removed in the future.
# Please use the POST endpoint in the future.
endpoint_mapping["root_ids"] = ",".join([str(v) for v in root_ids])

Check warning on line 313 in caveclient/skeletonservice.py

Codecov / codecov/patch

caveclient/skeletonservice.py#L313

Added line #L313 was not covered by tests

if not skeleton_version:
endpoint = "gen_bulk_skeletons_via_rids"

Check warning on line 316 in caveclient/skeletonservice.py

Codecov / codecov/patch

caveclient/skeletonservice.py#L315-L316

Added lines #L315 - L316 were not covered by tests
else:
endpoint_mapping["skeleton_version"] = skeleton_version
endpoint = "gen_bulk_skeletons_via_skvn_rids"

Check warning on line 319 in caveclient/skeletonservice.py

Codecov / codecov/patch

caveclient/skeletonservice.py#L318-L319

Added lines #L318 - L319 were not covered by tests
else:
if not skeleton_version:
endpoint = "gen_bulk_skeletons_via_rids_as_post"

Check warning on line 322 in caveclient/skeletonservice.py

Codecov / codecov/patch

caveclient/skeletonservice.py#L321-L322

Added lines #L321 - L322 were not covered by tests
else:
endpoint = "gen_bulk_skeletons_via_skvn_rids_as_post"

Check warning on line 324 in caveclient/skeletonservice.py

Codecov / codecov/patch

caveclient/skeletonservice.py#L324

Added line #L324 was not covered by tests

url = self._endpoints[endpoint].format_map(endpoint_mapping)
return url
@@ -703,7 +705,7 @@
root_ids = root_ids[:MAX_BULK_ASYNCHRONOUS_SKELETONS]

# TODO: I recently converted this function to a batched approach to alleviate sending a long URL of root_ids via GET,
# but has since converted the call to POST, which probably obviates the need for the considerably more complex batch handling.
# but have since converted the call to POST, which probably obviates the need for the considerably more complex batch handling.
# So consider reverting to the unbatched approach in the future.

estimated_async_time_secs_upper_bound_sum = 0
@@ -713,12 +715,12 @@
url = self._build_bulk_async_endpoint(
rids_one_batch, datastack_name, skeleton_version, post=True
)
data = {

Check warning on line 718 in caveclient/skeletonservice.py

Codecov / codecov/patch

caveclient/skeletonservice.py#L718

Added line #L718 was not covered by tests
"root_ids": rids_one_batch,
"skeleton_version": skeleton_version,
}
response = self.session.post(url, json=data)
response = handle_response(response, as_json=False)

Check warning on line 723 in caveclient/skeletonservice.py

Codecov / codecov/patch

caveclient/skeletonservice.py#L722-L723

Added lines #L722 - L723 were not covered by tests

estimated_async_time_secs_upper_bound = float(response.text)
estimated_async_time_secs_upper_bound_sum += (
@@ -750,7 +752,7 @@
# else:
# estimate_time_str = f"{(estimated_async_time_secs_upper_bound_sum / 86400):.2f} days"

logging.info(

Check warning on line 755 in caveclient/skeletonservice.py

Codecov / codecov/patch

caveclient/skeletonservice.py#L755

Added line #L755 was not covered by tests
f"Upper estimate to generate all {len(root_ids)} skeletons: {estimate_time_str}"
)
return estimated_async_time_secs_upper_bound_sum

Check warning on line 758 in caveclient/skeletonservice.py

Codecov / codecov/patch

caveclient/skeletonservice.py#L758

Added line #L758 was not covered by tests