Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow background callbacks to run in the same process as the main app #2750

Open
franekp opened this issue Feb 7, 2024 · 0 comments
Open
Assignees
Labels
feature something new P3 backlog

Comments

@franekp
Copy link

franekp commented Feb 7, 2024

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:

  1. Current version of background callbacks requires changes to the deployment environment, they don't work out of the box after pip install dash.
  2. 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.
  3. 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 #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.

@gvwilson gvwilson added P3 backlog feature something new labels Aug 13, 2024
@gvwilson gvwilson changed the title [Feature Request] Allow background callbacks to run in the same process as the main app Allow background callbacks to run in the same process as the main app Aug 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature something new P3 backlog
Projects
None yet
Development

No branches or pull requests

3 participants