Skip to content

make_current/clear_current are deprecated in Tornado #6784

@QuLogic

Description

@QuLogic

What happened:
make_current and clear_current appear to be deprecated in Tornado 6.2, which causes errors in tests, since warnings are treated as errors. Though it's my mistake that I left that on, it's probably something that should be fixed soonish.

_______________________ test_loop_started_in_constructor _______________________

cleanup = None

    def test_loop_started_in_constructor(cleanup):
        # test that SpecCluster.__init__ starts a loop in another thread
>       cluster = SpecCluster(worker_spec, scheduler=scheduler, loop=None)

../../BUILDROOT/python-distributed-2022.7.1-1.fc37.x86_64/usr/lib/python3.11/site-packages/distributed/deploy/tests/test_spec_cluster.py:87: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../BUILDROOT/python-distributed-2022.7.1-1.fc37.x86_64/usr/lib/python3.11/site-packages/distributed/deploy/spec.py:255: in __init__
    super().__init__(
../../BUILDROOT/python-distributed-2022.7.1-1.fc37.x86_64/usr/lib/python3.11/site-packages/distributed/deploy/cluster.py:67: in __init__
    self._loop_runner = LoopRunner(loop=loop, asynchronous=asynchronous)
../../BUILDROOT/python-distributed-2022.7.1-1.fc37.x86_64/usr/lib/python3.11/site-packages/distributed/utils.py:440: in __init__
    self._loop = IOLoop()
/usr/lib64/python3.11/site-packages/tornado/util.py:276: in __new__
    instance.initialize(*args, **init_kwargs)
/usr/lib64/python3.11/site-packages/tornado/platform/asyncio.py:339: in initialize
    super().initialize(**kwargs)
/usr/lib64/python3.11/site-packages/tornado/platform/asyncio.py:140: in initialize
    super().initialize(**kwargs)
/usr/lib64/python3.11/site-packages/tornado/ioloop.py:350: in initialize
    self.make_current()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <tornado.platform.asyncio.AsyncIOLoop object at 0x7fb8eff84690>

    def make_current(self) -> None:
>       warnings.warn(
            "make_current is deprecated; start the event loop first",
            DeprecationWarning,
            stacklevel=2,
        )
E       DeprecationWarning: make_current is deprecated; start the event loop first

/usr/lib64/python3.11/site-packages/tornado/platform/asyncio.py:353: DeprecationWarning
_____________________ test_client_async_before_loop_starts _____________________

cleanup = None

    def test_client_async_before_loop_starts(cleanup):
        async def close():
            async with client:
                pass
    
>       with pristine_loop() as loop:

../../BUILDROOT/python-distributed-2022.7.1-1.fc37.x86_64/usr/lib/python3.11/site-packages/distributed/tests/test_client.py:5540: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/usr/lib64/python3.11/contextlib.py:137: in __enter__
    return next(self.gen)
../../BUILDROOT/python-distributed-2022.7.1-1.fc37.x86_64/usr/lib/python3.11/site-packages/distributed/utils_test.py:222: in pristine_loop
    IOLoop.clear_instance()
/usr/lib64/python3.11/site-packages/tornado/ioloop.py:227: in clear_instance
    IOLoop.clear_current()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

    @staticmethod
    def clear_current() -> None:
        """Clears the `IOLoop` for the current thread.
    
        Intended primarily for use by test frameworks in between tests.
    
        .. versionchanged:: 5.0
           This method also clears the current `asyncio` event loop.
        .. deprecated:: 6.2
        """
>       warnings.warn(
            "clear_current is deprecated",
            DeprecationWarning,
            stacklevel=2,
        )
E       DeprecationWarning: clear_current is deprecated

/usr/lib64/python3.11/site-packages/tornado/ioloop.py:317: DeprecationWarning

What you expected to happen:
Tests pass.

Environment:

  • Dask version: 2022.7.1
  • Python version: 3.11.0.b4
  • Operating System: Fedora Rawhide
  • Install method (conda, pip, source): source

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions