-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Signals Startup & Cleanup still not good #2092
Comments
We don't support atomic execution for startup/cleanup pair for pairs like
|
Yes actually that's what I had in mind. In my PR I make cleanup being called unconditionally and I make a simple mechanism strongly tested for bg processes. Basically it does the await properly for you (when it can). |
|
@socketpair thx! I know already, the rest of the discussion is on #2096 |
@cecton I think we need to invite completely new solution. My wild proposal is:
Unfortunately it doesn't work very well until Python 3.7 release but the implementation already exists in http://pythonhosted.org/asyncio_extras/#module-asyncio_extras.contextmanager |
@asvetlov actually that is awesome! I would love using context in place of the signals. This will naturally cleanup only the hooks that have actually started. I will try to implement something in that direction unless you want to do it yourself. |
Please do. |
Fixed by #2747 |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a [new issue] for related bugs. |
Long story short
In my application:
My goal is to properly clean up and exit the application if one of the startup hook did not succeeded. But I just can't figure out a way at the moment to properly cleanup my application on exit.
Expected behaviour
Failure during a startup hook should prevent the application to startup(cannot reproduce)Actual behaviour
The following workaround will work for failures during startup signal, but this call to
app.cleanup
will be duplicated with the one in web.run_app if the application did not fail during startup but is cancelled by a manual KeyboardInterrupt:Task exception was never retrieved
).Steps to reproduce
(Examples given above)
Your environment
ArchLinux, Python 3.6, aiohttp 2.2.3
The text was updated successfully, but these errors were encountered: