Skip to content
Snippets Groups Projects
Commit e215140a authored by PEDRENOMANR's avatar PEDRENOMANR
Browse files

Added tutorial for debugging with VSCode

Draft of tutorial to configure environment and VSCode to debug individual TFS components
parent 70662d96
No related branches found
No related tags found
1 merge request!54Release 2.0.0
...@@ -7,3 +7,4 @@ this guide assumes you are using the Oracle VirtualBox-based VM running MicroK8s ...@@ -7,3 +7,4 @@ this guide assumes you are using the Oracle VirtualBox-based VM running MicroK8s
## Table of Content: ## Table of Content:
- [3.1. Configure VSCode and Connect to the VM](./3-1-configure-vscode.md) - [3.1. Configure VSCode and Connect to the VM](./3-1-configure-vscode.md)
- [3.2. Development Commands, Tricks, and Hints (WORK IN PROGRESS)](./3-2-develop-cth.md) - [3.2. Development Commands, Tricks, and Hints (WORK IN PROGRESS)](./3-2-develop-cth.md)
- [3.3. Debugging individual components in VSCode](./3.3-debug-comp.md)
# 3.3 Debugging individual components in VSCode
## 3.3.1 Source TeraFlow environment variables into .bashrc
With any text editor, open the file `~/.bashrc` and add the following line at the end:
```bash
source ~/tfs-ctrl/tfs_runtime_env_vars.sh
```
"tfs-ctrl" can be substituted by the appropriate path where the controller is deployed.
## 3.3.2 Install VSCode Python extensions
The following extensions are required to execute and debug TeraFlow components in VSCode:
- *Python*. New versions of the extension are known to have some unsolved bugs, it is recommended to downgrade to version **v2022.10.0**. Go to the extension window, select Python, click the arrow next to the "Uninstall" button and select "Install Another Version..."
- *Pylance*
## 3.3.3 Configure VSCode workspace and launch settings
Run VSCode and open the folder with the source code of TeraFlow, this will be the main workspace. Create (if it does not exist) the subfolder `.vscode`. Inside, create and edit the following files:
- `settings.json`
```bash
{
"python.analysis.extraPaths": ["<HOME>/.pyenv/versions/3.9.7/envs/teraflow/lib/python3.9/site-packages"],
}
```
`<HOME>` should be replaced by the path of your home folder. If in the future another version of Python is used, or the virtual environment changes, this file should be updated to reflect the new path of the installed pip packages.
- `launch.json`
```bash
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "TFS compute.service",
"module": "compute.service",
"python": "${command:python.interpreterPath}",
"type": "python",
"request": "launch",
"justMyCode": true,
"console": "internalConsole",
"env": {
"PYTHONPATH": "${config:python.analysis.extraPaths}:${workspaceRoot}/src",
"LOG_LEVEL": "DEBUG",
}
}
]
}
```
This file contains the configuration necessary to execute the `"compute"` component from the TeraFlow controller, while providing debugging capabilities (e.g., breaking points, console log output etc.). After saving, the debugging can be started from the "Run and Debug" menu.
Additional profiles can be added to the JSON file under the `"configurations"` arrray. Copy & paste the existing one and change the `"name"` and `"module"` fields.
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment