Repository navigation
Fix silent/slow blockwise tmp-dir deletion and get_connected_ids overhead - #84
Merged
Merged
Conversation
…head get_zarr_chunk_path_from_block_index hand-joined block coordinates without accounting for Zarr v3's "c/" chunk-key prefix, so every distributed delete call silently no-opped against a nonexistent path - all real cleanup fell to a single-threaded, unlogged final rmtree that could take many minutes on network storage with millions of chunks. Use the array's own chunk_key_encoding instead, which is correct for both v2 and v3. delete_tmp_dir_blockwise now picks local (thread pool) vs distributed deletion via a rough time estimate based on local cores, num_workers, and an assumed cluster-startup cost, instead of always using one or the other; both zarr and pickle-merge dirs share this same decision. get_connected_ids's post-scipy list-of-sets construction (np.split + set() per component) was itself a bottleneck at ~1.7M components; switched to plain list slicing, which downstream code doesn't need set-ness for.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #84 +/- ##
==========================================
+ Coverage 84.10% 84.21% +0.11%
==========================================
Files 28 28
Lines 4315 4339 +24
==========================================
+ Hits 3629 3654 +25
+ Misses 686 685 -1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
get_zarr_chunk_path_from_block_indexhand-joined block coordinates without accounting for Zarr v3's"c/"chunk-key prefix, so every distributed delete call indelete_tmp_dir_blockwise's zarr branch silently checked a nonexistent path and no-opped. All real cleanup fell to a single-threaded, unlogged finalshutil.rmtree, which could take many minutes on network storage once chunk counts reach into the millions. Now uses the array's ownchunk_key_encoding, correct for both v2 and v3.delete_tmp_dir_blockwisenow picks local (thread pool) vs. distributed deletion via a rough time estimate (local cores / num_workers / an assumed cluster-startup cost) instead of one fixed strategy per dir type; zarr and pickle-merge tmp dirs share the same decision logic.get_connected_ids's post-scipy list-of-sets construction (np.split+set()per component) was itself a bottleneck at real dataset scale (~1.7M components); switched to plain list slicing, which downstream code doesn't need set-ness for.