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

add a way to run an app asynchron #2375

Closed
hwmrocker opened this issue Oct 23, 2017 · 7 comments
Closed

add a way to run an app asynchron #2375

hwmrocker opened this issue Oct 23, 2017 · 7 comments
Labels
Milestone

Comments

@hwmrocker
Copy link

Long story short

It would be nice to have an async / coroutine that will take an app and run it. This is very usefull if you have an long running that wants to expose a rest interface.

Steps to reproduce

go to the web.py file and look for run function that runs an app asynchron

@kxepal
Copy link
Member

kxepal commented Oct 23, 2017

I didn't get the use case. Can you elaborate?

@cecton
Copy link
Contributor

cecton commented Oct 24, 2017

Actually I think we do it the other way around. Put your tasks in jobs with https://github.com/aio-libs/aiojobs then run your app with web.run_app. Do you have a particular reason to do it in the way you want (Application ran in background)?

@hwmrocker
Copy link
Author

I have a long running application/job/process running and want to add a REST interface to expose some internals during the runtime

@cecton
Copy link
Contributor

cecton commented Oct 24, 2017

Then why not using the startup hooks to add those long running applications/jobs/processes?

Here is my use case where I have a microservice with an API running, but there is a background tasks that monitors events from the Docker API: https://github.com/big-data-europe/mu-swarm-admin-service/blob/master/muswarmadmin/main.py#L659

@hwmrocker
Copy link
Author

@cecton thanks for your link. In fact I could with a very small change use aiohttp to spawn my "main" task and since both should all the time it is fine for me.

@cecton
Copy link
Contributor

cecton commented Oct 27, 2017

@hwmrocker I'm glad it helped. We're still discussing about it on #2121 I will propose some changes that will become handy (when I have time and motivation 😣 )

@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
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants