Skip to content

How notebook run by line works

Rich Chiodo edited this page Jul 25, 2022 · 5 revisions

Notebook Run by line is very close to debugging a cell. The differences in the sequence diagram are highlighted below:

image

Differences are described below.

Different controller

Instead of a DebugCellController, a RunByLineController is created. This class intercepts messages from the debugger differently than the DebugCellController does. This intercepting is done in the willSendEvent override.

Overriding what happens on a stop event

In a run by line situation, the IP indicator is only supposed to step over lines in the cell. Internally this is done by doing a step into over and over. If the step into falls into another cell (or another module), the RunByLineController issues another step to continue until the IP indicator lands in the cell again.

That is happening in this sequence of events above:

  • willSendEvent for stopped event
  • willSendEvent says true, so KernelDebugAdapter does not send the stopped event to VS code
  • willSendEvent issues a 'stepin' request to the adapter
  • KernelDebugAdapter issues a 'customRequest' to the debugger
  • VS Code turns that custom request into a message
  • KernelDebugAdapter sends the request to debugpy inside the kernel
Clone this wiki locally