Debugging Operator
Visual Studio Code (VSCode) supports Remote Debugging through Python extension.
Using the feature, bundled segmentation operators are configured to support debugging while developing/testing operators locally.
(sdk folder)/clara-reference-app/Operators/ai
includes debug_app_docker.sh
script to support debugging AI operator with VSCode.
USAGE: ./debug_app_docker.sh [-p <number>] [app_name] [model_name]
-p <number> Remote debug port number to use (default: 3000)
-h Help message
Args
app_name - application name (e.g., app_livertumor)
model_name - model name (e.g., segmentation_liver_v1)
Examples
./debug_app_docker.sh # Livertumor AI (default)
./debug_app_docker.sh app_braintumor segmentation_mri_brain_tumors_br16_t1c2tc_v1 # Braintumor AI
./debug_app_docker.sh app_vnet # Organ Segmentation AI
Executing ./debug_app_docker.sh
would launch a VSCode window that app.py file is open. Breakpoints can be toggled by clicking on the editor margin or using F9
on the current line (see https://code.visualstudio.com/docs/editor/debugging#_breakpoints).
![VSCodeDebugging_breakpoints.png](https://docscontent.nvidia.com/dims4/default/599c186/2147483647/strip/true/crop/906x730+0+0/resize/906x730!/quality/90/?url=https%3A%2F%2Fk3-prod-nvidia-docs.s3.us-west-2.amazonaws.com%2Fbrightspot%2Fsphinx%2F00000186-1062-d3ba-abf6-31e266690000%2Fclara-holoscan%2Farchive%2Fclara-deploy-0.7.4%2F_images%2FVSCodeDebugging_breakpoints.png)
Since launch.json
file (in .vscode
subfolder) is already configured, you can start your debug session with F5
. Please see Debug actions for more information.
![VSCodeDebugging_break.png](https://docscontent.nvidia.com/dims4/default/5335ec5/2147483647/strip/true/crop/921x638+0+0/resize/921x638!/quality/90/?url=https%3A%2F%2Fk3-prod-nvidia-docs.s3.us-west-2.amazonaws.com%2Fbrightspot%2Fsphinx%2F00000186-1062-d3ba-abf6-31e266690000%2Fclara-holoscan%2Farchive%2Fclara-deploy-0.7.4%2F_images%2FVSCodeDebugging_break.png)
Pressing Ctrl + C
in the terminal or closing the VSCode window would terminate the app and dependent Docker containers/network.