question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

distributed.asyncio.AioClient seems to be broken

See original GitHub issue

I am trying to execute distributed.asyncio.AioClient() inside a notebook and expect a future will be returned. However, it appears to be stuck forever.

When I interrupt the kernel I get the following traceback:

---------------------------------------------------------------------------
KeyboardInterrupt                         Traceback (most recent call last)
<ipython-input-2-544e7a0bbcaa> in <module>()
      1 import distributed.asyncio
----> 2 distributed.asyncio.AioClient()

/opt/conda/lib/python3.6/site-packages/distributed/asyncio.py in __init__(self, *args, **kwargs)
     96         loop = asyncio.get_event_loop()
     97         ioloop = BaseAsyncIOLoop(loop)
---> 98         super().__init__(*args, loop=ioloop, asynchronous=True, **kwargs)
     99 
    100     def __enter__(self):

/opt/conda/lib/python3.6/site-packages/distributed/client.py in __init__(self, address, loop, timeout, set_as_default, scheduler_file, security, asynchronous, name, **kwargs)
    553                                      io_loop=self.loop)
    554 
--> 555         self.start(timeout=timeout)
    556 
    557         from distributed.recreate_exceptions import ReplayExceptionClient

/opt/conda/lib/python3.6/site-packages/distributed/client.py in start(self, **kwargs)
    668             self._started = self._start(**kwargs)
    669         else:
--> 670             sync(self.loop, self._start, **kwargs)
    671 
    672     def __await__(self):

/opt/conda/lib/python3.6/site-packages/distributed/utils.py in sync(loop, func, *args, **kwargs)
    250     else:
    251         while not e.is_set():
--> 252             e.wait(1000000)
    253     if error[0]:
    254         six.reraise(*error[0])

/opt/conda/lib/python3.6/threading.py in wait(self, timeout)
    549             signaled = self._flag
    550             if not signaled:
--> 551                 signaled = self._cond.wait(timeout)
    552             return signaled
    553 

/opt/conda/lib/python3.6/threading.py in wait(self, timeout)
    297             else:
    298                 if timeout > 0:
--> 299                     gotit = waiter.acquire(True, timeout)
    300                 else:
    301                     gotit = waiter.acquire(False)

KeyboardInterrupt: 

distributed.utils - ERROR - sync() called from thread of running loop
Traceback (most recent call last):
  File "/opt/conda/lib/python3.6/site-packages/distributed/utils.py", line 235, in f
    raise RuntimeError("sync() called from thread of running loop")
RuntimeError: sync() called from thread of running loop

This part sync(self.loop, self._start, **kwargs) seems like it should not be executed. Also self.asynchronous=True, which seems incorrect.

awaiting the AioClient() also doesn’t work for me.

I’ve tried it on a colleagues computer (@jbweston), our Jupyterhub, and on my MacOS machine, all with the same result.

With distributed version 1.20.2 and dask version 0.16.1.

@mrocklin asked me to ping @kszucs.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:13 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
mrocklincommented, Feb 14, 2018

It’s also worth noting that when tornado 5.0 is released (beta is out now) the tornado IOLoop will be the same as the asyncio event loop, so the need for AioClient should go away at that time.

0reactions
kszucscommented, Apr 1, 2018

See Matthew’s comment, I haven’t tried it though.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cancelling task waiting on event breaks tornado #3908 - GitHub
Closing the client (and perhaps reopening) on each call to a distributed method would affect any other objects currently using the same client....
Read more >
dask/dask - Gitter
Hi everyone, I am trying to use the distributed asyncio client ( AioClient ), but it looks like it still uses processes or...
Read more >
Make the runner work with `asyncio` and inside Jupyter ...
Proof of concept runner that works with asyncio, and inside the notebook, but not in the notebook with the distributed.asyncio.AioClient.
Read more >
Python asyncio - Loop exits with Task was destroyed but it is ...
This is because the discord client module needs control once every minute or so. This means that any function that steals control for...
Read more >
Asynchronous Operation - Dask.distributed
This self-contained example starts an asynchronous client, submits a trivial job, waits on the result, and then shuts down the client. You can...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found