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

Site and AppRunner #2530

Merged
merged 35 commits into from
Dec 5, 2017
Merged

Site and AppRunner #2530

merged 35 commits into from
Dec 5, 2017

Conversation

asvetlov
Copy link
Member

@asvetlov asvetlov commented Nov 17, 2017

I'm trying to cleanup infrastructure for web application runners.

The PR introduces a site and AppRunner concepts.

Fixes #2121 and #2375
Supersedes #2465

The work is still not finished yet but I believe my intention is clear.

@samuelcolvin
Copy link
Member

Can you give an example of how this would work and how it's better than the current situation?

@asvetlov
Copy link
Member Author

run_app functionality could be implemented like

runner = AppRunner(app)
await runner.initialize()  # setup app loop and run `on_startup()` signal.
site = HTTPSite(runner, 'localhost', 8000)
await site.start()
sslsite = HTTPSite(runner, 'localhost', 8443, ssl_context=....)
await sslsite.start()
# wait for closing
await runner.finalize()  # close sites, call app.cleanup()

@asvetlov
Copy link
Member Author

web.run_app() is fully reimplemented on top of AppRunner and sites.
Working on 100% test coverage and docs.

@codecov-io
Copy link

codecov-io commented Nov 22, 2017

Codecov Report

Merging #2530 into master will increase coverage by 0.08%.
The diff coverage is 99.13%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2530      +/-   ##
==========================================
+ Coverage   97.78%   97.87%   +0.08%     
==========================================
  Files          36       38       +2     
  Lines        7236     7305      +69     
  Branches     1262     1263       +1     
==========================================
+ Hits         7076     7150      +74     
+ Misses         55       51       -4     
+ Partials      105      104       -1
Impacted Files Coverage Δ
aiohttp/web.py 98.76% <100%> (+0.18%) ⬆️
aiohttp/web_site.py 100% <100%> (ø)
aiohttp/worker.py 99.04% <95.65%> (+2.92%) ⬆️
aiohttp/web_app.py 98.81% <98.81%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 52dc7f0...cdd3ad0. Read the comment docs.

asvetlov referenced this pull request Dec 4, 2017
* Initial access_log_factory support.

* Added changes.

* abstraction level changes for AccessLogger.

* Added RequestHandler docstrings.

* Fix changes naming.

* Added access_log_class check for Application.make_handler

* Added basic tests for access_log_class.

* Added docs for access_log_class

* Fix typo request->response

* _log -> log

* Added more details to TypeError regarding access_log_class.
@asvetlov asvetlov changed the title [WIP] Site Site and AppRunner Dec 5, 2017
@asvetlov
Copy link
Member Author

asvetlov commented Dec 5, 2017

I'm going to merge the PR.

Documentation is needed but I'll do it in separate PR.
Implementation affects many files, better to merge it quickly to avoid permanent code divergency and merge conflicts,

@asvetlov asvetlov merged commit 3d00ec1 into master Dec 5, 2017
@asvetlov asvetlov deleted the site branch December 5, 2017 09:46
@asvetlov asvetlov added this to the 3.0 milestone Dec 5, 2017
@lock
Copy link

lock bot commented Oct 28, 2019

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.
If you feel like there's important points made in this discussion, please include those exceprts into that [new issue].
[new issue]: https://github.com/aio-libs/aiohttp/issues/new

@lock lock bot added the outdated label Oct 28, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Oct 28, 2019
@psf-chronographer psf-chronographer bot added the bot:chronographer:provided There is a change note present in this PR label Oct 28, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bot:chronographer:provided There is a change note present in this PR outdated
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Split async server running functions
3 participants