-
Notifications
You must be signed in to change notification settings - Fork 182
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
exporter/coordinator/client: create/set event loop explicitly #1059
exporter/coordinator/client: create/set event loop explicitly #1059
Conversation
Calling asyncio.get_event_loop() with no current event loop is deprecated since Python 3.10 and will be an error in Python >=3.12. So create a new event loop explicitly and set it as the current event loop for the current OS thread. Signed-off-by: Bastian Krause <[email protected]>
Calling asyncio.get_event_loop() with no current event loop is deprecated since Python 3.10 and will be an error in Python >=3.12. So create a new event loop explicitly and set it as the current event loop for the current OS thread. Signed-off-by: Bastian Krause <[email protected]>
Calling asyncio.get_event_loop() with no current event loop is deprecated since Python 3.10 and will be an error in Python >=3.12. So create a new event loop explicitly and set it as the current event loop for the current OS thread. Signed-off-by: Bastian Krause <[email protected]>
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #1059 +/- ##
======================================
Coverage 63.3% 63.3%
======================================
Files 152 152
Lines 11311 11313 +2
======================================
+ Hits 7170 7172 +2
Misses 4141 4141 ☔ View full report in Codecov by Sentry. |
@@ -1235,7 +1233,10 @@ async def export(self, place, target): | |||
def start_session(url, realm, extra): | |||
from autobahn.asyncio.wamp import ApplicationRunner | |||
|
|||
loop = asyncio.get_event_loop() | |||
loop = asyncio.new_event_loop() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't this break use-cases where the caller already has a running event loop?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not the case in our codebase. But it could be the case in third-party code, though. So maybe add a loop kwarg and use that if it's specified?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some context for the Python upstream change: python/cpython#83710
I just tried to include this in the build of my test runner container.
I however still gets this warning:
Do I need to do more than updating my test runner? |
This PR needs more work. We need to understand the reasoning behind this deprecation better and then update this PR with a solution covering all use cases. |
Description
Calling
asyncio.get_event_loop()
with no current event loop is deprecated since Python 3.10 and will be an error in Python >=3.12, see docs.So create a new event loop explicitly and set it as the current event loop for the current OS thread.
Checklist
Fixes #1056