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

Function run

dash/background_callback/managers/diskcache_manager.py:228–258  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

226 ctx = copy_context()
227
228 def run():
229 c = AttributeDict(**context)
230 c.ignore_register_page = False
231 c.updated_props = ProxySetProps(_set_props)
232 context_value.set(c)
233 errored = False
234 user_callback_output = None # initialized to prevent type checker warnings
235 try:
236 if isinstance(user_callback_args, dict):
237 user_callback_output = fn(*maybe_progress, **user_callback_args)
238 elif isinstance(user_callback_args, (list, tuple)):
239 user_callback_output = fn(*maybe_progress, *user_callback_args)
240 else:
241 user_callback_output = fn(*maybe_progress, user_callback_args)
242 except PreventUpdate:
243 errored = True
244 cache.set(result_key, {"_dash_no_update": "_dash_no_update"})
245 except Exception as err: # pylint: disable=broad-except
246 errored = True
247 cache.set(
248 result_key,
249 {
250 "background_callback_error": {
251 "msg": str(err),
252 "tb": traceback.format_exc(),
253 }
254 },
255 )
256
257 if not errored:
258 cache.set(result_key, user_callback_output)
259
260 async def async_run():
261 c = AttributeDict(**context)

Callers

nothing calls this directly

Calls 4

AttributeDictClass · 0.85
ProxySetPropsClass · 0.85
fnFunction · 0.50
setMethod · 0.45

Tested by

no test coverage detected