-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Replace use of the deprecated asyncio.get_event_loop function. #492
Conversation
@@ -9,7 +9,7 @@ | |||
# Thanks for using Enthought open source! | |||
|
|||
""" | |||
IEventLoop implementation for the main-thread asyncio event loop. | |||
IEventLoop implementation wrapping an asyncio 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.
Docstring changed because with Python's migration away from get_event_loop
, "the main-thread asyncio event loop" doesn't really make sense any more.
On second thoughts, this PR leaves that example actually broken: it simply hangs when run, so that should be fixed as part of this PR. This may require a bit of reworking. |
traits_future = submit_iteration(traits_executor, approximate_pi) | ||
traits_future.observe(print_progress, "result_event") | ||
|
||
# For Python 3.7 and later, just use asyncio.run. |
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.
Comment removed: asyncio.run
isn't the right thing to use here, since it creates its own new event loop. We don't want that - we want to use the event loop that Traits Futures is delivering results to.
Done. Ready for review. |
CI failure was due to out-of-date copyright years; should be fixed in #494. |
This PR replaces the use of
asyncio.get_event_loop
in the Traits Futures core.There's a remaining example that still usesget_event_loop
, but I'll address that separately.There are some remaining warnings in the test run resulting from the fact that we have no way to clean up asyncio event loops created through
ETSToolkit
, but I believeETSToolkit
should not have been supporting asyncio in the first place - see #490.Together with #490, this addresses #491.
Also closes #333.