Closed DavidGarfinkle closed 5 years ago
flask_1 | [2019-08-15 13:46:01,611] ERROR in app: Exception on /search [GET]
flask_1 | Traceback (most recent call last):
flask_1 | File "/opt/venv/lib/python3.7/site-packages/flask/app.py", line 2446, in wsgi_app
flask_1 | response = self.full_dispatch_request()
flask_1 | File "/opt/venv/lib/python3.7/site-packages/flask/app.py", line 1951, in full_dispatch_request
flask_1 | rv = self.handle_user_exception(e)
flask_1 | File "/opt/venv/lib/python3.7/site-packages/flask/app.py", line 1820, in handle_user_exception
flask_1 | reraise(exc_type, exc_value, tb)
flask_1 | File "/opt/venv/lib/python3.7/site-packages/flask/_compat.py", line 39, in reraise
flask_1 | raise value
flask_1 | File "/opt/venv/lib/python3.7/site-packages/flask/app.py", line 1949, in full_dispatch_request
flask_1 | rv = self.dispatch_request()
flask_1 | File "/opt/venv/lib/python3.7/site-packages/flask/app.py", line 1935, in dispatch_request
flask_1 | return self.view_functions[rule.endpoint](**req.view_args)
flask_1 | File "./app.py", line 164, in search
flask_1 | search_response = build_response(application.config['PSQL_CONN'], response.occurrences, rpp, page, query_str)
flask_1 | File "./response.py", line 27, in build_response
flask_1 | for i in range(num_pages)]
flask_1 | File "./response.py", line 27, in <listcomp>
flask_1 | for i in range(num_pages)]
flask_1 | File "./response.py", line 26, in <listcomp>
flask_1 | [pb_occ_to_json(db_conn, o, get_excerpt = (i == page)) for o in occs[rpp * i : rpp * (i + 1)]]
flask_1 | File "./response.py", line 42, in pb_occ_to_json
flask_1 | name = cur.fetchone()
flask_1 | psycopg2.ProgrammingError: no results to fetch
this error implies the search database found a piece with pid
that did not exist in the flask database..
unsure how they became out of sync, but will add an explicit Exception raising so this sort of error becomes obvious
this change was handled in commit https://github.com/ELVIS-Project/cbsmr-patternfinder/commit/99b16050435591d577daf0fd2145d4e982c7b74a
on server restart, following the same steps, we get an error that makes a bit more sense
flask_1 | <div class="panel panel-header">Piece ID #{{searchResponse["pages"][searchResponse["curPage"]][n]["pid"]}} {{searchResponse["pages"][searchResponse["curPage"]][n]["name"
]}}</div>
flask_1 | File "/opt/venv/lib/python3.7/site-packages/jinja2/environment.py", line 411, in getitem
flask_1 | return obj[argument]
flask_1 | jinja2.exceptions.UndefinedError: list object has no element 100
rpp * page can't exceed total number of occurrences or it breaks pagination; this will be fixed as part of #5
CG DA EB FC page 1, then page 100, then rpp 50 with page 100