dask / dask/distributed

AttributeError: type object '...' has no attribute '_io_loop' in Actor constructed without a default client

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

Description

see https://github.com/dask/dask-jobqueue/issues/552
when running an actor with a client constructed with `Client(set_as_default=False)` attribute lookup fails with an AttributeError:

```python
import sys
import distributed

class Counter:
""" A simple class to manage an incrementing 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

def main():
with distributed.Client(set_as_default=False) as client:
counter = client.submit(Counter, actor=True).result()
counter.add(1)
print(f"{counter.n=}")

if __name__ == "__main__":
sys.exit(main())
```

```pytb
Traceback (most recent call last):
File "/home/graingert/projects/distributed/foo.py", line 26, in
sys.exit(main())
File "/home/graingert/projects/distributed/foo.py", line 22, in main
counter.add(1)
File "/home/graingert/projects/distributed/distributed/actor.py", line 215, in func
actor_future = ActorFuture(io_loop=self._io_loop)
File "/home/graingert/projects/distributed/distributed/actor.py", line 190, in __getattr__
attr = getattr(self._cls, key)
AttributeError: type object 'Counter' has no attribute '_io_loop'
```

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.