MCPcopy
hub / github.com/plotly/dash / _get_callback_manager

Function _get_callback_manager

dash/_callback.py:389–414  ·  view source on GitHub ↗

Set up the background callback and manage jobs.

(
    kwargs: dict, background: dict
)

Source from the content-addressed store, hash-verified

387
388
389def _get_callback_manager(
390 kwargs: dict, background: dict
391) -> BaseBackgroundCallbackManager:
392 """Set up the background callback and manage jobs."""
393 callback_manager = background.get(
394 "manager", kwargs.get("background_callback_manager", None)
395 )
396 if background is not None:
397 if not callback_manager:
398 raise MissingLongCallbackManagerError(
399 "Running `background` callbacks requires a manager to be installed.\n"
400 "Available managers:\n"
401 "- Diskcache (`pip install dash[diskcache]`) to run callbacks in a separate Process"
402 " and store results on the local filesystem.\n"
403 "- Celery (`pip install dash[celery]`) to run callbacks in a celery worker"
404 " and store results on redis.\n"
405 )
406
407 adapter = get_app().backend.request_adapter()
408 old_job = adapter.args.getlist("oldJob") if hasattr(adapter.args, "getlist") else []
409
410 if old_job:
411 for job in old_job:
412 callback_manager.terminate_job(job)
413
414 return callback_manager
415
416
417def _setup_background_callback(

Callers 2

Calls 5

get_appFunction · 0.90
getlistMethod · 0.80
getMethod · 0.45
terminate_jobMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…