MCPcopy Create free account
hub / github.com/celery/celery / objgraph

Function objgraph

celery/worker/control.py:522–543  ·  view source on GitHub ↗

Create graph of uncollected objects (memory-leak debugging). Arguments: num (int): Max number of objects to graph. max_depth (int): Traverse at most n levels deep. type (str): Name of object to graph. Default is ``"Request"``.

(state, num=200, max_depth=10, type='Request')

Source from the content-addressed store, hash-verified

520 signature='[object_type=Request] [num=200 [max_depth=10]]',
521)
522def objgraph(state, num=200, max_depth=10, type='Request'): # pragma: no cover
523 """Create graph of uncollected objects (memory-leak debugging).
524
525 Arguments:
526 num (int): Max number of objects to graph.
527 max_depth (int): Traverse at most n levels deep.
528 type (str): Name of object to graph. Default is ``"Request"``.
529 """
530 try:
531 import objgraph as _objgraph
532 except ImportError:
533 raise ImportError('Requires the objgraph library')
534 logger.info('Dumping graph for type %r', type)
535 with tempfile.NamedTemporaryFile(prefix='cobjg',
536 suffix='.png', delete=False) as fh:
537 objects = _objgraph.by_type(type)[:num]
538 _objgraph.show_backrefs(
539 objects,
540 max_depth=max_depth, highlight=lambda v: v in objects,
541 filename=fh.name,
542 )
543 return {'filename': fh.name}
544
545
546@inspect_command()

Callers

nothing calls this directly

Calls 1

infoMethod · 0.45

Tested by

no test coverage detected