Search code examples
pythonasynchronouspython-asynciodaskdask-distributed

TypeError when awaiting dask futures


I get the following error: TypeError: object list can't be used in 'await' expression

when I try to await futures as dask_client.gather(futures) or await futures.

I am using a Dask Client with asynchronous=True

Tried referring to the official docs https://distributed.dask.org/en/stable/asynchronous.html


Solution

  • Adding asynchronous=True while initialising the dask client is not enough when you want to gather or wait for all futures to finish executing. asynchronous=True argument has to be passed to the gather method as well.

    await dask_client.gather(futures, asynchronous=True)