Skip to content

Kernel Execution

Rich Chiodo edited this page Aug 1, 2022 · 21 revisions

This page describes what happens when we execute a cell in a notebook (or interactive window).

Sequence Diagram

image

Controller and NotebookExecution

The first step is VS code calling into the handler passed in the createNotebookController function. This is the Jupyter Extension's main entry point to execution (Interactive Window is similar, but instead of the VS code calling into the controller, the IW does it itself)

This cell execution goes into a queue of executions (in case multiple cells are run at the same time). The queue then processes the first item in the list and uses that cell to generate a NotebookCellExecution. This tells VS code the cell is starting to execute.

Once the spinner is running on the cell, the actual execution is started. This makes a requestExecute on the actual kernel.

What happens in IPython

The requestExecute made by the typescript code travels to the IPython kernel through a zeromq socket.

IPython is setup like so:

image

There's a Tornado server listening on the opened ports. It translates the 'requestExecute' message into a 'run_cell' request.

How does IPython take over 'print'

Execution result translation

How renderers fit in

Clone this wiki locally