Dask: calling da.to_zarr with compute=True

Hi,

Could you tell me please if calling da.to_zarr with compute=True computes all previous operations (e.g. transpose, convolve)?

Best regards,
Aliaksei

@aliaksei-chareshneu Welcome to Discourse!

Could you tell me please if calling da.to_zarr with compute=True computes all previous operations (e.g. transpose, convolved)?

That’s correct, and compute=True is also the default for to_zarr. If you specify compute=False, it will return a Delayed object which you then need to compute to execute all previous operations including the to_zarr.

Example:

import dask.array as da
from dask.distributed import Client

client = Client()
client

s = da.ones((10, 1), chunks=(1, 1))
s1 = s + s.T

da.to_zarr(s1, url="my_zarr_files_computed") # see the dashboard, also files will be present in the directory

f = da.to_zarr(s1, url="my_zarr_files_not_yet_computed", compute=False) # no files in the directory
f.compute() # files will appear
1 Like