You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Background callbacks in python dash were first called "long" callback. They were added via the @long_callback decorator in plotly/dash#1702, released as part of python dash v2.0.0 on 2021-08-03.
Long callbacks were then improved and effectively renamed "background" callbacks in plotly/dash#2039 and plotly/dash#2116, released in python dash v2.6.0 on 2022-07-14. This PR also refactored most of the functionality: the traditional callback function (normally used as a @callback decorator) gets a background=True keyword argument. The @long_callback decorator still exist to this day, but now is just a wrapper around callback(..., background=True).
Subsequent fixes and tweaks to background callbacks were made in:
The python dash callback function has many keyword arguments to configure the "background" behaviour.
If background=True, the extra callback registration logic is here and here. In brief, using a cache manager, we (1) build the cache key, (2) terminate old job if any, (3) call the callback function if cache miss. There's also logic for cancelling and an optional progress bar. This logic will have to be rewritten in Julia!
The supported cache managers are: Celery (paired with Redis) and Diskcache. That is, the python dash cache managers are wrappers around established python caching / queuing libraries. We should survey caching package in the Julia ecosystem that would work well for this use case. After a quick search, Dagger.jl look like a promising Celery-like package.
The extra clientside logic mostly is here and here (refer to .ts file modifications in plotly/dash#2039 for the details) . That part should just work 😄 but we'll need to make sure we send the appropriate JSON payload.
Activity
etpinard commentedon Apr 10, 2024
Current dash docs articles on background callbacks
History lesson
please let me know if I'm missing anything 😄
Background callbacks in python dash were first called "long" callback. They were added via the
@long_callback
decorator in plotly/dash#1702, released as part of python dashv2.0.0
on 2021-08-03.Long callbacks were then improved and effectively renamed "background" callbacks in plotly/dash#2039 and plotly/dash#2116, released in python dash
v2.6.0
on 2022-07-14. This PR also refactored most of the functionality: the traditionalcallback
function (normally used as a@callback
decorator) gets abackground=True
keyword argument. The@long_callback
decorator still exist to this day, but now is just a wrapper aroundcallback(..., background=True)
.Subsequent fixes and tweaks to background callbacks were made in:
High-level design
The python dash
callback
function has many keyword arguments to configure the "background" behaviour.If
background=True
, the extra callback registration logic is here and here. In brief, using a cache manager, we (1) build the cache key, (2) terminate old job if any, (3) call the callback function if cache miss. There's also logic for cancelling and an optional progress bar. This logic will have to be rewritten in Julia!The supported cache managers are: Celery (paired with Redis) and Diskcache. That is, the python dash cache managers are wrappers around established python caching / queuing libraries. We should survey caching package in the Julia ecosystem that would work well for this use case. After a quick search, Dagger.jl look like a promising Celery-like package.
The extra clientside logic mostly is here and here (refer to
.ts
file modifications in plotly/dash#2039 for the details) . That part should just work 😄 but we'll need to make sure we send the appropriate JSON payload.Dash.jl API
see base python example
would translate to
see Dash.jl translation