Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

import GatewayConnector fails with no event loop #605

Open
vdytyniak-exos opened this issue Sep 15, 2022 · 0 comments
Open

import GatewayConnector fails with no event loop #605

vdytyniak-exos opened this issue Sep 15, 2022 · 0 comments

Comments

@vdytyniak-exos
Copy link

I am trying to import Gateway in a separate thread and it fails with:

Traceback (most recent call last):
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/exos/loop_error.py", line 3, in <module>
    from dask_gateway import Gateway, GatewayCluster
  File "/usr/local/lib/python3.10/site-packages/dask_gateway/__init__.py", line 5, in <module>
    from .client import (
  File "/usr/local/lib/python3.10/site-packages/dask_gateway/client.py", line 25, in <module>
    from . import comm
  File "/usr/local/lib/python3.10/site-packages/dask_gateway/comm.py", line 29, in <module>
    class GatewayConnector(Connector):
  File "/usr/local/lib/python3.10/site-packages/dask_gateway/comm.py", line 31, in GatewayConnector
    _resolver = netutil.ExecutorResolver(close_executor=False, executor=_executor)
  File "/usr/local/lib/python3.10/site-packages/tornado/util.py", line 288, in __new__
    instance.initialize(*args, **init_kwargs)
  File "/usr/local/lib/python3.10/site-packages/tornado/netutil.py", line 427, in initialize
    self.io_loop = IOLoop.current()
  File "/usr/local/lib/python3.10/site-packages/tornado/ioloop.py", line 263, in current
    loop = asyncio.get_event_loop()
  File "/usr/local/lib/python3.10/asyncio/events.py", line 656, in get_event_loop
    raise RuntimeError('There is no current event loop in thread %r.'
RuntimeError: There is no current event loop in thread 'AnyIO worker thread'.

Issue related to GatewayConnector initialisation:

class GatewayConnector(Connector):
    _executor = ThreadPoolExecutor(2)
    _resolver = netutil.ExecutorResolver(close_executor=False, executor=_executor)
    ...

ExecutorResolver tries to IOLoop.current() and fails.

Is it possible to release the fix and don't call IOLoop.current() on import?

Versions:
dask-gateway==2022.6.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant