Debugging runs in an IDE
To stop at a breakpoint in your run() function, debug one run: qa run on one input, as a Python module, in your
IDE. Debugging qa batch doesn't work: its runs execute in other processes (with --runner local), or on other
machines (with a cluster's runner), where your debugger can't follow.
Find the run's command
Take the qa run command of the run you want to debug:
-
From a batch:
qa --dryrun batch ciprints each run's command, and its output directory, without running anything. In the detector's project:qa --dryrun batch ciqa --configuration fp32:size-320 run --input "slices/indoor"/home/arjun/detector/output/7622c337-20/slices-indoorqa --configuration fp32:size-320 run --input "slices/outdoor"/home/arjun/detector/output/7622c337-20/slices-outdoor...qa batch ci --listprints the same as JSON, with each run'scommand. -
From a CI run: the first line of its log, in the web app's Logs view, is its
qa runcommand.
Then give your IDE the arguments that come after qa.
VS Code
Add a configuration to .vscode/launch.json (Run > Add Configuration...):
{
"version": "0.2.0",
"configurations": [
{
"name": "qa run",
"type": "debugpy",
"request": "launch",
"module": "qaboard",
"cwd": "${workspaceFolder}",
"args": ["--configuration", "int8:size-320", "run", "--input", "slices/small-objects"]
}
]
}
moduleisqaboard: VS Code runspython -m qaboard, which isqa.argsare the arguments afterqa. Debug arun, not abatch.cwdis the folder with your qaboard.yaml.
Don't start args with "--": qa treats everything after -- as arguments forwarded to your code, so the command
would be ignored.
See VS Code's Python debugging docs for the other options.
PyCharm
In Run > Edit Configurations..., add a Python configuration:
- In the script/module selector, choose Module, not Script, and enter
qaboard. - Parameters: the arguments after
qa, like--configuration int8:size-320 run --input slices/small-objects. Debug arun, not abatch. - Working directory: the folder with your qaboard.yaml.
Then start it with Debug: PyCharm stops at the breakpoints in your run().
If qa complains about the locale, add the environment variables LC_ALL=en_US.utf8 and LANG=en_US.utf8 to the
configuration.