MCPcopy Index your code
hub / github.com/plotly/dash / run

Function run

dash/background_callback/managers/celery_manager.py:164–204  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

162 ctx = copy_context()
163
164 def run():
165 c = AttributeDict(**context) # type: ignore[reportCallIssue]
166 c.ignore_register_page = False
167 c.updated_props = ProxySetProps(_set_props)
168 context_value.set(c)
169 errored = False
170 user_callback_output = None # to help type checking
171 try:
172 if isinstance(user_callback_args, dict):
173 user_callback_output = fn(*maybe_progress, **user_callback_args)
174 elif isinstance(user_callback_args, (list, tuple)):
175 user_callback_output = fn(*maybe_progress, *user_callback_args)
176 else:
177 user_callback_output = fn(*maybe_progress, user_callback_args)
178 except PreventUpdate:
179 # Put NoUpdate dict directly to avoid circular imports.
180 errored = True
181 cache.set(
182 result_key,
183 json.dumps(
184 {"_dash_no_update": "_dash_no_update"}, cls=PlotlyJSONEncoder
185 ),
186 )
187 except Exception as err: # pylint: disable=broad-except
188 errored = True
189 cache.set(
190 result_key,
191 json.dumps(
192 {
193 "background_callback_error": {
194 "msg": str(err),
195 "tb": traceback.format_exc(),
196 }
197 },
198 ),
199 )
200
201 if not errored:
202 cache.set(
203 result_key, json.dumps(user_callback_output, cls=PlotlyJSONEncoder)
204 )
205
206 async def async_run():
207 c = AttributeDict(**context)

Callers

nothing calls this directly

Calls 4

AttributeDictClass · 0.90
ProxySetPropsClass · 0.90
fnFunction · 0.50
setMethod · 0.45

Tested by

no test coverage detected