Allow background callbacks to run in the same process as the main app
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 24.4k
- Forks
- 2.3k
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 13
Description
Is your feature request related to a problem? Please describe.
Problem: display a "loading..." indicator (or better, a progress bar) while some long in-process computation is running.
There are 3 main reasons why in-process background callbacks are desirable:
- Current version of background callbacks requires changes to the deployment environment, they don't work out of the box after
pip install dash. - Updating an in-process cache. Having to set up Redis or a database or use files for caching graphs in a simple single-process app is an overkill.
- Especially, when results inserted to the in-process cache are non-serializable, such as memory-mapped numpy arrays or pytorch tensors or models which might be on CUDA. Or simply any data structure that doesn't implement serialization.
Describe the solution you'd like
An callback manager (say InProcessManager) that is available after pip instal dash and runs background callbacks in a thread in the same process.
Describe alternatives you've considered
Currently I am using regular callbacks, but have run into https://github.com/plotly/dash/issues/2486 when trying to show loading indicator for the callback. Also, progress bar is not available for regular callbacks, and background callbacks seem to be more natural for this kind of use-case.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No files or tests are named. Start by tracing the existing background-callback and regular-callback entry points, then compare how deployment and cache handling differ. Done means an InProcessManager is available after pip install dash, runs callbacks in the same process, supports progress or loading updates, and handles non-serializable in-process results.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100