Skip to content

Commit

Permalink
Merge pull request #61 from bento-platform/chore/service-runner-impro…
Browse files Browse the repository at this point in the history
…vements

chore: gunicorn logging + gevent worker + increased timeout
  • Loading branch information
davidlougheed authored Dec 6, 2023
2 parents 977d3b2 + 9074499 commit 5a65f6e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions container.requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
gunicorn==21.2.0
gevent==23.9.1
pysam>=0.22.0,<0.23.0
fasta-checksum-utils>=0.3.1,<0.4
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ requests = "^2.28.1"
Flask = "~2.2.5"
pydantic = "^2.0.2"
flask-cors = "^4.0.0"
werkzeug = "~2.2.2" # debugpy is broken with werkzeug 2.3.x so pin this manually
werkzeug = "~2.2.3" # debugpy is broken with werkzeug 2.3.x so pin this manually

[tool.poetry.group.dev.dependencies]
coverage = "^7.2.2"
Expand Down
5 changes: 5 additions & 0 deletions run.bash
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@
# Start Celery worker with log level dependent on BENTO_DEBUG
echo "[bento_wes] [entrypoint] Starting celery worker"
celery_log_level="INFO"
gunicorn_log_level="info"
if [[
"${BENTO_DEBUG}" == "true" ||
"${BENTO_DEBUG}" == "True" ||
"${BENTO_DEBUG}" == "1"
]]; then
celery_log_level="DEBUG"
gunicorn_log_level="debug"
fi
celery --app bento_wes.app worker --loglevel="${celery_log_level}" &

Expand All @@ -20,6 +22,9 @@ echo "[bento_wes] [entrypoint] Starting gunicorn"
# using 1 worker, multiple threads
# see https://stackoverflow.com/questions/38425620/gunicorn-workers-and-threads
gunicorn bento_wes.app:application \
--log-level "${gunicorn_log_level}" \
--timeout 660 \
--workers 1 \
--worker-class 'gevent' \
--threads "$(( 2 * $(nproc --all) + 1))" \
--bind "0.0.0.0:${INTERNAL_PORT}"

0 comments on commit 5a65f6e

Please sign in to comment.