Class: BaseKernel
#
@jupyterlite/kernel.BaseKernel
A base kernel class handling basic kernel messaging.
Implements#
Constructors#
constructor
#
new BaseKernel
(options
)
Construct a new BaseKernel.
Parameters#
Name |
Type |
Description |
---|---|---|
|
The instantiation options for a BaseKernel. |
Defined in#
Properties#
_disposed
#
Private
_disposed
:Signal
<BaseKernel
,void
>
Defined in#
_executionCount
#
Private
_executionCount
:number
=0
Defined in#
_history
#
Private
_history
: [number
,number
,string
][] =[]
Defined in#
_id
#
Private
_id
:string
Defined in#
_isDisposed
#
Private
_isDisposed
:boolean
=false
Defined in#
_location
#
Private
_location
:string
Defined in#
_name
#
Private
_name
:string
Defined in#
_parent
#
Private
_parent
:undefined
|IMessage
<MessageType
> =undefined
Defined in#
_parentHeader
#
Private
_parentHeader
:undefined
|IHeader
<MessageType
> =undefined
Defined in#
_sendMessage
#
Private
_sendMessage
:SendMessage
Defined in#
Accessors#
disposed
#
get
disposed
():ISignal
<this
,void
>
A signal emitted when the kernel is disposed.
Returns#
ISignal
<this
, void
>
Implementation of#
Defined in#
executionCount
#
get
executionCount
():number
The current execution count
Returns#
number
Defined in#
id
#
get
id
():string
Get the kernel id
Returns#
string
Implementation of#
Defined in#
isDisposed
#
get
isDisposed
():boolean
Return whether the kernel is disposed.
Returns#
boolean
Implementation of#
Defined in#
location
#
get
location
():string
The location in the virtual filesystem from which the kernel was started.
Returns#
string
Implementation of#
Defined in#
name
#
get
name
():string
Get the name of the kernel
Returns#
string
Implementation of#
Defined in#
parent
#
get
parent
():undefined
|IMessage
<MessageType
>
Get the last parent message (mimic ipykernel’s get_parent)
Returns#
undefined
| IMessage
<MessageType
>
Defined in#
parentHeader
#
get
parentHeader
():undefined
|IHeader
<MessageType
>
Get the last parent header
Returns#
undefined
| IHeader
<MessageType
>
Defined in#
ready
#
get
ready
():Promise
<void
>
A promise that is fulfilled when the kernel is ready.
Returns#
Promise
<void
>
Implementation of#
Defined in#
Methods#
_busy
#
Private
_busy
(parent
):void
Send a ‘busy’ status message.
Parameters#
Name |
Type |
Description |
---|---|---|
|
|
The parent message. |
Returns#
void
Defined in#
_complete
#
Private
_complete
(msg
):Promise
<void
>
Handle an complete_request message
Parameters#
Name |
Type |
Description |
---|---|---|
|
|
The parent message. |
Returns#
Promise
<void
>
Defined in#
_execute
#
Private
_execute
(msg
):Promise
<void
>
Handle an execute_request message.
Parameters#
Name |
Type |
Description |
---|---|---|
|
|
The parent message. |
Returns#
Promise
<void
>
Defined in#
_executeInput
#
Private
_executeInput
(msg
):void
Send an execute_input
message.
Parameters#
Name |
Type |
Description |
---|---|---|
|
|
The parent message. |
Returns#
void
Defined in#
_historyRequest
#
Private
_historyRequest
(msg
):Promise
<void
>
Handle a history_request
message
Parameters#
Name |
Type |
Description |
---|---|---|
|
|
The parent message. |
Returns#
Promise
<void
>
Defined in#
_idle
#
Private
_idle
(parent
):void
Send an ‘idle’ status message.
Parameters#
Name |
Type |
Description |
---|---|---|
|
|
The parent message |
Returns#
void
Defined in#
_inspect
#
Private
_inspect
(msg
):Promise
<void
>
Handle an inspect_request message
Parameters#
Name |
Type |
Description |
---|---|---|
|
|
The parent message. |
Returns#
Promise
<void
>
Defined in#
_isCompleteRequest
#
Private
_isCompleteRequest
(msg
):Promise
<void
>
Handle an is_complete_request message
Parameters#
Name |
Type |
Description |
---|---|---|
|
|
The parent message. |
Returns#
Promise
<void
>
Defined in#
_kernelInfo
#
Private
_kernelInfo
(parent
):Promise
<void
>
Handle a kernel_info_request message
Parameters#
Name |
Type |
Description |
---|---|---|
|
|
The parent message. |
Returns#
Promise
<void
>
Defined in#
clearOutput
#
Protected
clearOutput
(content
,parentHeader?
):void
Send a clear_output
message to the client.
Parameters#
Name |
Type |
Default value |
Description |
---|---|---|---|
|
|
|
The clear_output content. |
|
|
|
- |
|
|
|
The parent header. |
Returns#
void
Defined in#
commClose
#
Abstract
commClose
(msg
):Promise
<void
>
Send an comm_close
message.
Parameters#
Name |
Type |
---|---|
|
|
Returns#
Promise
<void
>
Defined in#
commInfoRequest
#
Abstract
commInfoRequest
(content
):Promise
<ReplyContent
<ICommInfoReply
>>
Handle a comm_info_request
message.
Parameters#
Name |
Type |
Description |
---|---|---|
|
|
The content of the request. |
|
|
The comm target name to filter returned comms |
Returns#
Promise
<ReplyContent
<ICommInfoReply
>>
A promise that resolves with the response message.
Defined in#
commMsg
#
Abstract
commMsg
(msg
):Promise
<void
>
Send an comm_msg
message.
Parameters#
Name |
Type |
Description |
---|---|---|
|
|
The comm_msg message. |
Returns#
Promise
<void
>
Defined in#
commOpen
#
Abstract
commOpen
(msg
):Promise
<void
>
Send an comm_open
message.
Parameters#
Name |
Type |
Description |
---|---|---|
|
|
The comm_open message. |
Returns#
Promise
<void
>
Defined in#
completeRequest
#
Abstract
completeRequest
(content
):Promise
<ReplyContent
<ICompleteReply
>>
Handle a complete_request
message.
Parameters#
Name |
Type |
Description |
---|---|---|
|
|
The content of the request. |
|
|
- |
|
|
- |
Returns#
Promise
<ReplyContent
<ICompleteReply
>>
Defined in#
displayData
#
Protected
displayData
(content
,parentHeader?
):void
Send a display_data
message to the client.
Parameters#
Name |
Type |
Default value |
Description |
---|---|---|---|
|
|
|
The display_data content. |
|
|
|
- |
|
|
|
- |
|
|
|
- |
|
|
|
- |
|
|
|
The parent header. |
Returns#
void
Defined in#
dispose
#
dispose
():void
Dispose the kernel.
Returns#
void
Implementation of#
Defined in#
executeRequest
#
Abstract
executeRequest
(content
):Promise
<Object
>
Handle an execute_request
message.
Parameters#
Name |
Type |
Description |
---|---|---|
|
|
The content of the execute_request kernel message |
|
|
Whether to allow stdin requests. The default is |
|
|
The code to execute. |
|
|
Whether to execute the code as quietly as possible. The default is |
|
|
Whether to the abort execution queue on an error. The default is |
|
|
Whether to store history of the execution. The default |
|
|
A mapping of names to expressions to be evaluated in the kernel’s interactive namespace. |
Returns#
Promise
<Object
>
Defined in#
handleComm
#
Protected
handleComm
(type
,content
,metadata
,buffers
,parentHeader?
):void
Send a comm
message to the client.
Parameters#
Name |
Type |
Default value |
---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Returns#
void
Defined in#
handleMessage
#
handleMessage
(msg
):Promise
<void
>
Handle an incoming message from the client.
Parameters#
Name |
Type |
Description |
---|---|---|
|
|
The message to handle |
Returns#
Promise
<void
>
Implementation of#
Defined in#
inputReply
#
Abstract
inputReply
(content
):void
Send an input_reply
message.
Parameters#
Name |
Type |
Description |
---|---|---|
|
|
The content of the reply. |
Returns#
void
Defined in#
inputRequest
#
Protected
inputRequest
(content
,parentHeader?
):void
Send a input_request
message to the client.
Parameters#
Name |
Type |
Default value |
Description |
---|---|---|---|
|
|
|
The input_request content. |
|
|
|
Whether the request is for a password. If so, the frontend shouldn’t echo input. |
|
|
|
The text to show at the prompt. |
|
|
|
The parent header. |
Returns#
void
Defined in#
inspectRequest
#
Abstract
inspectRequest
(content
):Promise
<ReplyContent
<IInspectReply
>>
Handle an inspect_request
message.
Parameters#
Name |
Type |
Description |
---|---|---|
|
|
The content of the request. |
|
|
- |
|
|
- |
|
|
- |
Returns#
Promise
<ReplyContent
<IInspectReply
>>
A promise that resolves with the response message.
Defined in#
isCompleteRequest
#
Abstract
isCompleteRequest
(content
):Promise
<ReplyContent
<IIsCompleteReplyIncomplete
|IIsCompleteReplyOther
>>
Handle an is_complete_request
message.
Parameters#
Name |
Type |
Description |
---|---|---|
|
|
The content of the request. |
|
|
- |
Returns#
Promise
<ReplyContent
<IIsCompleteReplyIncomplete
| IIsCompleteReplyOther
>>
A promise that resolves with the response message.
Defined in#
kernelInfoRequest
#
Abstract
kernelInfoRequest
():Promise
<ReplyContent
<IInfoReply
>>
Handle a kernel_info_request
message.
Returns#
Promise
<ReplyContent
<IInfoReply
>>
A promise that resolves with the kernel info.
Defined in#
publishExecuteError
#
Protected
publishExecuteError
(content
,parentHeader?
):void
Send an error
message to the client.
Parameters#
Name |
Type |
Default value |
Description |
---|---|---|---|
|
|
|
The error content. |
|
|
|
- |
|
|
|
- |
|
|
|
- |
|
|
|
The parent header. |
Returns#
void
Defined in#
publishExecuteResult
#
Protected
publishExecuteResult
(content
,parentHeader?
):void
Send an execute_result
message.
Parameters#
Name |
Type |
Default value |
Description |
---|---|---|---|
|
|
|
The execute result content. |
|
|
|
- |
|
|
|
- |
|
|
|
- |
|
|
|
- |
|
|
|
- |
|
|
|
The parent header. |
Returns#
void
Defined in#
stream
#
Protected
stream
(content
,parentHeader?
):void
Stream an event from the kernel
Parameters#
Name |
Type |
Default value |
Description |
---|---|---|---|
|
|
|
The stream content. |
|
|
|
- |
|
|
|
- |
|
|
|
The parent header. |
Returns#
void
Defined in#
updateDisplayData
#
Protected
updateDisplayData
(content
,parentHeader?
):void
Send a update_display_data
message to the client.
Parameters#
Name |
Type |
Default value |
Description |
---|---|---|---|
|
{ |
|
The update_display_data content. |
|
|
|
The parent header. |
Returns#
void