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

Method record_timing

dash/_callback_context.py:216–237  ·  view source on GitHub ↗

Records timing information for a server resource. :param name: The name of the resource. :type name: string :param duration: The time in seconds to report. Internally, this is rounded to the nearest millisecond. :type duration: float :param desc

(name, duration, description=None)

Source from the content-addressed store, hash-verified

214 @staticmethod
215 @has_context
216 def record_timing(name, duration, description=None):
217 """Records timing information for a server resource.
218
219 :param name: The name of the resource.
220 :type name: string
221
222 :param duration: The time in seconds to report. Internally, this
223 is rounded to the nearest millisecond.
224 :type duration: float
225
226 :param description: A description of the resource.
227 :type description: string or None
228 """
229 request = get_app().backend.request_adapter()
230 timing_information = getattr(request.context, "timing_information", {})
231
232 if name in timing_information:
233 raise KeyError(f'Duplicate resource name "{name}" found.')
234
235 timing_information[name] = {"dur": round(duration * 1000), "desc": description}
236
237 setattr(request.context, "timing_information", timing_information)
238
239 @property
240 @has_context

Callers 1

xFunction · 0.80

Calls 1

get_appFunction · 0.90

Tested by 1

xFunction · 0.64