@jupyterlite / @jupyterlite/services / BaseKernel
Class: abstract BaseKernel#
Defined in: packages/services/src/kernel/base.ts:11
A base kernel class handling basic kernel messaging.
Implements#
Constructors#
Constructor#
new BaseKernel(
options):BaseKernel
Defined in: packages/services/src/kernel/base.ts:17
Construct a new BaseKernel.
Parameters#
options#
The instantiation options for a BaseKernel.
Returns#
BaseKernel
Accessors#
disposed#
Get Signature#
get disposed():
ISignal<this,void>
Defined in: packages/services/src/kernel/base.ts:42
A signal emitted when the kernel is disposed.
Returns#
ISignal<this, void>
A signal emitted when the object is disposed.
Implementation of#
executionCount#
Get Signature#
get executionCount():
number
Defined in: packages/services/src/kernel/base.ts:70
The current execution count
Returns#
number
id#
Get Signature#
get id():
string
Defined in: packages/services/src/kernel/base.ts:49
Get the kernel id
Returns#
string
The id of the server-side kernel.
Implementation of#
isDisposed#
Get Signature#
get isDisposed():
boolean
Defined in: packages/services/src/kernel/base.ts:35
Return whether the kernel is disposed.
Returns#
boolean
Test whether the object has been disposed.
Notes#
This property is always safe to access.
Implementation of#
location#
Get Signature#
get location():
string
Defined in: packages/services/src/kernel/base.ts:63
The location in the virtual filesystem from which the kernel was started.
Returns#
string
The location in the virtual filesystem from which the kernel was started.
Implementation of#
name#
Get Signature#
get name():
string
Defined in: packages/services/src/kernel/base.ts:56
Get the name of the kernel
Returns#
string
The name of the server-side kernel.
Implementation of#
parent#
Get Signature#
get parent():
undefined|IMessage<MessageType>
Defined in: packages/services/src/kernel/base.ts:84
Get the last parent message (mimic ipykernel’s get_parent)
Returns#
undefined | IMessage<MessageType>
parentHeader#
Get Signature#
get parentHeader():
undefined|IHeader<MessageType>
Defined in: packages/services/src/kernel/base.ts:77
Get the last parent header
Returns#
undefined | IHeader<MessageType>
ready#
Get Signature#
get ready():
Promise<void>
Defined in: packages/services/src/kernel/base.ts:28
A promise that is fulfilled when the kernel is ready.
Returns#
Promise<void>
A promise that is fulfilled when the kernel is ready.
Implementation of#
Methods#
clearOutput()#
protectedclearOutput(content,parentHeader):void
Defined in: packages/services/src/kernel/base.ts:393
Send a clear_output message to the client.
Parameters#
content#
The clear_output content.
wait#
boolean
parentHeader#
The parent header.
undefined | IHeader<MessageType>
Returns#
void
commClose()#
abstractcommClose(msg):Promise<void>
Defined in: packages/services/src/kernel/base.ts:232
Send an comm_close message.
Parameters#
msg#
ICommCloseMsg
Returns#
Promise<void>
commInfoRequest()#
abstractcommInfoRequest(content):Promise<ReplyContent<ICommInfoReply>>
Defined in: packages/services/src/kernel/base.ts:202
Handle a comm_info_request message.
Parameters#
content#
The content of the request.
target_name?#
string
The comm target name to filter returned comms
Returns#
Promise<ReplyContent<ICommInfoReply>>
A promise that resolves with the response message.
commMsg()#
abstractcommMsg(msg):Promise<void>
Defined in: packages/services/src/kernel/base.ts:225
Send an comm_msg message.
Parameters#
msg#
ICommMsgMsg
The comm_msg message.
Returns#
Promise<void>
commOpen()#
abstractcommOpen(msg):Promise<void>
Defined in: packages/services/src/kernel/base.ts:218
Send an comm_open message.
Parameters#
msg#
ICommOpenMsg
The comm_open message.
Returns#
Promise<void>
completeRequest()#
abstractcompleteRequest(content):Promise<ReplyContent<ICompleteReply>>
Defined in: packages/services/src/kernel/base.ts:169
Handle a complete_request message.
Parameters#
content#
The content of the request.
code#
string
cursor_pos#
number
Returns#
Promise<ReplyContent<ICompleteReply>>
displayData()#
protecteddisplayData(content,parentHeader):void
Defined in: packages/services/src/kernel/base.ts:265
Send a display_data message to the client.
Parameters#
content#
The display_data content.
data#
IMimeBundle
metadata#
PartialJSONObject
transient?#
{ display_id: string; }
transient.display_id?#
string
parentHeader#
The parent header.
undefined | IHeader<MessageType>
Returns#
void
dispose()#
dispose():
void
Defined in: packages/services/src/kernel/base.ts:91
Dispose the kernel.
Returns#
void
Implementation of#
executeRequest()#
abstractexecuteRequest(content):Promise<ReplyContent<IExecuteReply> &IExecuteCount>
Defined in: packages/services/src/kernel/base.ts:160
Handle an execute_request message.
Parameters#
content#
The content of the execute_request kernel message
allow_stdin?#
boolean
Whether to allow stdin requests.
The default is true.
code#
string
The code to execute.
silent?#
boolean
Whether to execute the code as quietly as possible.
The default is false.
stop_on_error?#
boolean
Whether to the abort execution queue on an error.
The default is false.
store_history?#
boolean
Whether to store history of the execution.
The default true if silent is False.
It is forced to false if silent is true.
user_expressions?#
JSONObject
A mapping of names to expressions to be evaluated in the kernel’s interactive namespace.
Returns#
Promise<ReplyContent<IExecuteReply> & IExecuteCount>
handleComm()#
protectedhandleComm(type,content,metadata,buffers,parentHeader):void
Defined in: packages/services/src/kernel/base.ts:417
Send a comm message to the client.
Parameters#
type#
"comm_close" | "comm_msg" | "comm_open"
content#
comm_id#
string
data#
JSONObject
metadata#
JSONObject
buffers#
undefined | (ArrayBufferView | ArrayBuffer)[]
parentHeader#
undefined | IHeader<MessageType>
Returns#
void
handleMessage()#
handleMessage(
msg):Promise<void>
Defined in: packages/services/src/kernel/base.ts:104
Handle an incoming message from the client.
Parameters#
msg#
IMessage
The message to handle
Returns#
Promise<void>
Implementation of#
inputReply()#
abstractinputReply(content):void
Defined in: packages/services/src/kernel/base.ts:211
Send an input_reply message.
Parameters#
content#
ReplyContent<IInputReply>
The content of the reply.
Returns#
void
inputRequest()#
protectedinputRequest(content,parentHeader):void
Defined in: packages/services/src/kernel/base.ts:293
Send a input_request message to the client.
Parameters#
content#
The input_request content.
password#
boolean
Whether the request is for a password. If so, the frontend shouldn’t echo input.
prompt#
string
The text to show at the prompt.
parentHeader#
The parent header.
undefined | IHeader<MessageType>
Returns#
void
inspectRequest()#
abstractinspectRequest(content):Promise<ReplyContent<IInspectReply>>
Defined in: packages/services/src/kernel/base.ts:180
Handle an inspect_request message.
Parameters#
content#
The content of the request.
code#
string
cursor_pos#
number
detail_level#
0 | 1
Returns#
Promise<ReplyContent<IInspectReply>>
A promise that resolves with the response message.
isCompleteRequest()#
abstractisCompleteRequest(content):Promise<ReplyContent<IIsCompleteReplyIncomplete|IIsCompleteReplyOther>>
Defined in: packages/services/src/kernel/base.ts:191
Handle an is_complete_request message.
Parameters#
content#
The content of the request.
code#
string
Returns#
Promise<ReplyContent<IIsCompleteReplyIncomplete | IIsCompleteReplyOther>>
A promise that resolves with the response message.
kernelInfoRequest()#
abstractkernelInfoRequest():Promise<ReplyContent<IInfoReply>>
Defined in: packages/services/src/kernel/base.ts:153
Handle a kernel_info_request message.
Returns#
Promise<ReplyContent<IInfoReply>>
A promise that resolves with the kernel info.
publishExecuteError()#
protectedpublishExecuteError(content,parentHeader):void
Defined in: packages/services/src/kernel/base.ts:343
Send an error message to the client.
Parameters#
content#
The error content.
ename#
string
evalue#
string
traceback#
string[]
parentHeader#
The parent header.
undefined | IHeader<MessageType>
Returns#
void
publishExecuteResult()#
protectedpublishExecuteResult(content,parentHeader):void
Defined in: packages/services/src/kernel/base.ts:318
Send an execute_result message.
Parameters#
content#
The execute result content.
data#
IMimeBundle
execution_count#
ExecutionCount
metadata#
PartialJSONObject
transient?#
{ display_id: string; }
transient.display_id?#
string
parentHeader#
The parent header.
undefined | IHeader<MessageType>
Returns#
void
stream()#
protectedstream(content,parentHeader):void
Defined in: packages/services/src/kernel/base.ts:240
Stream an event from the kernel
Parameters#
content#
The stream content.
name#
"stdout" | "stderr"
text#
string
parentHeader#
The parent header.
undefined | IHeader<MessageType>
Returns#
void
updateDisplayData()#
protectedupdateDisplayData(content,parentHeader):void
Defined in: packages/services/src/kernel/base.ts:368
Send a update_display_data message to the client.
Parameters#
content#
object & object
The update_display_data content.
parentHeader#
The parent header.
undefined | IHeader<MessageType>
Returns#
void