BaderLab / saber

Saber is a deep-learning based tool for information extraction in the biomedical domain. Pull requests are welcome! Note: this is a work in progress. Many things are broken, and the codebase is not stable.
https://baderlab.github.io/saber/
MIT License
102 stars 17 forks source link

Somewhat refs #90: fixed a syntax error; also used asyncio #101

Closed IgorRodchenkov closed 5 years ago

IgorRodchenkov commented 5 years ago

Closes #101, closes #90.

JohnGiorgi commented 5 years ago

Hi Igor, I pulled down these changes with

git checkout -b IgorRodchenkov-master master
git pull https://github.com/IgorRodchenkov/saber.git master

and then ran the web app with

python -m saber.cli.app

which works fine if {"ground": false} in the JSON payload, but if {"ground": true} I get

Internal Server Error

The server encountered an unexpected internal server error

(generated by waitress)

Looking at saber.log, I see:

waitress - ERROR - Exception when serving /annotate/text
Traceback (most recent call last):
  File "/Users/johngiorgi/miniconda3/envs/saber/lib/python3.6/site-packages/waitress/channel.py", line 338, in service
    task.service()
  File "/Users/johngiorgi/miniconda3/envs/saber/lib/python3.6/site-packages/waitress/task.py", line 169, in service
    self.execute()
  File "/Users/johngiorgi/miniconda3/envs/saber/lib/python3.6/site-packages/waitress/task.py", line 399, in execute
    app_iter = self.channel.server.application(env, start_response)
  File "/Users/johngiorgi/miniconda3/envs/saber/lib/python3.6/site-packages/flask/app.py", line 2309, in __call__
    return self.wsgi_app(environ, start_response)
  File "/Users/johngiorgi/miniconda3/envs/saber/lib/python3.6/site-packages/flask/app.py", line 2295, in wsgi_app
    response = self.handle_exception(e)
  File "/Users/johngiorgi/miniconda3/envs/saber/lib/python3.6/site-packages/flask/app.py", line 1741, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/Users/johngiorgi/miniconda3/envs/saber/lib/python3.6/site-packages/flask/_compat.py", line 35, in reraise
    raise value
  File "/Users/johngiorgi/miniconda3/envs/saber/lib/python3.6/site-packages/flask/app.py", line 2292, in wsgi_app
    response = self.full_dispatch_request()
  File "/Users/johngiorgi/miniconda3/envs/saber/lib/python3.6/site-packages/flask/app.py", line 1815, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/Users/johngiorgi/miniconda3/envs/saber/lib/python3.6/site-packages/flask/app.py", line 1718, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/Users/johngiorgi/miniconda3/envs/saber/lib/python3.6/site-packages/flask/_compat.py", line 35, in reraise
    raise value
  File "/Users/johngiorgi/miniconda3/envs/saber/lib/python3.6/site-packages/flask/app.py", line 1813, in full_dispatch_request
    rv = self.dispatch_request()
  File "/Users/johngiorgi/miniconda3/envs/saber/lib/python3.6/site-packages/flask/app.py", line 1799, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/Users/johngiorgi/Documents/Masters/Class/natural_language_computing/project/saber/saber/cli/app.py", line 37, in annotate_text
    ground=parsed_request_json['ground'])
  File "/Users/johngiorgi/Documents/Masters/Class/natural_language_computing/project/saber/saber/cli/app.py", line 77, in predict
    annotations.append(MODELS[ent].annotate(text, coref=coref, ground=ground))
  File "/Users/johngiorgi/Documents/Masters/Class/natural_language_computing/project/saber/saber/saber.py", line 112, in annotate
    annotation = grounding_utils.ground(annotation)
  File "/Users/johngiorgi/Documents/Masters/Class/natural_language_computing/project/saber/saber/utils/grounding_utils.py", line 88, in ground
    loop = asyncio.get_event_loop()
  File "/Users/johngiorgi/miniconda3/envs/saber/lib/python3.6/asyncio/events.py", line 694, in get_event_loop
    return get_event_loop_policy().get_event_loop()
  File "/Users/johngiorgi/miniconda3/envs/saber/lib/python3.6/asyncio/events.py", line 602, in get_event_loop
    % threading.current_thread().name)
RuntimeError: There is no current event loop in thread 'waitress'.
coveralls commented 5 years ago

Pull Request Test Coverage Report for Build 278


Totals Coverage Status
Change from base Build 274: 0.0%
Covered Lines: 1782
Relevant Lines: 2201

💛 - Coveralls