Running calculation-heavy process in background?

You’ll probably find the new loading states API, which is still in pre-release, helpful here.

As for the the long running task side of things, there’s examples of people using libraries like Celery if you search in the forums (I think) for this kind of thing. But this is less a Dash-specific issue, and rather one that you’d expect to see cropping up in any web framework with an incoming web request triggers a long running task. So you could google around for doing this while handling Flask requests. The challenge is going to be updating the app based on the results of your long running task completing. It’s not elegant, but the only way that’s coming to mind right now, is to use a dcc.Interval component to poll for any updates. You’ll have to manage session IDs somehow to do that though.

If you can get away with running your app with more workers and allow for one of them be occupied for a while, that’s certainly going to be simpler, as but may not be feasible.

Using the lru_cache decorator from functools (or functools32 for Python 2), as described in the Dash docs, is also an easy win for caching the results of callbacks.