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

l2cache endpoint fails for segments with single level2id #404

Open
unidesigner opened this issue Apr 29, 2022 · 3 comments
Open

l2cache endpoint fails for segments with single level2id #404

unidesigner opened this issue Apr 29, 2022 · 3 comments

Comments

@unidesigner
Copy link

As per discussion here and here. Needs a fix to return a single node graph (no edge).

@bdpedigo
Copy link
Contributor

running into this issue also. is this a desired change to the endpoint or an edge case you dont want to support @fcollman @ceesem ?

@ceesem
Copy link
Collaborator

ceesem commented Oct 12, 2023

I think it's an edge case from not handling an empty list correctly and we should fix it in an upcoming version. However, would you mind pasting a more complete description of the error here just so that the only documentation isn't on a slack channel? Also, I think the issue is with the l2graph endpoint of the pychunkedgraph, not anything to do with the l2 cache service, but I would like to make sure we are all on the same page.

@bdpedigo
Copy link
Contributor

Here's a minimal working example

import caveclient as cc

client = cc.CAVEclient("minnie65_phase3_v1")

root_id = 864691133037423712

print(len(client.chunkedgraph.get_leaves(root_id, stop_layer=2)))

client.chunkedgraph.level2_chunk_graph(root_id)
1
---------------------------------------------------------------------------
HTTPError                                 Traceback (most recent call last)
[/Users/bpedigo/aibs-code/cave-explorer/cave-explorer/experiments/edit_graph_edge_tracking.py](https://file+.vscode-resource.vscode-cdn.net/Users/bpedigo/aibs-code/cave-explorer/cave-explorer/experiments/edit_graph_edge_tracking.py) in line 11
      [220](file:///Users/bpedigo/aibs-code/cave-explorer/cave-explorer/experiments/edit_graph_edge_tracking.py?line=219) root_id = 864691133037423712
      [222](file:///Users/bpedigo/aibs-code/cave-explorer/cave-explorer/experiments/edit_graph_edge_tracking.py?line=221) print(len(client.chunkedgraph.get_leaves(root_id, stop_layer=2)))
---> [224](file:///Users/bpedigo/aibs-code/cave-explorer/cave-explorer/experiments/edit_graph_edge_tracking.py?line=223) client.chunkedgraph.level2_chunk_graph(root_id)

File [~/aibs-code/cave-explorer/cave-explorer/.venv/lib/python3.11/site-packages/caveclient/chunkedgraph.py:671](https://file+.vscode-resource.vscode-cdn.net/Users/bpedigo/aibs-code/cave-explorer/~/aibs-code/cave-explorer/cave-explorer/.venv/lib/python3.11/site-packages/caveclient/chunkedgraph.py:671), in ChunkedGraphClientV1.level2_chunk_graph(self, root_id)
    [669](file:///Users/bpedigo/aibs-code/cave-explorer/cave-explorer/.venv/lib/python3.11/site-packages/caveclient/chunkedgraph.py?line=668) endpoint_mapping["root_id"] = root_id
    [670](file:///Users/bpedigo/aibs-code/cave-explorer/cave-explorer/.venv/lib/python3.11/site-packages/caveclient/chunkedgraph.py?line=669) url = self._endpoints["lvl2_graph"].format_map(endpoint_mapping)
--> [671](file:///Users/bpedigo/aibs-code/cave-explorer/cave-explorer/.venv/lib/python3.11/site-packages/caveclient/chunkedgraph.py?line=670) r = handle_response(self.session.get(url))
    [672](file:///Users/bpedigo/aibs-code/cave-explorer/cave-explorer/.venv/lib/python3.11/site-packages/caveclient/chunkedgraph.py?line=671) return r["edge_graph"]

File [~/aibs-code/cave-explorer/cave-explorer/.venv/lib/python3.11/site-packages/caveclient/base.py:88](https://file+.vscode-resource.vscode-cdn.net/Users/bpedigo/aibs-code/cave-explorer/~/aibs-code/cave-explorer/cave-explorer/.venv/lib/python3.11/site-packages/caveclient/base.py:88), in handle_response(response, as_json, log_warning)
     [86](file:///Users/bpedigo/aibs-code/cave-explorer/cave-explorer/.venv/lib/python3.11/site-packages/caveclient/base.py?line=85) def handle_response(response, as_json=True, log_warning=True):
     [87](file:///Users/bpedigo/aibs-code/cave-explorer/cave-explorer/.venv/lib/python3.11/site-packages/caveclient/base.py?line=86)     """Deal with potential errors in endpoint response and return json for default case"""
---> [88](file:///Users/bpedigo/aibs-code/cave-explorer/cave-explorer/.venv/lib/python3.11/site-packages/caveclient/base.py?line=87)     _raise_for_status(response, log_warning=log_warning)
     [89](file:///Users/bpedigo/aibs-code/cave-explorer/cave-explorer/.venv/lib/python3.11/site-packages/caveclient/base.py?line=88)     _check_authorization_redirect(response)
     [90](file:///Users/bpedigo/aibs-code/cave-explorer/cave-explorer/.venv/lib/python3.11/site-packages/caveclient/base.py?line=89)     if as_json:

File [~/aibs-code/cave-explorer/cave-explorer/.venv/lib/python3.11/site-packages/caveclient/base.py:79](https://file+.vscode-resource.vscode-cdn.net/Users/bpedigo/aibs-code/cave-explorer/~/aibs-code/cave-explorer/cave-explorer/.venv/lib/python3.11/site-packages/caveclient/base.py:79), in _raise_for_status(r, log_warning)
     [71](file:///Users/bpedigo/aibs-code/cave-explorer/cave-explorer/.venv/lib/python3.11/site-packages/caveclient/base.py?line=70)     http_error_msg = "%s Server Error: %s for url: %s content:%s" % (
     [72](file:///Users/bpedigo/aibs-code/cave-explorer/cave-explorer/.venv/lib/python3.11/site-packages/caveclient/base.py?line=71)         r.status_code,
     [73](file:///Users/bpedigo/aibs-code/cave-explorer/cave-explorer/.venv/lib/python3.11/site-packages/caveclient/base.py?line=72)         reason,
     [74](file:///Users/bpedigo/aibs-code/cave-explorer/cave-explorer/.venv/lib/python3.11/site-packages/caveclient/base.py?line=73)         r.url,
     [75](file:///Users/bpedigo/aibs-code/cave-explorer/cave-explorer/.venv/lib/python3.11/site-packages/caveclient/base.py?line=74)         r.content,
     [76](file:///Users/bpedigo/aibs-code/cave-explorer/cave-explorer/.venv/lib/python3.11/site-packages/caveclient/base.py?line=75)     )
     [78](file:///Users/bpedigo/aibs-code/cave-explorer/cave-explorer/.venv/lib/python3.11/site-packages/caveclient/base.py?line=77) if http_error_msg:
---> [79](file:///Users/bpedigo/aibs-code/cave-explorer/cave-explorer/.venv/lib/python3.11/site-packages/caveclient/base.py?line=78)     raise requests.HTTPError(http_error_msg, response=r)
     [80](file:///Users/bpedigo/aibs-code/cave-explorer/cave-explorer/.venv/lib/python3.11/site-packages/caveclient/base.py?line=79) if log_warning:
     [81](file:///Users/bpedigo/aibs-code/cave-explorer/cave-explorer/.venv/lib/python3.11/site-packages/caveclient/base.py?line=80)     warning = r.headers.get("Warning")

HTTPError: 500 Server Error: need at least one array to concatenate for url: https://minnie.microns-daf.com/segmentation/api/v1/table/minnie3_v1/node/864691133037423712/lvl2_graph content:b'{\n  "code": 500,\n  "duration": 23.15545082092285,\n  "message": "need at least one array to concatenate",\n  "timestamp": "2023-10-12 18:28:05.642986",\n  "traceback": [\n    "Traceback (most recent call last):\\n",\n    "  File \\"/usr/local/lib/python3.7/site-packages/flask/app.py\\", line 1820, in full_dispatch_request\\n    rv = self.dispatch_request()\\n",\n    "  File \\"/usr/local/lib/python3.7/site-packages/flask/app.py\\", line 1796, in dispatch_request\\n    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)\\n",\n    "  File \\"/usr/local/lib/python3.7/site-packages/middle_auth_client/decorators.py\\", line 270, in decorated_function\\n    return f(*args, **kwargs)\\n",\n    "  File \\"/usr/local/lib/python3.7/site-packages/middle_auth_client/decorators.py\\", line 388, in decorated_function\\n    return f(*args, **kwargs)\\n",\n    "  File \\"./pychunkedgraph/app/app_utils.py\\", line 50, in decorated_function\\n    return f(*args, **kwargs)\\n",\n    "  File \\"./pychunkedgraph/app/segmentation/v1/routes.py\\", line 563, in handle_get_lvl2_graph\\n    resp = common.handle_get_layer2_graph(table_id, node_id)\\n",\n    "  File \\"./pychunkedgraph/app/segmentation/common.py\\", line 1047, in handle_get_layer2_graph\\n    edge_graph = pathing.get_lvl2_edge_list(cg, int(node_id))\\n",\n    "  File \\"./pychunkedgraph/graph/analysis/pathing.py\\", line 89, in get_lvl2_edge_list\\n    edge_array = np.concatenate(edge_array)\\n",\n    "  File \\"<__array_function__ internals>\\", line 6, in concatenate\\n",\n    "ValueError: need at least one array to concatenate\\n"\n  ]\n}\n'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants