-
Notifications
You must be signed in to change notification settings - Fork 34.9k
Closed
Labels
*duplicateIssue identified as a duplicate of another issue(s)Issue identified as a duplicate of another issue(s)apinotebookunder-discussionIssue is under discussion for relevance, priority, approachIssue is under discussion for relevance, priority, approach
Description
With #99203 we have removed cancellation tokens from the execute
-functions and replaced them with cancel
-function. This was done because jupyter kernels don't have the notion of canceling an execution but a notion of interrupting the kernel. Those are two different things and the current API is a compromise to fit both worlds. The compromise isn't happy:
- for notebooks that support cancellation of execution things are now much more complex because the cancellation isn't automatically associated with an execution anymore.
- for jupyter kernels it doesn't make sense to implement
cancelAllCellsExecution
andcancelCellExecution
because both are doing the same thing, sending an interrupt to the kernel.
The API should be more explicit in support interrupting kernels. Proposal
export interface NotebookKernel {
executeCell(document: NotebookDocument, cell: NotebookCell, token: CancellationToken): void;
executeAllCells(document: NotebookDocument, token: CancellationToken): void;
interruptExecution?(document: NotebookDocument): void;
}
A notebook kernel can optionally implement an interrupt-function which signals to us that it uses an interrupt model (e.g in the UI all stop buttons call interrupt). The execute-function do have cancellation tokens but the contract would be that they are null-token when using the interrupt model.
roblourens, DonJayamanne and tanhakabir
Metadata
Metadata
Assignees
Labels
*duplicateIssue identified as a duplicate of another issue(s)Issue identified as a duplicate of another issue(s)apinotebookunder-discussionIssue is under discussion for relevance, priority, approachIssue is under discussion for relevance, priority, approach