Let me preface this question by saying that I am new to Docker (just started learning it a week ago) so sorry for the drawn-out explanation.
I have built an image for a containerized app that I would like to deploy on a private server. The app was created using Plotly Dash, and has been tested locally on my Windows machine. Here’s a basic overview of the flow of the app:
- Queries Data from multiple servers based on a certain time range
- Filters Data using dropdowns/checklists that are populated based on return values in (1)
- Formats and Exports data to Excel spreadsheet
Each step is contained in its own callback, which all fire sequentially. Data between callbacks 1 & 2 are shared using
dcc.Store components which store data client-side as JSON. Data between callbacks 2 & 3 are stored in a dash data_table which allows the user to see the data before exporting.
After pushing and pulling the image to and from DockerHub, I ran the container, serving up the dashboard on the private server, and was able to access it externally from my browser without any issues. Once I begin using it is where the trouble begins.
For whatever reason, even though the code for callback #1 runs smoothly up until the very end, it’s unable to exit the callback. There don’t seem to be any bugs in the code itself - meaning no tracebacks I can look at - but the app stalls in that place. I have tried, to some extent, to localize the source of the problem but I am unable to solve it entirely. The following is a summary of what I have tried so far and what has and hasn’t worked:
- Limiting the amount of data returned by (1) by restricting it to query only a single server for a smaller time-frame.
- This actually worked and allowed the callback to exit cleanly. The subsequent callbacks then fired and I was able to fully-use all the functions of the app. Obviously, this does not solve the problem but it does allow me to rule certain things out.
- Using server-side caching instead of client-side caching.
- Seemed like an easy fix if
dcc.Storewas indeed the problem. Modified the code in the right places but still not able to exit the callback cleanly.
- Using pickle and the file-system instead
- Rather than share data using components I simply pickled the output of the queries at the end of callback (1) and then unpickled it at the beginning of callback (2). This works perfectly and allows me to use the app without limitations.
While the workaround suffices for now, I would like to have an answer for why both client- and server-side caching aren’t exiting, and if there is anything I can do to get them to do so.
As I mentioned, I was able to serve the app on my machine and use it in my browser without any problems at all. This makes me wonder if my container is somehow short on resources? Hard to tell right now exactly where the problem lies. I tried using
docker stats , but all I saw was that there was more than enough memory available when the app was running. As I said, still new to this technology so any help pointing me in the right direction is very much appreciated.