So, long story short, I have a Dash app inside of a bigger Flash app. On one point, I define a function that would be called by init routines and define callbacks.
Smth like this (in an abridged form):
def make_callbacks(dashapp):
@dashapp.callback(
Output('graph_impl', 'elements'),
Output('download_button', 'disabled', allow_duplicate=True),
Output('graph_info', 'children', allow_duplicate=True),
Input('graph_select', 'value'),
prevent_initial_call=True,
)
def select_graph(sel_opt):
logging.info("----------- SELECT")
Here, graph_impl
is a cytograph
, download_button
, well, button, graph_select
is dcc.Dropdown
, and graph_info
is just a Div
. But all that does not seem to make any difference.
When I run it via plain Interpreter on bare server everything works fine. When I run it with gunicorn on bare server everything works fine.
But when I try to run it inside Docker I am getting the message from the topic name when try to switch options in that Dropdown
. And that makes zero sense for me – it is clearly written correctly, moreover the logic works fine outside Docker
.
I was just wondering:
- Is there any peculiar behavior of Dash specifically when it comes to Docker (which I fairly really doubt);
- What that error even suppose to mean? I’ve seen tons of weird situation definitely not related to the issue stated in the description. Any I sure have no idea why that does not work within Docker specifically.
As for a bit of a context – I have a redis in a separate service and a plain sqlite db mapped through volume – but they work correctly, both instantiated and then accessed from inside the container in question.
I would greatly appreciate any assistance in the matter, and any idea for the possible culprit.
As for the full error description – please find it below:
ERROR:app:Exception on /graph/_dash-update-component [POST]
Traceback (most recent call last):
File “/usr/local/lib/python3.10/site-packages/dash/dash.py”, line 1230, in dispatch
cb = self.callback_map[output]
KeyError: ‘…graph_impl.elements…download_button.disabled@bedc8f5f5f124508b93a7d5819d8c8d8…graph_info.children@69ff1ba782d549d09d66a07e0e62d8fe…’The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File “/usr/local/lib/python3.10/site-packages/flask/app.py”, line 2528, in wsgi_app
response = self.full_dispatch_request()
File “/usr/local/lib/python3.10/site-packages/flask/app.py”, line 1825, in full_dispatch_request
rv = self.handle_user_exception(e)
File “/usr/local/lib/python3.10/site-packages/flask/app.py”, line 1823, in full_dispatch_request
rv = self.dispatch_request()
File “/usr/local/lib/python3.10/site-packages/flask/app.py”, line 1799, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
File “/usr/local/lib/python3.10/site-packages/flask_login/utils.py”, line 290, in decorated_view
return current_app.ensure_sync(func)(*args, **kwargs)
File “/usr/local/lib/python3.10/site-packages/dash/dash.py”, line 1279, in dispatch
raise KeyError(msg) from missing_callback_function
KeyError: “Callback function not found for output ‘…graph_impl.elements…download_button.disabled@bedc8f5f5f124508b93a7d5819d8c8d8…graph_info.children@69ff1ba782d549d09d66a07e0e62d8fe…’, perhaps you forgot to prepend the ‘@’?”