Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow for 'classic' gunicorn running #138

Merged
merged 6 commits into from
May 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 16 additions & 10 deletions gilda/app/__init__.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
import argparse
"""
Run the grounding app.

Run as module:
`python -m gilda.app --host <host> --port <port> --terms <terms>`

Run with gunicorn:
`gunicorn -w <worker count> -b <host>:<port> -t <timeout> gilda.app:gilda_app`

In case a non-standard set of terms is to be used, set the `GILDA_TERMS`
environment variable to the path to the terms file.
"""

import os
from .app import get_app


def main():
parser = argparse.ArgumentParser(
description='Run the grounding app.')
parser.add_argument('--host', default='0.0.0.0')
parser.add_argument('--port', default=8001, type=int)
parser.add_argument('--terms')
args = parser.parse_args()
app = get_app(terms=args.terms)
app.run(host=args.host, port=args.port, threaded=False)
terms = os.environ.get('GILDA_TERMS')
gilda_app = get_app(terms=terms)
23 changes: 21 additions & 2 deletions gilda/app/__main__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@
from . import main
"""
Runs the Gilda grounding app as a module. Usage:

`python -m gilda.app --host <host> --port <port> --terms <terms>`
"""

import argparse
from .app import get_app


def parse_args():
parser = argparse.ArgumentParser(
description='Run the grounding app.')
parser.add_argument('--host', default='0.0.0.0')
parser.add_argument('--port', default=8001, type=int)
parser.add_argument('--terms')
args = parser.parse_args()
return args


if __name__ == '__main__':
main()
args = parse_args()
app = get_app(args.terms)
app.run(args.host, args.port, threaded=False)
4 changes: 2 additions & 2 deletions gilda/app/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ <h2 style="margin-top: 10px; margin-bottom: 10px;">Gilda Grounding Service</h2>
Gilda is developed by the <a href="https://gyorilab.github.io"
target="_blank">Gyori Lab for Computational Biomedicine</a>
at <a href="https://www.northeastern.edu" target="_blank">Northeastern University</a>.
Its development was funded by DARPA grants W911NF-15-1-0544 and
W911NF-20-1-0255.
Its development is funded by DARPA grants W911NF-15-1-0544,
W911NF-20-1-0255, and HR00112220036.
Point of contact: <a href="mailto:[email protected]">Benjamin M. Gyori</a>.
</p>
</div>
Expand Down
Loading