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

Handling event_loop in _worker_process #822

Open
jakirkham opened this issue Dec 2, 2021 · 1 comment
Open

Handling event_loop in _worker_process #822

jakirkham opened this issue Dec 2, 2021 · 1 comment

Comments

@jakirkham
Copy link
Member

Currently _worker_process calls asyncio.get_event_loop()

loop = asyncio.get_event_loop()

This function was deprecated in Python 3.10 ( https://bugs.python.org/issue39529 ). The docs recommend calling asyncio.get_running_loop() instead. Though this will raise a RuntimeError if an event loop doesn't exist.

This raises an interesting question. Should this function create an event loop (possibly not if something else has already done this)? Should this function be taking an event_loop as an argument (like other functions do)? Guessing no since it is called in different processes. Should it take a function to create an event loop ( for example if we want to use uvloop #821 )? Or should it do something else (like try to use an existing event loop and only create one if it is absent)?

@madsbk
Copy link
Member

madsbk commented Dec 14, 2021

I think the default should be try to use an existing event loop and only create one if it is absent but it would be great to also have an optional argument: function to create an event loop.

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

No branches or pull requests

2 participants