-
-
Notifications
You must be signed in to change notification settings - Fork 747
Replace gen.coroutine with async/await in core #2871
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
Conversation
Now every ServerNode has a start async method that returns itself. And the __await__ method is handled in the superclass
This reverts commit fda6efc.
|
This is getting close to mergeable, and includes fixes for issues in master. I'm going to try to clean things up here today or tomorrow and hopefully merge in shortly afterwards. |
|
There were some cases where I've decided to keep gen.coroutine semantics. In particular asyncio complains if we leave a task un-awaited in a way that it is bothersome for users. In a couple of places I didn't find a nice way to await every task (such as in the case of the TCP Comm.write method) so I left these in the tornado style. |
|
Tests are now starting to look good :) |
|
OK, I'm going to pronounce this as "good enough" and merge in. I'll probably do a follow-up in a couple of days. |
| # Stimuli # | ||
| ########### | ||
|
|
||
| @gen.coroutine |
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.
async is not used here. Is this intentional?
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.
Probably? Is this causing some concrete issue for you? Does this function need to be asynchronous?
This replaces the use of Tornado
gen.coroutines and theyieldkeyword withasync deffunctions and theawaitkeyword. Additionally, because these have slightly different semantics this also changes a few internal bits to smooth over this transition.This is still a work in progress. The current implementation introduces a couple of small bugs and the conversion is not complete.
cc @jcrist (who requested this a while ago) and @jacobtomlinson who might find this easier to work with than gen.coroutine.