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

Client.compute doesn't materialize delayed chunk of persisted array if provided as a dict value #8959

Open
jmoralez opened this issue Dec 9, 2024 · 2 comments
Assignees
Labels
bug Something is broken regression

Comments

@jmoralez
Copy link

jmoralez commented Dec 9, 2024

Describe the issue:
When persisting a dask array and trying to compute one of its chunks, the return value is the dask key instead of the computed array if the chunk is provided as a dict value.

Minimal Complete Verifiable Example:

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


if __name__ == '__main__':
    client = Client()
    X = da.random.random((100, 2), chunks=(100, 2)).persist()
    delayed_chunk = X.to_delayed()[0, 0]
    print(type(client.compute(delayed_chunk).result())) # numpy.ndarray
    print(type(client.compute([delayed_chunk])[0].result())) # numpy.ndarray
    print(type(client.compute({'x': delayed_chunk}).result()['x']))  # tuple (the dask key)

Anything else we need to know?:
On 2024.11.2 these all return an array.

Environment:

  • Dask version: 2024.12.0
  • Python version: 3.10.16
  • Operating System: Ubuntu
  • Install method (conda, pip, source): pip install dask[distributed]
@jmoralez jmoralez changed the title Client.compute doesn't materialize delayed array chunk of persisted array if provided as a dict value Client.compute doesn't materialize delayed chunk of persisted array if provided as a dict value Dec 9, 2024
@jrbourbeau
Copy link
Member

Thanks for the issue and nice minimal example @jmoralez -- I'm able to reproduce. @hendrikmakait maybe this is similar to some of the other client.compute task spec stuff you did a week or two ago?

@jrbourbeau jrbourbeau added bug Something is broken and removed needs triage labels Dec 9, 2024
@IzerOnadimQC
Copy link

The breakage is not coming from distributed but dask itself.

I think the responsible commit is dask/dask@5b115c4. I can reproduce the behaviour described above when installing distributed 2024.12.0 along with that particular commit, but installing the previous commit (dask/dask@fe9f453) restores the old behaviour.

@phofl I don't understand these changes well enough to see the issue. Could you please take a look?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is broken regression
Projects
None yet
Development

No branches or pull requests

4 participants