-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add kernel-sidecar #16
Conversation
Current dependencies on/for this PR:
This stack of pull requests is managed by Graphite. |
1816a75
to
3338523
Compare
It looks like we'll have to change our Cargo toml with custom instructions for windows.
Deno probably has the right bits. |
@@ -83,65 +108,18 @@ impl AppState { | |||
|
|||
let mut notebooks = self.notebooks.lock().await; | |||
if let Some(notebook) = notebooks.get_mut(window_id) { | |||
notebook.update_cell(cell_id, new_content); | |||
if let Some(cell) = notebook.get_mut_cell(cell_id) { | |||
cell.set_source(new_content); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
state: State<'_, AppState>, | ||
window: Window, | ||
) -> Result<Option<String>, String> { | ||
async fn create_cell(state: State<'_, AppState>, window: Window) -> Result<Option<String>, String> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Took me a bit to realize this was just a formatting change. I wonder if I'm on a different rust version locally or something.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, what do you want to do with formatting? I ran cargo +nightly fmt / cargo clippy --fix
with a rustfmt.toml
that has the line imports_granularity = "Module"
(not relevant to the line you have here, just on import formatting).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just let VS Code do its thing with clippy. I wouldn't be surprised if I have some other setting interfering. No biggie for now, I can just follow your process on it when I commit.
|
||
async fn start_kernel(&self, window_id: &str) -> (JupyterKernel, Client) { | ||
info!("Starting kernel for window with ID: {}", window_id); | ||
let silent = true; // true = send ipykernel subprocess stdout to /dev/null |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd love to be able to collect the stdout/stderr from the subprocess, mostly for debugging. It's very useful for setups involving background work like Spark.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now that I see how the process is spawned, we can leave this to future work.
async fn start_kernel(&self, window_id: &str) -> (JupyterKernel, Client) { | ||
info!("Starting kernel for window with ID: {}", window_id); | ||
let silent = true; // true = send ipykernel subprocess stdout to /dev/null | ||
let kernel = JupyterKernel::ipython(silent); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Based on this, is the process launching synchronous?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, using std::process::Command
there. Looks like there's a crate for async process, haven't tried it out https://docs.rs/async-process/latest/async_process/struct.Command.html
You think spawning the process should be async? I can create an issue in kernel-sidecar
and research it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tauri has a built in for launching an asynchronous process, which I'm guessing wraps around tokio. We can touch this later since it's not a blocker at the moment.
Future direction I'm curious about for us is if/how we're going to do events. I see how events are done both in the Rust backend and JS frontend in the Tauri docs: https://tauri.app/v1/guides/features/events/. What I'm not sure about is how we're going to receive updates from kernel sidecar and send those events on to the client. |
Update: did it here |
f7749a7
to
084fdf1
Compare
084fdf1
to
b3f50f0
Compare
Looks like zeromq/zmq.rs#185 did the trick. Thanks @mmastrac for the quick ship. 🚀 |
Leaving this in draft status but putting it up so people can try it out and tell me which direction they want to go for an initial prototype of integrating
kernel-sidecar
.Notebook
andCell
models with those fromkernel-sidecar
ipykernel
process as a subprocess on cell execution (doesn't clean up if you x out of the tauri app)