Skip to content

Commit f63ca2a

Browse files
authored
Allow changing chunk size in merge_per_chunk_storage (#986)
1 parent 74090dd commit f63ca2a

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

strax/context.py

+13-1
Original file line numberDiff line numberDiff line change
@@ -2439,9 +2439,11 @@ def merge_per_chunk_storage(
24392439
run_id: str,
24402440
target: str,
24412441
per_chunked_dependency: str,
2442-
rechunk=True,
24432442
chunk_number_group: ty.Optional[ty.List[ty.List[int]]] = None,
2443+
rechunk=True,
2444+
rechunk_to_mb: int = strax.DEFAULT_CHUNK_SIZE_MB,
24442445
target_frontend_id: ty.Optional[int] = None,
2446+
target_compressor: ty.Optional[str] = None,
24452447
check_is_stored: bool = True,
24462448
):
24472449
"""Merge the per-chunked data from the per-chunked dependency into the target storage."""
@@ -2496,6 +2498,16 @@ def wrapped_loader():
24962498
s_be = source_sf._get_backend(s_be_str)
24972499
md = s_be.get_metadata(s_be_key)
24982500

2501+
if target_compressor is not None:
2502+
self.log.info(f'Changing compressor {md["compressor"]} -> {target_compressor}.')
2503+
md.update({"compressor": target_compressor})
2504+
2505+
if rechunk and md["chunk_target_size_mb"] != rechunk_to_mb:
2506+
self.log.info(
2507+
f'Changing chunk-size: {md["chunk_target_size_mb"]} -> {rechunk_to_mb}.'
2508+
)
2509+
md.update({"chunk_target_size_mb": rechunk_to_mb})
2510+
24992511
loader = s_be.loader(s_be_key)
25002512
try:
25012513
while True:

0 commit comments

Comments
 (0)