Skip to content

Dask hangs instead of erroring when a task requests a resource unknown to workers #7170

Closed

Description

@CorentinJ

Describe the issue:
If a task requires a resource that was not defined in the cluster, said task will hang indefinitely.

Minimal Complete Verifiable Example:

from dask.distributed import Client as DaskClient

dask_client = DaskClient(processes=False)

fut = dask_client.submit(print, "3", resources={"GPU": 1})
print("Waiting for result")
fut.result()

Anything else we need to know?
I find this behavior poor and hard to debug. Wouldn't it be preferable if a warning was displayed or error was thrown? After all, it is possible to check whether or not said resource has been defined:

def is_resource_defined(resource_name: str):
    client = get_client()
    workers_info = client.scheduler_info()["workers"]
    return any(resource_name in worker["resources"] for worker in workers_info.values())

There is also no indication of the issue in the dashboard, only that no worker is available in the graph view.

Environment:

  • Dask version: dask==2022.10.0, distributed==2022.10.0
  • Python version: 3.10.0
  • Operating System: Win10 x64
  • Install method (conda, pip, source): pip

Activity

  1. fjetter commented on Oct 21, 2022

    @fjetter
    Member

    Thanks for your report. This is actually a tricky issue. We cannot simply raise an exception because there are very valid scenarios where workers with a given resource only join after the computation was submitted. Tasks are in the meantime in a "no-worker" state and are waiting. This will indeed look like a deadlock.

    Not showing anything on the dashboard in this case is indeed confusing and concerning. This is something we should look into.
    Even the graph view is not really helpful (particularly since it's off for large graphs)
    image

    Details
    from distributed import Client
    client = Client()
    def inc(x):
        return x+1
    fut = client.submit(inc, 1)
    fut2 = client.submit(inc, fut, resources={"A": 1})
    fut3 = client.submit(inc, fut2)
  2. transferred this issue fromdask/daskon Oct 21, 2022
  3. added
    enhancement
    good second issue
    and removed on Oct 21, 2022
  4. fjetter commented on Oct 21, 2022

    @fjetter
    Member

    See #7171 for a suggestion to improve the dashboard

  5. CorentinJ commented on Oct 21, 2022

    @CorentinJ
    Author

    What about a warning though? Would that still be problematic?

    Thank you for the dashboard improvement

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    diagnosticsenhancementgood second issue

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions