Typing
async_kernel.typing ¶
Classes:
-
Job
–An async_kernel.typing.Message bundled with sockit_id, socket and ident.
-
KernelConcurrencyMode
– -
Message
–A message.
-
MetadataKeys
–This is an enum of keys for metadata in kernel messages
-
MsgHeader
– -
MsgType
–An enumeration of Message
msg_type
for shell and control messages. -
RunMode
–An Enum of the kernel run modes available for
-
SocketID
–Mapping of
Kernel.port_<id>
for sockets. Ref. -
Tags
–Tags recognised by the kernel.
ExecuteContent ¶
Attributes:
-
allow_stdin
(bool
) – -
code
(str
) –The code to execute.
-
silent
(bool
) – -
stop_on_error
(bool
) – -
store_history
(bool
) – -
user_expressions
(dict[str, str]
) –
Job ¶
KernelConcurrencyMode ¶
Attributes:
Message ¶
MetadataKeys ¶
This is an enum of keys for metadata in kernel messages that are used in async_kernel.
Note
Metadata can be edited in Jupyter lab "Advanced tools" and Tags can be added using "common tools" in the right side bar.
Attributes:
-
suppress_error_message
–A message to print when the error has been suppressed using async_kernel.typing.Tags.suppress_error.
-
tags
–The
tags
metadata key corresponds to is a list of strings. -
timeout
–The
timeout
metadata key is used to specify a timeout for execution of the code.
suppress_error_message
class-attribute
instance-attribute
¶
suppress_error_message = 'suppress-error-message'
A message to print when the error has been suppressed using async_kernel.typing.Tags.suppress_error.
Note
The default message is '⚠'.
tags
class-attribute
instance-attribute
¶
tags = 'tags'
The tags
metadata key corresponds to is a list of strings.
The list can be edited by the user in a notebook. see also: Tags.
timeout
class-attribute
instance-attribute
¶
timeout = 'timeout'
The timeout
metadata key is used to specify a timeout for execution of the code.
The value should be a floating point value of the timeout in seconds.
MsgHeader ¶
Attributes:
MsgType ¶
An enumeration of Message msg_type
for shell and control messages.
Some message types are on the control channel only.
Attributes:
-
comm_close
– -
comm_info_request
– -
comm_msg
– -
comm_open
– -
complete_request
– -
debug_request
–async_kernel.Kernel.debug_request (control channel only)
-
execute_request
– -
history_request
– -
inspect_request
– -
interrupt_request
–async_kernel.Kernel.interrupt_request (control channel only)
-
is_complete_request
– -
kernel_info_request
– -
shutdown_request
–async_kernel.Kernel.shutdown_request (control channel only)
comm_close
class-attribute
instance-attribute
¶
comm_close = 'comm_close'
comm_info_request
class-attribute
instance-attribute
¶
comm_info_request = 'comm_info_request'
comm_open
class-attribute
instance-attribute
¶
comm_open = 'comm_open'
complete_request
class-attribute
instance-attribute
¶
complete_request = 'complete_request'
debug_request
class-attribute
instance-attribute
¶
debug_request = 'debug_request'
async_kernel.Kernel.debug_request (control channel only)
execute_request
class-attribute
instance-attribute
¶
execute_request = 'execute_request'
history_request
class-attribute
instance-attribute
¶
history_request = 'history_request'
inspect_request
class-attribute
instance-attribute
¶
inspect_request = 'inspect_request'
interrupt_request
class-attribute
instance-attribute
¶
interrupt_request = 'interrupt_request'
async_kernel.Kernel.interrupt_request (control channel only)
is_complete_request
class-attribute
instance-attribute
¶
is_complete_request = 'is_complete_request'
kernel_info_request
class-attribute
instance-attribute
¶
kernel_info_request = 'kernel_info_request'
shutdown_request
class-attribute
instance-attribute
¶
shutdown_request = 'shutdown_request'
async_kernel.Kernel.shutdown_request (control channel only)
RunMode ¶
An Enum of the kernel run modes available for altering how message requests are run.
String match options
Each of these options will give a match.
<value>
<##value>
- '
RunMode.<value>
.
special usage
Run mode can be used in execute requests.
Add it at the top line (or use the string equivalent "##
Methods:
-
get_mode
–Get a RunMode from the code if it is found.
Attributes:
-
blocking
–Run the handler directly as soon as it is received.
-
queue
–The message for the handler is run sequentially with other messages that are queued.
-
task
–The message for the handler are run concurrently in task (starting immediately).
-
thread
–Messages for the handler are run concurrently in a thread (starting immediately).
blocking
class-attribute
instance-attribute
¶
blocking = 'blocking'
Run the handler directly as soon as it is received.
Warning
This mode blocks the message loop.
Use this for short running messages that should be processed as soon as it is received.
queue
class-attribute
instance-attribute
¶
queue = 'queue'
The message for the handler is run sequentially with other messages that are queued.
task
class-attribute
instance-attribute
¶
task = 'task'
The message for the handler are run concurrently in task (starting immediately).
thread
class-attribute
instance-attribute
¶
thread = 'thread'
Messages for the handler are run concurrently in a thread (starting immediately).
get_mode
classmethod
¶
Get a RunMode from the code if it is found.
Source code in src/async_kernel/typing.py
84 85 86 87 88 89 90 91 92 93 |
|
Tags ¶
Tags recognised by the kernel.
Info
Tags are can be added per cell.
- Jupyter: via the right side bar.
- VScode: via Jupyter variables explorer/
Attributes:
-
suppress_error
–Suppress exceptions that occur during execution of the code cell.
suppress_error
class-attribute
instance-attribute
¶
suppress_error = 'suppress-error'
Suppress exceptions that occur during execution of the code cell.
Warning
The code block will return as 'ok' and there will be no message recorded.