Skip to content

Commit fa0c750

Browse files
lionel-ConradIrwin
andauthored
Update runtimed to fix compatibility issue with the Ark kernel (#40889)
Closes #40888 This updates runtimed to the latest version, which handles the "starting" variant of `execution_state`. It actually handles a bunch of other variants that are not documented in the protocol (see https://jupyter-client.readthedocs.io/en/stable/messaging.html#kernel-status), like "starting", "terminating", etc. I added implementations for these variants as well. Release Notes: - Fixed issue that prevented the Ark kernel from working in Zed (#40888). --------- Co-authored-by: Conrad Irwin <[email protected]>
1 parent e91be9e commit fa0c750

File tree

6 files changed

+109
-54
lines changed

6 files changed

+109
-54
lines changed

Cargo.lock

Lines changed: 28 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -534,8 +534,8 @@ itertools = "0.14.0"
534534
json_dotpath = "1.1"
535535
jsonschema = "0.30.0"
536536
jsonwebtoken = "9.3"
537-
jupyter-protocol = { git = "https://github.com/ConradIrwin/runtimed", rev = "7130c804216b6914355d15d0b91ea91f6babd734" }
538-
jupyter-websocket-client = { git = "https://github.com/ConradIrwin/runtimed" ,rev = "7130c804216b6914355d15d0b91ea91f6babd734" }
537+
jupyter-protocol = "0.10.0"
538+
jupyter-websocket-client = "0.15.0"
539539
libc = "0.2"
540540
libsqlite3-sys = { version = "0.30.1", features = ["bundled"] }
541541
linkify = "0.10.0"
@@ -548,7 +548,7 @@ minidumper = "0.8"
548548
moka = { version = "0.12.10", features = ["sync"] }
549549
naga = { version = "25.0", features = ["wgsl-in"] }
550550
nanoid = "0.4"
551-
nbformat = { git = "https://github.com/ConradIrwin/runtimed", rev = "7130c804216b6914355d15d0b91ea91f6babd734" }
551+
nbformat = "0.15.0"
552552
nix = "0.29"
553553
num-format = "0.4.4"
554554
num-traits = "0.2"
@@ -619,8 +619,8 @@ reqwest = { git = "https://github.com/zed-industries/reqwest.git", rev = "c15662
619619
"stream",
620620
], package = "zed-reqwest", version = "0.12.15-zed" }
621621
rsa = "0.9.6"
622-
runtimelib = { git = "https://github.com/ConradIrwin/runtimed", rev = "7130c804216b6914355d15d0b91ea91f6babd734", default-features = false, features = [
623-
"async-dispatcher-runtime",
622+
runtimelib = { version = "0.30.0", default-features = false, features = [
623+
"async-dispatcher-runtime", "aws-lc-rs"
624624
] }
625625
rust-embed = { version = "8.4", features = ["include-exclude"] }
626626
rustc-hash = "2.1.0"

crates/repl/src/kernels/mod.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,13 @@ impl From<&Kernel> for KernelStatus {
213213
Kernel::RunningKernel(kernel) => match kernel.execution_state() {
214214
ExecutionState::Idle => KernelStatus::Idle,
215215
ExecutionState::Busy => KernelStatus::Busy,
216+
ExecutionState::Unknown => KernelStatus::Error,
217+
ExecutionState::Starting => KernelStatus::Starting,
218+
ExecutionState::Restarting => KernelStatus::Restarting,
219+
ExecutionState::Terminating => KernelStatus::ShuttingDown,
220+
ExecutionState::AutoRestarting => KernelStatus::Restarting,
221+
ExecutionState::Dead => KernelStatus::Error,
222+
ExecutionState::Other(_) => KernelStatus::Error,
216223
},
217224
Kernel::StartingKernel(_) => KernelStatus::Starting,
218225
Kernel::ErroredLaunch(_) => KernelStatus::Error,

crates/repl/src/outputs.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -476,6 +476,13 @@ impl ExecutionView {
476476
self.status = ExecutionStatus::Executing;
477477
}
478478
ExecutionState::Idle => self.status = ExecutionStatus::Finished,
479+
ExecutionState::Unknown => self.status = ExecutionStatus::Unknown,
480+
ExecutionState::Starting => self.status = ExecutionStatus::ConnectingToKernel,
481+
ExecutionState::Restarting => self.status = ExecutionStatus::Restarting,
482+
ExecutionState::Terminating => self.status = ExecutionStatus::ShuttingDown,
483+
ExecutionState::AutoRestarting => self.status = ExecutionStatus::Restarting,
484+
ExecutionState::Dead => self.status = ExecutionStatus::Shutdown,
485+
ExecutionState::Other(_) => self.status = ExecutionStatus::Unknown,
479486
}
480487
cx.notify();
481488
return;

crates/repl/src/session.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -673,6 +673,13 @@ impl Render for Session {
673673
Kernel::RunningKernel(kernel) => match kernel.execution_state() {
674674
ExecutionState::Idle => Color::Success,
675675
ExecutionState::Busy => Color::Modified,
676+
ExecutionState::Unknown => Color::Modified,
677+
ExecutionState::Starting => Color::Modified,
678+
ExecutionState::Restarting => Color::Modified,
679+
ExecutionState::Terminating => Color::Disabled,
680+
ExecutionState::AutoRestarting => Color::Modified,
681+
ExecutionState::Dead => Color::Disabled,
682+
ExecutionState::Other(_) => Color::Modified,
676683
},
677684
Kernel::StartingKernel(_) => Color::Modified,
678685
Kernel::ErroredLaunch(_) => Color::Error,

crates/zed/src/zed/quick_action_bar/repl_menu.rs

Lines changed: 55 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -388,16 +388,55 @@ fn session_state(session: Entity<Session>, cx: &mut App) -> ReplMenuState {
388388
}
389389
};
390390

391-
match &session.kernel {
392-
Kernel::Restarting => ReplMenuState {
393-
tooltip: format!("Restarting {}", kernel_name).into(),
394-
icon_is_animating: true,
395-
popover_disabled: true,
391+
let transitional =
392+
|tooltip: SharedString, animating: bool, popover_disabled: bool| ReplMenuState {
393+
tooltip,
394+
icon_is_animating: animating,
395+
popover_disabled,
396396
icon_color: Color::Muted,
397397
indicator: Some(Indicator::dot().color(Color::Muted)),
398398
status: session.kernel.status(),
399399
..fill_fields()
400-
},
400+
};
401+
402+
let starting = || transitional(format!("{} is starting", kernel_name).into(), true, true);
403+
let restarting = || transitional(format!("Restarting {}", kernel_name).into(), true, true);
404+
let shutting_down = || {
405+
transitional(
406+
format!("{} is shutting down", kernel_name).into(),
407+
false,
408+
true,
409+
)
410+
};
411+
let auto_restarting = || {
412+
transitional(
413+
format!("Auto-restarting {}", kernel_name).into(),
414+
true,
415+
true,
416+
)
417+
};
418+
let unknown = || transitional(format!("{} state unknown", kernel_name).into(), false, true);
419+
let other = |state: &str| {
420+
transitional(
421+
format!("{} state: {}", kernel_name, state).into(),
422+
false,
423+
true,
424+
)
425+
};
426+
427+
let shutdown = || ReplMenuState {
428+
tooltip: "Nothing running".into(),
429+
icon: IconName::ReplNeutral,
430+
icon_color: Color::Default,
431+
icon_is_animating: false,
432+
popover_disabled: false,
433+
indicator: None,
434+
status: KernelStatus::Shutdown,
435+
..fill_fields()
436+
};
437+
438+
match &session.kernel {
439+
Kernel::Restarting => restarting(),
401440
Kernel::RunningKernel(kernel) => match &kernel.execution_state() {
402441
ExecutionState::Idle => ReplMenuState {
403442
tooltip: format!("Run code on {} ({})", kernel_name, kernel_language).into(),
@@ -413,40 +452,23 @@ fn session_state(session: Entity<Session>, cx: &mut App) -> ReplMenuState {
413452
status: session.kernel.status(),
414453
..fill_fields()
415454
},
455+
ExecutionState::Unknown => unknown(),
456+
ExecutionState::Starting => starting(),
457+
ExecutionState::Restarting => restarting(),
458+
ExecutionState::Terminating => shutting_down(),
459+
ExecutionState::AutoRestarting => auto_restarting(),
460+
ExecutionState::Dead => shutdown(),
461+
ExecutionState::Other(state) => other(state),
416462
},
417-
Kernel::StartingKernel(_) => ReplMenuState {
418-
tooltip: format!("{} is starting", kernel_name).into(),
419-
icon_is_animating: true,
420-
popover_disabled: true,
421-
icon_color: Color::Muted,
422-
indicator: Some(Indicator::dot().color(Color::Muted)),
423-
status: session.kernel.status(),
424-
..fill_fields()
425-
},
463+
Kernel::StartingKernel(_) => starting(),
426464
Kernel::ErroredLaunch(e) => ReplMenuState {
427465
tooltip: format!("Error with kernel {}: {}", kernel_name, e).into(),
428466
popover_disabled: false,
429467
indicator: Some(Indicator::dot().color(Color::Error)),
430468
status: session.kernel.status(),
431469
..fill_fields()
432470
},
433-
Kernel::ShuttingDown => ReplMenuState {
434-
tooltip: format!("{} is shutting down", kernel_name).into(),
435-
popover_disabled: true,
436-
icon_color: Color::Muted,
437-
indicator: Some(Indicator::dot().color(Color::Muted)),
438-
status: session.kernel.status(),
439-
..fill_fields()
440-
},
441-
Kernel::Shutdown => ReplMenuState {
442-
tooltip: "Nothing running".into(),
443-
icon: IconName::ReplNeutral,
444-
icon_color: Color::Default,
445-
icon_is_animating: false,
446-
popover_disabled: false,
447-
indicator: None,
448-
status: KernelStatus::Shutdown,
449-
..fill_fields()
450-
},
471+
Kernel::ShuttingDown => shutting_down(),
472+
Kernel::Shutdown => shutdown(),
451473
}
452474
}

0 commit comments

Comments
 (0)