Repository navigation
Replies: 1 comment
|
Current main confirms the behavior: the process-manager branch is explicitly gated by I would avoid changing the meaning of The underlying feature makes sense, but it needs a separate opt-in from worker count. For example, a supervisor/process-manager flag could mean “run workers under Uvicorn's Multiprocess supervisor” while That also avoids overloading Tests should cover both contracts: default / |
Uh oh!
There was an error while loading. Please reload this page.
Uvicorn has a built-in process manager, so I can run it with, for example,
--workers 4to get 4 worker processes. Uvicorn will run 4 child processes listening on the same port, and will automatically restart processes that die or get stuck. However, if I use--workers 1, Uvicorn will not use its process manager and will instead run the ASGI application directly in the main process.I have a use case where I only need one worker process, but I need to monitor and restart it on failures. I can use an external process manager like
gunicornorsupervisor, but it seems unfortunate to introduce another dependency when everything I need is already supported by Uvicorn itself. The built-in process manager can already run with just one worker by starting with--workers 2and then sendingSIGTTOU. Alternatively, I can copy code formmain.pyand useMultiprocessdirectly. However, both of these options seem hacky.I propose that running Uvicorn with
--workers 1runs the application in a subprocess usingMultiprocessprocess manager. This is both a useful feature and seems more intuitive. Happy to open a PR.This will also address the issue discussed here: #2390
All reactions