dask / dask/distributed

async Client with sync LocalCluster

Open
#3,789 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
1.7k
Forks
778
Avg merge
2h 50m
Merged PRs (30d)
3

Description

When a Client is passed a LocalCluster and the asynchronous=True flag, it silently ignores the explicit flag and gets it from the cluster instead.

```python
>>> cluster = await distributed.LocalCluster(asynchronous=True)
>>> client = await distributed.Client(cluster, asynchronous=True)
>>> client.asynchronous
True
>>> cluster = distributed.LocalCluster()
>>> client = await distributed.Client(cluster, asynchronous=True)
>>> client.asynchronous
False
>>> cluster = distributed.LocalCluster()
>>> client = await distributed.Client(cluster.scheduler.address, asynchronous=True)
>>> client.asynchronous
True
```
The same happens for an eventual explicit loop parameter.
Both issues are caused by these lines, which cause Client.loop to be forced to match Client.cluster.loop:
https://github.com/dask/distributed/blob/9f91653398aee681ba0010b1053f3bd1b415894b/distributed/client.py#L647-L653

I see in the code how a few things will break if the client and client.cluster end up having two different event loops. Not sure what the correct solution would be?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.