Persistent progress bar update

Hi,

In my Dash app I have a long-running task that can take a week to complete. The app serves as a user interface to that task: the user is supposed to upload a file and start a job. The next day it should be possible to check on the progress of that task or cancel it. As such, it can serve only a single user.

Background callbacks look promising, but I am not sure how to best make them persistent. In the form it is presented, when user leaves the app, the task continues, but upon return there’s no progress update (which is understandable).

Any ideas how to make it work? It’s preferred that I stick to Dash and don’t involve Celery / Redis (or other “extra” software) unless strictly necessary.

Some options I am considering:

  • Writing to a websocket from the task, and reading it with Interval.
  • Writing to disc from the task and reading it later with Interval. One file to write console output, another to report progress? Kind of messy.
  • Writing to Redis from the task and reading it later with Interval.

Thoughts?

The simplest would probably be to run the job in a separate process, writing updates to a file on disk. The app can the query the file, triggered by an interval component. Serving only a single user, I don’t see any major drawback of this approach.