(parser)
| 203 | |
| 204 | |
| 205 | def add_debugging_flags(parser): |
| 206 | from argparse import SUPPRESS |
| 207 | |
| 208 | # For detailed info see: |
| 209 | # https://github.com/treeverse/dvc/wiki/Debugging,-Profiling-and-Benchmarking-DVC |
| 210 | args, _ = parser.parse_known_args() |
| 211 | verbose = args.verbose |
| 212 | |
| 213 | def debug_help(msg): |
| 214 | if verbose: |
| 215 | return msg |
| 216 | return SUPPRESS |
| 217 | |
| 218 | parser = parser.add_argument_group("debug options") |
| 219 | |
| 220 | parser.add_argument( |
| 221 | "--cprofile", |
| 222 | action="store_true", |
| 223 | default=False, |
| 224 | help=debug_help("Generate cprofile data for tools like snakeviz / tuna"), |
| 225 | ) |
| 226 | parser.add_argument( |
| 227 | "--cprofile-dump", help=debug_help("Location to dump cprofile file") |
| 228 | ) |
| 229 | parser.add_argument( |
| 230 | "--yappi", |
| 231 | action="store_true", |
| 232 | default=False, |
| 233 | help=debug_help( |
| 234 | "Generate a callgrind file for use with tools like " |
| 235 | "kcachegrind / qcachegrind" |
| 236 | ), |
| 237 | ) |
| 238 | parser.add_argument( |
| 239 | "--yappi-separate-threads", |
| 240 | action="store_true", |
| 241 | default=False, |
| 242 | help=debug_help("Generate one callgrind file per thread"), |
| 243 | ) |
| 244 | parser.add_argument( |
| 245 | "--viztracer", |
| 246 | action="store_true", |
| 247 | default=False, |
| 248 | help=debug_help("Generate a viztracer file for use with vizviewer"), |
| 249 | ) |
| 250 | parser.add_argument( |
| 251 | "--viztracer-depth", |
| 252 | type=int, |
| 253 | help=debug_help("Set viztracer maximum stack depth"), |
| 254 | ) |
| 255 | parser.add_argument( |
| 256 | "--viztracer-async", |
| 257 | action="store_true", |
| 258 | default=False, |
| 259 | help=debug_help("Treat async tasks as threads"), |
| 260 | ) |
| 261 | parser.add_argument( |
| 262 | "--pdb", |
no test coverage detected