Skip to content

Commit

Permalink
Cancel usage of chunk_number if loading the whole dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
dachengx committed Sep 24, 2024
1 parent 4b823ac commit 92f6581
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions strax/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -2392,14 +2392,18 @@ def merge_per_chunk_storage(

self._check_merge_per_chunk_storage_kwargs(run_id, target, target_frontend_id)

chunks = self.get_metadata(run_id, per_chunked_dependency)["chunks"]
if chunk_number_group is not None:
combined_chunk_numbers = list(itertools.chain(*chunk_number_group))
if len(combined_chunk_numbers) != len(set(combined_chunk_numbers)):
raise ValueError(f"Duplicate chunk numbers found in {chunk_number_group}")
_chunk_number = {per_chunked_dependency: combined_chunk_numbers}
if min(combined_chunk_numbers) == 0 and max(combined_chunk_numbers) == len(chunks) - 1:
# If the chunks are all the chunks of the dependency, we can drop the chunk_number
_chunk_number = None
else:
_chunk_number = {per_chunked_dependency: combined_chunk_numbers}
else:
# if no chunk numbers are given, use information from the dependency
chunks = self.get_metadata(run_id, per_chunked_dependency)["chunks"]
chunk_number_group = [[c["chunk_i"]] for c in chunks]
_chunk_number = None

Expand Down

0 comments on commit 92f6581

Please sign in to comment.