mdadash.backend.kernel.manager
Manager that manages the jupyter_client’s AsyncKernelManager
Classes
|
Kernel Manager |
- class mdadash.backend.kernel.manager.KernelManager(sm: StateManager, sio: AsyncServer)[source]
Bases:
objectKernel Manager
This class is responsible for managing the AsyncKernelManager (async kernel) that runs all the MDAnalysis code. It takes care of starting the async kernel, stopping it and communicating with it. It interfaces with the CommHandler on the kernel side for messaging.
- Parameters:
sm (
StateManager) – Instance of the state managersio (
socketio.AsyncServer) – Instance of the socket.io server
- async connect_to_simulations() dict[source]
Connect to the MD simulation
- Returns:
response – Response dict indicating status. This has the following keys:
- status
String indication status: ‘ok’ or ‘error’
- message
An error message string when status is ‘error’
- Return type:
- async disconnect_from_simulations() dict[source]
Disconnect from the MD simulation
- Returns:
response – Response dict indicating status. This has the following keys:
- status
String indication status: ‘ok’ or ‘error’
- message
An error message string when status is ‘error’
- Return type:
- async execute_code(code: str, timeout: int = 5) str[source]
Execute code in the kernel
- Parameters:
code (str) – Code to execute in the kernel
timeout (int) – Timeout in seconds (default: 5)
- Returns:
response – A string representation of the output of the code executed
- Return type:
- async pause_simulations() dict[source]
Pause MD simulations
- Returns:
response – Response dict indicating status. This has the following keys:
- status
String indication status: ‘ok’ or ‘error’
- message
An error message string when status is ‘error’
- Return type:
- async resume_simulations() dict[source]
Resume MD simulations
- Returns:
response – Response dict indicating status. This has the following keys:
- status
String indication status: ‘ok’ or ‘error’
- message
An error message string when status is ‘error’
- Return type:
- async send_message(msg_type: str, data: dict) None[source]
Send message to kernel and don’t await a response
- Parameters:
msg_type (str) – A message type string that the kernel has a handler registered for
data (dict) – Dict that gets passed to the handler in the kernel
- async send_message_await_response(msg_type: str, data: dict = None, timeout: int = 5) dict | None[source]
Send message to kernel and wait for a response (async)
- Parameters:
msg_type (str) – A message type string that the kernel has a handler registered for
data (dict) – Dict that gets passed to the handler in the kernel (default: None)
timeout (int) – Timeout in seconds (default: 5)
- Returns:
response – Response dict indicating status. This has the following keys:
- status
String indication status: ‘ok’ or ‘error’
- message
An error message string when status is ‘error’
- Return type: