Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 3 additions & 1 deletion pychunkedgraph/app/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,9 @@ def after_request(response):
):
return response

response.data = compression.gzip_compress(response.data)
# Level 1: at the default 9, gzip took 0.4 s of a 0.5 s million-id answer,
# for 9% fewer bytes.
response.data = compression.gzip_compress(response.data, compresslevel=1)
response.headers["Content-Encoding"] = "gzip"
response.headers["Vary"] = "Accept-Encoding"
response.headers["Content-Length"] = len(response.data)
Expand Down
5 changes: 5 additions & 0 deletions pychunkedgraph/app/segmentation/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -734,6 +734,9 @@ def handle_leaves_many(table_id):

node_ids = np.array(json.loads(request.data)["node_ids"], dtype=np.uint64)
stop_layer = int(request.args.get("stop_layer", 1))
counts_only = request.args.get(
"counts_only", default=False, type=app_utils.toboolean
)

# Call ChunkedGraph
cg = app_utils.get_cg(table_id)
Expand All @@ -747,6 +750,8 @@ def handle_leaves_many(table_id):
return_flattened=True,
)

if counts_only:
return {node: len(leaves) for node, leaves in node_to_leaves_mapping.items()}
return node_to_leaves_mapping


Expand Down
Loading