Skip to content

Server error when calling pcg_skel.coord_space_meshwork #28

@yzerlaut

Description

@yzerlaut

Dear Allen Institute team,

(I am aware that I should not expect active support for this, but I just document the issue in case that would be useful)

I would like to create skeletons for a few interneurons of the EM dataset and I get a server error when calling pcg_skel.coord_space_meshwork.

The minimal working example to reproduce the error is the following:

from meshparty import meshwork
import pcg_skel
from caveclient import CAVEclient

datastack_name = 'minnie65_public_v343' 
client = CAVEclient(datastack_name)
client.materialize.version = 343

bpc_mw = pcg_skel.coord_space_meshwork(
    root_id=864691136008567724, # the bipolar cell of the tutorial
    client=client
)

The output/error is the following:

/home/yann.zerlaut/miniconda3/envs/allen/lib/python3.8/site-packages/caveclient/l2cache.py:78: UserWarning: L2Cache is in an experimental stage
  warnings.warn("L2Cache is in an experimental stage", UserWarning)

---------------------------------------------------------------------------
HTTPError                                 Traceback (most recent call last)
Cell In [1], line 9
      6 client = CAVEclient(datastack_name)
      7 client.materialize.version = 343
----> 9 bpc_mw = pcg_skel.coord_space_meshwork(
     10     root_id=864691136008567724, # the bipolar cell of the tutorial
     11     client=client
     12 )

File ~/miniconda3/envs/allen/lib/python3.8/site-packages/pcg_skel/pcg_skel.py:665, in coord_space_meshwork(root_id, datastack_name, client, cv, root_point, root_point_resolution, collapse_soma, collapse_radius, synapses, synapse_table, remove_self_synapse, live_query, timestamp, invalidation_d, require_complete)
    662 if root_point_resolution is None:
    663     root_point_resolution = cv.mip_resolution(0)
--> 665 sk, mesh, (l2dict_mesh, l2dict_mesh_r) = coord_space_skeleton(
    666     root_id,
    667     client=client,
    668     cv=cv,
    669     root_point=root_point,
    670     root_point_resolution=root_point_resolution,
    671     collapse_soma=collapse_soma,
    672     collapse_radius=collapse_radius,
    673     invalidation_d=invalidation_d,
    674     return_mesh=True,
    675     return_l2dict_mesh=True,
    676     require_complete=require_complete,
    677 )
    679 nrn = meshwork.Meshwork(mesh, seg_id=root_id, skeleton=sk)
    681 pre, post = False, False

File ~/miniconda3/envs/allen/lib/python3.8/site-packages/pcg_skel/pcg_skel.py:125, in coord_space_skeleton(root_id, client, datastack_name, cv, invalidation_d, return_mesh, return_l2dict, return_l2dict_mesh, root_point, root_point_resolution, collapse_soma, collapse_radius, nan_rounds, require_complete)
    122 if root_point is not None:
    123     root_point = np.array(root_point) * root_point_resolution
--> 125 mesh, l2dict_mesh, l2dict_r_mesh = coord_space_mesh(
    126     root_id,
    127     client=client,
    128     return_l2dict=True,
    129     nan_rounds=nan_rounds,
    130     require_complete=require_complete,
    131 )
    133 metameta = {"space": "l2cache", "datastack": client.datastack_name}
    134 sk = skeletonize.skeletonize_mesh(
    135     mesh,
    136     invalidation_d=invalidation_d,
   (...)
    147     },
    148 )

File ~/miniconda3/envs/allen/lib/python3.8/site-packages/pcg_skel/pcg_skel.py:78, in coord_space_mesh(root_id, client, cv, return_l2dict, nan_rounds, require_complete)
     75     cv = client.info.segmentation_cloudvolume(progress=False)
     77 lvl2_eg = client.chunkedgraph.level2_chunk_graph(root_id)
---> 78 eg, l2dict_mesh, l2dict_r_mesh, x_ch = build_spatial_graph(
     79     lvl2_eg,
     80     cv,
     81     client=client,
     82     method="service",
     83     require_complete=require_complete,
     84 )
     85 mesh_loc = trimesh_io.Mesh(
     86     vertices=x_ch,
     87     faces=[[0, 0, 0]],  # Some functions fail if no faces are set.
     88     link_edges=eg,
     89 )
     91 sk_utils.fix_nan_verts_mesh(mesh_loc, nan_rounds)

