Skip to content

Remove deprecated Tornado current-loop APIs in WebGL server thread#647

Draft
Copilot wants to merge 2 commits into
mainfrom
copilot/fix-tornado-warnings
Draft

Remove deprecated Tornado current-loop APIs in WebGL server thread#647
Copilot wants to merge 2 commits into
mainfrom
copilot/fix-tornado-warnings

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jun 2, 2026

This change removes Tornado deprecation warnings emitted by cortex/webgl/serve.py when running WebGL/headless tests. WebApp.run() previously used deprecated current-loop mutation methods (clear_current / make_current).

  • Runtime loop initialization

    • WebApp.run() now gets the thread-local loop via tornado.ioloop.IOLoop.current() instead of constructing an IOLoop and mutating global current-loop state.
    • Existing server startup flow remains the same (ApplicationHTTPServerlistenstart).
  • Focused regression coverage

    • Added cortex/tests/test_webgl_serve.py with a targeted test that monkeypatches IOLoop.current() and asserts WebApp uses that loop for startup.
def run(self):
    ioloop: tornado.ioloop.IOLoop = tornado.ioloop.IOLoop.current()
    self.ioloop = ioloop
    application = tornado.web.Application(self.handlers, gzip=True)
    ...
    self.server.listen(self.port)
    ioloop.start()
Original prompt

Fix these two tornado warnings in cortex/webgl/serve.py:

cortex/tests/test_export.py: 2 warnings
cortex/tests/test_headless.py: 3 warnings
cortex/tests/test_webgl_headless.py: 23 warnings
  /home/runner/work/pycortex/pycortex/cortex/webgl/serve.py:327: DeprecationWarning: clear_current is deprecated
    ioloop.clear_current()

cortex/tests/test_export.py: 2 warnings
cortex/tests/test_headless.py: 3 warnings
cortex/tests/test_webgl_headless.py: 23 warnings
  /home/runner/work/pycortex/pycortex/cortex/webgl/serve.py:328: DeprecationWarning: make_current is deprecated; start the event loop first
    ioloop.make_current()

Created from VS Code.

Copilot AI changed the title [WIP] Fix tornado warnings in serve.py for deprecation Remove deprecated Tornado current-loop APIs in WebGL server thread Jun 2, 2026
Copilot AI requested a review from kroq-gar78 June 2, 2026 03:08
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