ray-project / ray

Ray is an AI compute engine. Ray consists of a core distributed runtime and a set of AI Libraries for accelerating ML workloads.
https://ray.io
Apache License 2.0
34.12k stars 5.79k forks source link

[Util] Cannot import Dask scheduler #48689

Open camposandro opened 1 week ago

camposandro commented 1 week ago

What happened + What you expected to happen

One of the latest Dask releases (v2024.11.0) removed the _execute_task method from its core module in favor of execute_graph (https://github.com/dask/dask/commit/a0783a8d46ffa0203906c47c7495a7e5bc09e691). The dask on ray scheduler implementation currently needs it: https://github.com/ray-project/ray/blob/3141dfe4031cc715515b365278cd1d6b8955154e/python/ray/util/dask/scheduler.py#L12-L12

This behavior was detected in a smoke test run for hats-import.

ImportError while loading conftest '/home/runner/work/hats-import/hats-import/tests/conftest.py'.
tests/conftest.py:8: in <module>
    from ray.util.dask import disable_dask_on_ray, enable_dask_on_ray
/opt/hostedtoolcache/Python/3.11.10/x64/lib/python3.11/site-packages/ray/util/dask/__init__.py:2: in <module>
    from .scheduler import (
/opt/hostedtoolcache/Python/3.11.10/x64/lib/python3.11/site-packages/ray/util/dask/scheduler.py:12: in <module>
    from dask.core import istask, ishashable, _execute_task
E   ImportError: cannot import name '_execute_task' from 'dask.core' (/opt/hostedtoolcache/Python/3.11.10/x64/lib/python3.11/site-packages/dask/core.py)

Versions / Dependencies

ray==2.38.0 dask==2024.11.1 dask-expr==1.1.18 distributed==2024.11.1

Reproduction script

from ray.util.dask import disable_dask_on_ray, enable_dask_on_ray

Issue Severity

High: It blocks me from completing my task.

Superskyyy commented 2 days ago

How does one use the new execute_graph api? @camposandro I'm not familiar with Dask so please point me to the doc or better migration doc if theres one.

camposandro commented 2 days ago

Hi @Superskyyy! Unfortunately I could not find useful documentation on how to use this new task specification. From my understanding we can resort to convert_legacy_graph, as shown here, to achieve the same behavior. The downside is that this new _task_spec module being private could undergo other unexpected breaking changes.

Superskyyy commented 2 days ago

Hi @Superskyyy! Unfortunately I could not find useful documentation on how to use this new task specification. From my understanding we can resort to convert_legacy_graph, as shown here, to achieve the same behavior. The downside is that this new _task_spec module being private could undergo other unexpected breaking changes.

Thanks! I will take a look at it.