Skip to content

remove docs usage of deprecated asyncio.get_event_loop#6032

Open
graingert wants to merge 2 commits intodask:mainfrom
graingert:remove-docs-usage-of-deprecated-get-event-loop
Open

remove docs usage of deprecated asyncio.get_event_loop#6032
graingert wants to merge 2 commits intodask:mainfrom
graingert:remove-docs-usage-of-deprecated-get-event-loop

Conversation

@graingert
Copy link
Copy Markdown
Member

@graingert graingert commented Mar 31, 2022

and update docs:

  • only Python 3 is supported
  • tornado.ioloop.IOLoop.current() or IOLoop().run_sync is deprecated in favour of asyncio.run
  • avoid loop.run_forever in favour of await asyncio.Event().wait()
  • use async with where possible
  • Closes #xxxx
  • Tests added / passed
  • Passes pre-commit run --all-files

and update docs:

* only Python 3 is supported
* tornado.ioloop.IOLoop.current() is deprecated in favour of asyncio.run
* run_forever uses await asyncio.Event().wait()
* use `async with` where possible
Comment on lines -100 to -102
# Either use Tornado
from tornado.ioloop import IOLoop
IOLoop().run_sync(f)
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the "Either use Tornado" "Or use asyncio" is redundant now that asyncio.run is the recommended approach for starting tornado:

https://github.com/tornadoweb/tornado/blob/3de78b7a15ba7134917a18b0755ea24d7f8fde94/README.rst#hello-world

await comm.write(data)

s = Server({'add': add, 'stream_data': stream_data})
s.listen('tcp://:8888') # listen on TCP port 8888
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s.listen( was changed to be an async def so this didn't work anymore:

async def listen(self, port_or_addr=None, allow_offload=True, **kwargs):
if port_or_addr is None:
port_or_addr = self.default_port
if isinstance(port_or_addr, int):
addr = unparse_host_port(self.default_ip, port_or_addr)
elif isinstance(port_or_addr, tuple):
addr = unparse_host_port(*port_or_addr)
else:
addr = port_or_addr
assert isinstance(addr, str)
listener = await listen(
addr,
self.handle_comm,
deserialize=self.deserialize,
allow_offload=allow_offload,
**kwargs,
)
self.listeners.append(listener)

Comment thread docs/source/foundations.rst Outdated
Comment thread docs/source/foundations.rst Outdated
@graingert graingert marked this pull request as ready for review March 31, 2022 10:20
@github-actions
Copy link
Copy Markdown
Contributor

Unit Test Results

       18 files  ±0         18 suites  ±0   10h 6m 20s ⏱️ + 11m 1s
  2 703 tests ±0    2 616 ✔️  - 5       83 💤 +2  4 +3 
24 163 runs  ±0  22 870 ✔️  - 4  1 289 💤 +2  4 +2 

For more details on these failures, see this check.

Results for commit 97206e2. ± Comparison against base commit 2ff681c.

@mrocklin
Copy link
Copy Markdown
Member

The docs in distributed.docs.org aren't really pointed to anywhere. I'd be comfortable nuking the entire thing. I encourage you to look through docs/ in dask/dask and not spend much time improving docs in this repository. My apologies that you weren't made aware of this before.

@graingert graingert requested a review from fjetter as a code owner January 23, 2024 10:57
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

Successfully merging this pull request may close these issues.

2 participants