Dangling kernel process from connect command
The package and version I'm asking about
Version: 1.0.6323010 OS: Windows
Question
I'm trying to create an out-of-process csharp kernel and use it side by side with the default (in-process) csharp kernel. The purpose is to show the results from two sets of binaries in one notebook.
I was able to start the process using either StdIoKernelConnector class or "#!connect studio" magic command. But I was not able to figure out 1) how to send the read/write from cells to connector, and 2) how to gracefully kill the new process when restarting the notebook.
It would be great if someone can provide some guidance.
Thank you
Update
The #!connect studio magic command creates a new kernel in a new process as expected. However, the new process doesn't go away when the notebook is restarted.
Can you post the complete command #!connect command you're running as well as screen shots of the full VS Code window afterwards?
What should happen is that a new kernel option (for whatever name you gave the connection) should appear in the cell kernel selector after the command has been run. Choosing that will send the command to the out-of-process kernel.
Thank you for quick response.
I am writing from my phone because I cannot post from my company's computer. Please excuse any typos.
The command is #!connect stdio --kernel-name rootProxy --command ["\u0022<dotnet_path>\u0022", "<app_dll_path>", "stdio", "--default-kernel", "csharp"] , where <dotnet_path> and <app_dll_path> are both string literals, not variables.
Here is the screenshot. The kernel is added and available as the magic command of the next cell. The output confirms that it's in a new process. However, the new process doesn't go away when I restart the notebook.
When I click the "select cell kernel" on the lower right corner of a new cell, the existing kernel (rootProxy) is not in the list. If I click "connect to new cell kernel", rootProxy shows up. But selecting it will not use the existing kernel. Instead a new cell is created and populated with the #! connect command.
@jonsequitur any thought? Thanks.
Connect to new cell kernel will generate a cell to connect to an external kernel. It's a most recently-used list. If the kernel was restarted you'll still have to run the #!connect command to get the kernel connected.
This behavior works fine for me.
It goes back to my original question: when I restart the notebook, how can I gracefully kill the process created by the #! connect command?
Ah ok. It might be helpful to separate this into two different issues, one for the dangling process and the other for the connected kernel not appearing in the kernel cell chooser.
Got it.
The dangling process is far more important to me. Is there an existing issue for this? If not, I will create one.
The kernel chooser issue is very minor, I won't even complain :)
I thought we might have an existing issue for the dangling process but I couldn't find it. We can just repurpose this one and I'll close as a duplicate if another issue turns up.
Thank you. I will change the title and update the original post.