File ~/miniconda3/envs/allen/lib/python3.8/site-packages/pcg_skel/pcg_skel.py:57, in build_spatial_graph(lvl2_edge_graph, cv, client, method, require_complete)
     55     x_ch = [np.array(cv.mesh.meta.meta.decode_chunk_position(l)) for l in lvl2_ids]
     56 elif method == "service":
---> 57     x_ch = chunk_tools.dense_spatial_lookup(
     58         lvl2_ids,
     59         eg_arr_rm,
     60         client,
     61         require_complete=require_complete,
     62     )
     63 return eg_arr_rm, l2dict, l2dict_reversed, x_ch

File ~/miniconda3/envs/allen/lib/python3.8/site-packages/pcg_skel/chunk_tools.py:23, in dense_spatial_lookup(l2ids, eg, client, require_complete)
     21 def dense_spatial_lookup(l2ids, eg, client, require_complete=False):
     22     l2means = np.full((len(l2ids), 3), np.nan)
---> 23     locs, inds_found = chunk_cache.get_locs_remote(l2ids, client)
     24     if require_complete:
     25         if not np.all(inds_found):

File ~/miniconda3/envs/allen/lib/python3.8/site-packages/pcg_skel/chunk_cache.py:10, in get_locs_remote(l2_ids, client)
      8 def get_locs_remote(l2_ids, client):
      9     """Retrieve ids from the l2 cache service"""
---> 10     l2_info = client.l2cache.get_l2data(list(l2_ids), attributes=[POSITION_ATTRIBUTE])
     11     l2loc = [l2_info[str(l2id)].get(POSITION_ATTRIBUTE, None) for l2id in l2_ids]
     13     l2means = np.array([x for x in l2loc if x is not None])

File ~/miniconda3/envs/allen/lib/python3.8/site-packages/caveclient/l2cache.py:111, in L2CacheClientLegacy.get_l2data(self, l2_ids, attributes)
    101 url = self._endpoints["l2cache_data"].format_map(endpoint_mapping)
    103 response = self.session.post(
    104     url,
    105     data=json.dumps(
   (...)
    109     params=query_d,
    110 )
--> 111 return handle_response(response)

File ~/miniconda3/envs/allen/lib/python3.8/site-packages/caveclient/base.py:78, in handle_response(response, as_json)
     76 def handle_response(response, as_json=True):
     77     """Deal with potential errors in endpoint response and return json for default case"""
---> 78     _raise_for_status(response)
     79     _check_authorization_redirect(response)
     80     if as_json:

File ~/miniconda3/envs/allen/lib/python3.8/site-packages/caveclient/base.py:70, in _raise_for_status(r)
     62     http_error_msg = "%s Server Error: %s for url: %s content:%s" % (
     63         r.status_code,
     64         reason,
     65         r.url,
     66         r.content,
     67     )
     69 if http_error_msg:
---> 70     raise requests.HTTPError(http_error_msg, response=r)
     71 warning = r.headers.get("Warning")
     72 if warning:

HTTPError: 500 Server Error: INTERNAL SERVER ERROR for url: https://minnie.microns-daf.com/l2cache/api/v1/table/minnie65_public_v343/attributes?int64_as_str=False&attribute_names=rep_coord_nm content:b'{\n  "code": 500,\n  "duration": 1.9135475158691406,\n  "message": "Dataset minnie65_public_v343 does not have an L2 Cache.",\n  "timestamp": "2022-10-07 14:35:56.882805",\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 265, in decorated_function\\n    return f(*args, **kwargs)\\n",\n    "  File \\"/usr/local/lib/python3.7/site-packages/middle_auth_client/decorators.py\\", line 397, in decorated_function\\n    return f(*args, **kwargs)\\n",\n    "  File \\"./pcgl2cache/app/v1/routes.py\\", line 27, in decorated_function\\n    return f(*args, **kwargs)\\n",\n    "  File \\"./pcgl2cache/app/v1/routes.py\\", line 94, in attributes\\n    common.handle_attributes(table_id), int64_as_str=int64_as_str\\n",\n    "  File \\"./pcgl2cache/app/common.py\\", line 162, in handle_attributes\\n    cache_client = get_l2cache_client(graph_id)\\n",\n    "  File \\"./pcgl2cache/app/utils.py\\", line 47, in get_l2cache_client\\n    assert graph_id in l2cache_config, f\\"Dataset {graph_id} does not have an L2 Cache.\\"\\n",\n    "AssertionError: Dataset minnie65_public_v343 does not have an L2 Cache.\\n"\n  ]\n}\n'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions