Describe the bug
The frontend crashes with an internal server error if the API cant establish a connection to redis.
Frontend stack trace
File "/usr/local/lib/python3.11/site-packages/flask/app.py", line 2190, in wsgi_app
response = self.full_dispatch_request()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/flask/app.py", line 1486, in full_dispatch_request
rv = self.handle_user_exception(e)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/flask/app.py", line 1484, in full_dispatch_request
rv = self.dispatch_request()
^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/flask/app.py", line 1469, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/flask_login/utils.py", line 290, in decorated_view
return current_app.ensure_sync(func)(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/worker/app/app/blueprints/sample/views.py", line 91, in sample
job = find_and_cluster_similar_samples(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/worker/app/app/blueprints/sample/views.py", line 91, in sample
job = find_and_cluster_similar_samples(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/worker/app/app/bonsai.py", line 48, in wrapper
return func(headers=headers, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/worker/app/app/bonsai.py", line 359, in find_and_cluster_similar_samples
resp.raise_for_status()
File "/usr/local/lib/python3.11/site-packages/requests/models.py", line 1021, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 500 Server Error: Internal Server Error for url: http://mtlucmds1.lund.skane.se/bonsai/api/v1/samples/SUS-test-2/similar
API stacktrace
raw_response = await run_endpoint_function(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/fastapi/routing.py", line 191, in run_endpoint_function
return await dependant.call(**values)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/worker/app/app/routers/samples.py", line 485, in find_similar_samples
submission_info: SubmittedJob = schedule_find_similar_and_cluster(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/worker/app/app/redis/minhash.py", line 105, in schedule_find_similar_and_cluster
job = redis.minhash.enqueue(
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/rq/queue.py", line 972, in enqueue
return self.enqueue_call(
^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/rq/queue.py", line 721, in enqueue_call
return self.enqueue_job(job, pipeline=pipeline, at_front=at_front)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/rq/queue.py", line 1095, in enqueue_job
return self._enqueue_job(job, pipeline=pipeline, at_front=at_front)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/rq/queue.py", line 1115, in _enqueue_job
job.redis_server_version = self.get_redis_server_version()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/rq/queue.py", line 219, in get_redis_server_version
self.redis_server_version = get_version(self.connection)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/rq/utils.py", line 293, in get_version
tuple(int(i) for i in connection.info("server")["redis_version"].split('.')[:3]),
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/redis/commands/core.py", line 1004, in info
return self.execute_command("INFO", section, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/redis/client.py", line 533, in execute_command
conn = self.connection or pool.get_connection(command_name, **options)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/redis/connection.py", line 1086, in get_connection
connection.connect()
File "/usr/local/lib/python3.11/site-packages/redis/connection.py", line 270, in connect
raise ConnectionError(self._error_message(e))
redis.exceptions.ConnectionError: Error -2 connecting to redis:6379. Name or service not known.
Describe the bug The frontend crashes with an internal server error if the API cant establish a connection to redis.
Frontend stack trace
API stacktrace