Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Split the concat_zarrs step to avoid very large dask task counts #1034

Merged
merged 1 commit into from
Mar 2, 2023
Merged
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
9 changes: 2 additions & 7 deletions sgkit/io/vcfzarr_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,6 @@ def concat_zarrs_optimized(
# NOTE: that this uses _to_zarr function defined here that is needed to avoid
# race conditions between writing the array contents and its metadata
# see https://github.com/pystatgen/sgkit/pull/486
delayed = [] # do all the rechunking operations in one computation
for var in vars_to_rechunk:
dtype = None
if fix_strings and var in {"variant_id", "variant_allele"}:
Expand Down Expand Up @@ -374,8 +373,7 @@ def concat_zarrs_optimized(
attrs=first_zarr_group[var].attrs.asdict(),
**_to_zarr_kwargs,
)
d = _fuse_delayed(d) # type: ignore[no-untyped-call]
delayed.append(d)
da.compute(_fuse_delayed(d)) # type: ignore[no-untyped-call]

# copy variables that are not rechunked (e.g. sample_id)
for var in vars_to_copy:
Expand Down Expand Up @@ -404,10 +402,7 @@ def concat_zarrs_optimized(
attrs=first_zarr_group[var].attrs.asdict(),
**_to_zarr_kwargs,
)
d = _fuse_delayed(d) # type: ignore[no-untyped-call]
delayed.append(d)

da.compute(*delayed)
da.compute(_fuse_delayed(d)) # type: ignore[no-untyped-call]

# copy unchanged variables and top-level metadata
with zarr.open_group(output) as output_zarr:
Expand Down