Open
Description
The LoopRunner
is accepting an event loop that has been created externally. This is a pattern that has been deprecated by CPython and our current implementation.
Requirements
LoopRunner
no longer accepts event loops but creates and owns them itself.- There must still be a way to attach multiple servers (e.g. Scheduler and Client) to the same event loop.
- The
LoopRunner
guarantees that all existingtornado.IOLoop
instances are properly closed if the underlyingasyncio
event loop is stopped when loop is started and stopped without tornado API (e.g.asyncio.run
). - It is not required to implement a deprecation cycle
More context in #6049
Implementation details
# Current interface
class LoopRunner:
def __init__(self, loop=None, asynchronous=False):
...
def start(self):
...
def stop(self, timeout=10):
...
def run_sync(self, func, *args, **kwargs):
...
- always bind the Scheduler to the IOLoop.current() - and deprecate the Scheduler(loop= kwarg #6443
- deprecate the io_loop and loop kwarg to Server, Worker, and Nanny #6473
- port test_local.LocalTest to pytest tests to allow use of loop fixture #6523
- Use loop_in_thread fixture for all tests that use local cluster, client, etc. to make sure they are using the correct event loop
- Deprecate passing a stopped loop to the LoopRunner
- Remove deprecated code after one to two release cycle
Metadata
Metadata
Assignees
Labels
No labels