Skip to content
This repository has been archived by the owner on Sep 26, 2022. It is now read-only.

Pick WSGI server to run the API #196

Merged
merged 5 commits into from
Aug 20, 2020

Conversation

sr-gi
Copy link
Member

@sr-gi sr-gi commented Aug 7, 2020

gunicorn is used as the WSGI server to run the api by default, however, in other setups it may make sense using something different:

  • Windows machines cannot run gunicorn, so uWSGI may be an alternative.
  • For testing and for setups where only a few (trusted) users are using the tower, Flask may suffice.

This PR adds the config parameters needed to allow the customisation of the WSGI server and adapt the daemon to run it.

partially covers #191 (not covers uWSGI for Windows environments, will leave as a followup since I cannot tests it personally).

This also fixes the issue with e2e testing leaving the gunicorn running. End-to-end test switched back to use flask now there's an option for it.

@sr-gi sr-gi marked this pull request as ready for review August 18, 2020 13:33
The API can be run either using gunicorn (default) or Flask webserver. The later is not recomended for production cases, but may be enough if the tower only used by yourself
teos/api.py Outdated Show resolved Hide resolved
teos/teosd.py Outdated Show resolved Hide resolved
teos/teosd.py Outdated Show resolved Hide resolved
Copy link
Collaborator

@bigspider bigspider left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No major comment, apart from a typo that breaks the --wsgi argument.

Python 3.8 processes are created using spawn for MacOS instead of fork (which use to be the default). The previous version of the code was passing some data that cannot be serialised (pickled) when spawn is used, so it needed to be reworked.

Forcing fork instead of spawn may have also worked, but Windows does not support it, so the old version of the code would have failed on Windows anyway.
@sr-gi
Copy link
Member Author

sr-gi commented Aug 19, 2020

This should be working now. Happened to find an issue regarding python 3.8 and MacOS that extended to Windows also. It should work with versions prior to 3.8 and 3.8 onwards with the current version.

@sr-gi sr-gi merged commit f81a3ff into talaia-labs:split-cli-client Aug 20, 2020
@sr-gi sr-gi linked an issue Sep 14, 2020 that may be closed by this pull request
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Find out and document how to serve teosd in production
2 participants