dask / dask/distributed

ActorFuture doesn't work with `as_completed(...)`

Open
#3,978 0 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

**What happened**:
Running:
```python
class Counter:
n = 0

def __init__(self):
self.n = 0

def increment(self):
self.n += 1
return self.n

def add(self, x):
self.n += x
return self.n

future = client.submit(Counter, actor=True)
counter = future.result()

futures = []
for num in [0, 1, 2]:
futures.append(counter.add(num))

for future in as_completed(futures):
print(future.result())
```

yielded the error:

```python
TypeError: Input must be a future, got
```

**What you expected to happen**:
It to not raise an error (and print 0, 1, 3).

**Anything else we need to know?**:

I was able to fix my problem by commenting out [these 2 liines](https://github.com/dask/distributed/blob/6eab3ce464e9ff79e4192de4f1c778d3ef89379b/distributed/client.py#L4382-L4383).

I have submitted a pull request, #3979, to fix this (in a slightly cleverer way than just commenting about validation checks).

**Environment**:

- Dask version: master
- Python version: v3.8.4
- Operating System: Ubuntu
- Install method (conda, pip, source): conda

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.