diff --git a/README.md b/README.md index acb1528..48774ae 100644 --- a/README.md +++ b/README.md @@ -115,6 +115,21 @@ docker run -it --rm \ -p 8080:8080 \ cellxgene-gateway ``` +## Running cellxgene gateway with start scripts + +For your convenience, we provide start scripts for flask, gunicorn and uwsgi. + +First, set up a .env +```bash +cp env_example .env +# edit .env +open .env +``` + +Then run the scripts in a subshell +```bash +( ./start_flask.sh ) +``` # Customization diff --git a/cellxgene_gateway/gateway.py b/cellxgene_gateway/gateway.py index fd7bf45..1e6d00a 100644 --- a/cellxgene_gateway/gateway.py +++ b/cellxgene_gateway/gateway.py @@ -378,8 +378,10 @@ def ip_address(): def start_pruner_thread(): pruner = PruneProcessCache(cache) - - background_thread = Thread(target=pruner) + # Run the pruner as a daemon thread so it won't block interpreter + # shutdown (for example when Ctrl-C is used in the main thread). + # This avoids "Exception ignored in: " at exit. + background_thread = Thread(target=pruner, daemon=True) background_thread.start() diff --git a/start_flask.sh b/start_flask.sh index d28c1df..14387dd 100755 --- a/start_flask.sh +++ b/start_flask.sh @@ -4,7 +4,7 @@ # # PREREQUISITES: # - Gunicorn installed (included with cellxgene 1.3.0, or: pip install gunicorn) -# - Virtual environment activated or .venv present +# - Virtual environment activated # - .env file with CELLXGENE_LOCATION and CELLXGENE_DATA (or CELLXGENE_BUCKET) # # USAGE: diff --git a/start_gunicorn.sh b/start_gunicorn.sh index 4e6da8f..eeef9bb 100755 --- a/start_gunicorn.sh +++ b/start_gunicorn.sh @@ -4,7 +4,7 @@ # # PREREQUISITES: # - Gunicorn installed (included with cellxgene 1.3.0, or: pip install gunicorn) -# - Virtual environment activated or .venv present +# - Virtual environment activated # - .env file with CELLXGENE_LOCATION and CELLXGENE_DATA (or CELLXGENE_BUCKET) # # USAGE: diff --git a/start_uwsgi.sh b/start_uwsgi.sh index 7cfaa58..3482085 100755 --- a/start_uwsgi.sh +++ b/start_uwsgi.sh @@ -4,7 +4,7 @@ # # PREREQUISITES: # - uWSGI installed (pip install uwsgi) -# - Virtual environment activated or .venv present +# - Virtual environment activated # - .env file with CELLXGENE_LOCATION and CELLXGENE_DATA (or CELLXGENE_BUCKET) # # USAGE: