Skip to main content

Python Debugging

Raftt supports interactive Python debugging using JetBrains IDEs and VS Code.

To debug with Raftt, you must first install Raftt's IDE plugin. See here for installation instructions.

Configuration

The configuration differs between different IDEs.

To debug with Raftt, start by defining a "standard" debug configuration, as if you would debug the process locally. For help creating such a configuration, see JetBrains docs.

Then, you only need to add a single env var called RAFTT_WORKLOAD stating the workload to debug. For example, here you can see the configuration for debugging the recommendations service, as a part of our tutorial -

Python run/debug config in IntelliJ

Debugging a sidecar container

To debug a sidecar container, add an additional env var - RAFTT_CONTAINER, whose value is the debugged container name. If not stated, the selected container is the workload's main container - either the one annotated as default, or if no container is annotated - the first one in the manifest.

Note

The Python interpreter that is used while debugging is the one installed in the remote container, not the one in the run/debug config.
You can even omit its definition, but you'll get a warning message you'll have to skip every time you run/debug with Raftt.

tip

To easily share your run/debug configuration with the rest of the team, mark the "store as project file" checkbox and commit the new file, typically located under .run, to the repo.

Debugging

Once you completed the configuration, you can experience fully-featured interactive debugging directly in your cluster, including breakpoints, stepping, watching and modifying variables, etc..
The method for starting a run/debug session with Raftt differs between different IDEs -

To start a run/debug session with Raftt, use the Run with Raftt or Debug with Raftt blue buttons, or select these options from the Run menu.

Run/debug with Raftt buttons in IntelliJ