Skip to content

Replace gunicorn with waitress and fix logging issues#836

Merged
bennybp merged 5 commits intomainfrom
waitress
May 20, 2024
Merged

Replace gunicorn with waitress and fix logging issues#836
bennybp merged 5 commits intomainfrom
waitress

Conversation

@bennybp
Copy link
Contributor

@bennybp bennybp commented May 17, 2024

Description

This PR replaces the embedded gunicorn instance with waitress https://docs.pylonsproject.org/projects/waitress/en/latest/#

Gunicorn was not particularly set up to be run in this way. It's largely meant to be used from the command line rather than embedded in application. Its forking model just didn't well in qcfractal and it conflicted with other multiprocessing stuff. Also, logging was a pain.

So let's try waitress instead. It is much simpler, and much more amenable to embedding in a python application.
I hope this also fixes the spurious 502 Bad Gateway errors, although I wouldn't be surprised if it doesn't.

Waitress only works with one process, so the num_workers parameter in the config is no longer used.

Also as part of this PR, logging will work through a queue. This will help in the multi-process environment, and allow for using TimedRotatingFileHandler and handlers from python.

Lastly, this also quiets some logging when doing admin stuff from the CLI (like modifying users). It enables using -v and -vv
to increase verbosity

Changelog description

Replace gunicorn with waitress and fix logging issues
Allow increasing verbosity on the CLI with -v and -vv on the cli

Status

  • Code base linted
  • Ready to go

@bennybp bennybp force-pushed the waitress branch 2 times, most recently from f49dba0 to 4dbb061 Compare May 17, 2024 20:33
@bennybp
Copy link
Contributor Author

bennybp commented May 20, 2024

Tested on the production server and everything seems reasonable

@bennybp bennybp merged commit 6fa19fc into main May 20, 2024
@bennybp bennybp deleted the waitress branch May 20, 2024 13:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant