MCPcopy
hub / github.com/treeverse/dvc / debugtools

Function debugtools

dvc/_debug.py:171–202  ·  view source on GitHub ↗
(args: Optional["Namespace"] = None, **kwargs)

Source from the content-addressed store, hash-verified

169
170@contextmanager
171def debugtools(args: Optional["Namespace"] = None, **kwargs):
172 kw = vars(args) if args else {}
173 kw.update(kwargs)
174
175 with ExitStack() as stack:
176 if kw.get("pdb"):
177 stack.enter_context(debug())
178 if kw.get("cprofile") or kw.get("cprofile_dump"):
179 stack.enter_context(profile(kw.get("cprofile_dump")))
180 if kw.get("instrument") or kw.get("instrument_open"):
181 stack.enter_context(instrument(kw.get("instrument_open", False)))
182 if kw.get("show_stack", False):
183 stack.enter_context(show_stack())
184 if kw.get("yappi"):
185 path_func = _get_path_func("callgrind", "out")
186 stack.enter_context(
187 yappi_profile(
188 path=path_func,
189 separate_threads=kw.get("yappi_separate_threads"),
190 )
191 )
192 if (
193 kw.get("viztracer")
194 or kw.get("viztracer_depth")
195 or kw.get("viztracer_async")
196 ):
197 path_func = _get_path_func("viztracer", "json")
198 depth = kw.get("viztracer_depth") or -1
199 log_async = kw.get("viztracer_async") or False
200 prof = viztracer_profile(path=path_func, depth=depth, log_async=log_async)
201 stack.enter_context(prof)
202 yield
203
204
205def add_debugging_flags(parser):

Callers 1

mainFunction · 0.90

Calls 9

debugFunction · 0.85
profileFunction · 0.85
instrumentFunction · 0.85
show_stackFunction · 0.85
_get_path_funcFunction · 0.85
yappi_profileFunction · 0.85
viztracer_profileFunction · 0.85
updateMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected