Use the Databricks interactive debugger
Important
This feature is in Public Preview.
This page describes how to use the built-in interactive debugger in the Databricks notebook. The debugger is available only for Python.
The interactive debugger provides breakpoints, step-by-step execution, variable inspection, and more tools to help you develop code in notebooks more efficiently.
Requirements
Your notebook must be attached to a cluster that meets the following requirements:
- Databricks Runtime version 13.3 LTS or above.
- The access mode must be Single user (Assigned) or No isolation shared.
Enable or disable the debugger
To enable or disable the debugger, do the following:
- Click your username at the upper-right of the workspace and select Settings from the dropdown list.
- In the Settings sidebar, select Developer.
- In the Experimental features section, toggle Python Notebook Interactive Debugger.
Start the debugger
To start the debugger, follow these steps:
Add one or more breakpoints by clicking in the gutter of a cell. To remove a breakpoint, click on it again.
Do one of the following:
- Click Run > Debug cell.
- Use the keyboard shortcut Ctrl + Shift + D.
- From the cell run menu, select Debug cell.
A debug session starts automatically and runs the selected cell.
You can also start the debugger if a cell triggers an error. At the bottom of the cell output, click .
When a debug session is active, the debug toolbar appears at the top of the cell.
Use the debugger
In a debug session, you can do the following:
- Set or remove breakpoints.
- View the values of variables at a breakpoint.
- Step through the code.
- Step into or out of a function.
When the code reaches a breakpoint, it stops before the line is run, not after.
Use the buttons in the debugger toolbar to step through the code. As you step through the code, the current line is highlighted in the cell. You can view variable values in the variable explorer pane in the right sidebar.
When you step through a function, local function variables appear in the variable pane, marked [local]
.
Terminate a debugger session
To end the debugging session, click at the upper-left of the cell or click at the top of the notebook.
Limitations
See Known limitations Databricks notebooks for more more information.
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for