-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #138 from gyorilab/gunicorn
Allow for 'classic' gunicorn running
- Loading branch information
Showing
3 changed files
with
39 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters