Callable executed when returned by dask delayed function
- Dominant language
- Python
- Stars
- 1.7k
- Forks
- 778
- Avg merge
- 2h 50m
- Merged PRs (30d)
- 3
Description
**Describe the issue**:
Callables are erroneously called when returned in a tuple by a dask delayed function when using dask distributed. They are not called when using a local scheduler.
**Minimal Complete Verifiable Example**:
```python
import dask.delayed
import dask.distributed
class A:
def __call__(self, *args, **kargs):
print('Call')
@dask.delayed
def f(x, y):
# If just x is returned, __call__ is not executed
return x, None
a = A()
# But this doesn't execute __call__
with dask.config.set(scheduler='threads'):
dask.delayed(list)([f(a, {'a', f(a, None)})]).compute()
# But this does
client = dask.distributed.Client(n_workers=5, processes=False, memory_limit=0)
dask.delayed(list)([f(a, {'a', f(a, None)})]).compute()
```
**Anything else we need to know?**:
**Environment**:
- Dask version: 2023.3.0
- Python version: 3.11.0
- Operating System: windows
- Install method (conda, pip, source): conda
Contributor guide
Assessment
This issue has not been assessed yet.