repl: Add restart kernel action and improve shutdown (#16609)

- Implement restart kernel functionality
- Clean up shutdown process to properly drop messaging and exit status
tasks
- Refactor kernel state handling for better consistency

Closes #16037

Release Notes:

- repl: Added restart kernel action
- repl: Fixed issue with shutting down kernels that are in a failure
state
This commit is contained in:
Kyle Kelley 2024-08-21 11:51:58 -07:00 committed by GitHub
parent 9f0438b540
commit 2ad9a742dd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 177 additions and 41 deletions

View file

@ -87,6 +87,7 @@ pub enum KernelStatus {
Error,
ShuttingDown,
Shutdown,
Restarting,
}
impl KernelStatus {
@ -107,6 +108,7 @@ impl ToString for KernelStatus {
KernelStatus::Error => "Error".to_string(),
KernelStatus::ShuttingDown => "Shutting Down".to_string(),
KernelStatus::Shutdown => "Shutdown".to_string(),
KernelStatus::Restarting => "Restarting".to_string(),
}
}
}
@ -122,6 +124,7 @@ impl From<&Kernel> for KernelStatus {
Kernel::ErroredLaunch(_) => KernelStatus::Error,
Kernel::ShuttingDown => KernelStatus::ShuttingDown,
Kernel::Shutdown => KernelStatus::Shutdown,
Kernel::Restarting => KernelStatus::Restarting,
}
}
}
@ -133,6 +136,7 @@ pub enum Kernel {
ErroredLaunch(String),
ShuttingDown,
Shutdown,
Restarting,
}
impl Kernel {
@ -160,7 +164,7 @@ impl Kernel {
pub fn is_shutting_down(&self) -> bool {
match self {
Kernel::ShuttingDown => true,
Kernel::Restarting | Kernel::ShuttingDown => true,
Kernel::RunningKernel(_)
| Kernel::StartingKernel(_)
| Kernel::ErroredLaunch(_)
@ -324,7 +328,7 @@ impl RunningKernel {
_control_task: control_task,
_routing_task: routing_task,
connection_path,
execution_state: ExecutionState::Busy,
execution_state: ExecutionState::Idle,
kernel_info: None,
},
messages_rx,