-
-
Notifications
You must be signed in to change notification settings - Fork 47
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
Kernel state for Cell and Output #282
Conversation
This PR also support the creation of completely independent Kernels (via a path) as requested by @mattmutt on #281 (comment) |
@sok82 I hope I have addressed the requirements of #269 with a new ExecutionPhase state that goes informs when the Cell is completed. You can have a look at these videos and the Output and Cell examples of this PR. (it works even if no output is generated). Screencast.from.07-30-2024.02.31.54.PM.webmScreencast.from.07-30-2024.02.34.33.PM.webm |
@MarcosVn Once this PR is merged, your PR #280 will need to be revisited. I have changed a bit how the cell is run in this PR, as well as the state. I have quickly looks the changes you propose, and overall looks good to me. To make your life easier, you can simply close 280 and open a brand new avoiding the merge pain (unless a rebase/merge works for you). |
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.
Thanks @echarles
Hey @echarles It's great to see progress on the issue, video looks promising. Can you please provide few lines of code demonstrating how I can start execution of output in new model and react on changing of execution state (KernelPhase if I got you right) If i got you right - I need to do smth like this
And the thing I need is probably And what are possible states? |
|
Great. Already found that. And what about reacting on execution errors? How can I check if execution finished with error? |
Great call. For now, in case of error, I explicitly set COMPLETED. Let me change that to COMPLETED_WITH_ERROR |
Like this? Screencast.from.07-30-2024.05.46.04.PM.webm |
Co-authored-by: Frédéric Collonval <[email protected]>
Hey @echarles , I'm experimenting with version Kernel phase monitoring works fine when execution finishes successfully, but when something is wrong with a code exception is thrown from kernel execution promise and I don't have an idea of how to catch it. The way I trigger execution is just by increasing executionTrigger for output, so I don't control promise implicitly... Exception example is
Is there a chance to catch and process this exception? What is a correct way of doing this? |
@sok82 We could add more logic in this code block jupyter-ui/packages/react/src/jupyter/kernel/KernelExecutor.ts Lines 216 to 224 in 3ac5b26
|
Thanks for quick reply, @echarles ! We definitely need to handle this situation and not just explode with exception which is hard to handle Opened #289 to fix this. In my case I just don't need this exception at all (because I have all the details in output which is enough), so for me it's better to suppress it (for example having some flag on output that will control suppression) in JS code and just pass exception description to output |
Hey @echarles, Actually what I need - is to get FINAL execution state AND output. But in current implementation - these are two separate things, which could be obtained only separately.
And this is a problem for me in my flow of events which is
Previously I checked that execution is finished by receiving output change event and it worked, but I didn't knew in 100% cases state of execution - success or not Now I am able to get the state, BUT when I receive new ExecutionPhase = completed I have to disconnect output handler - which is bad, because changing of execution phase can be triggered BEFORE output change is triggered and in this case I do not catch output change event and can't set new output value And sometimes I see that execution phase change happens AFTER output handler is triggered and in this case I can't be sure that execution finished successfully or not, which makes it useless for me. I need some way to synchronize these two events, and for now I don't know how... Can you please modify code of https://github.com/datalayer/jupyter-ui/blob/3ac5b261927f70a526f777b847ee84afc6ad4b3e/packages/react/src/jupyter/kernel/KernelExecutor.ts For me the optimal solution would be changing of execution phase ALWAYS before output change. |
Hi @sok82 would be great to open a separated issue for this. If you have an idea for a fix, an associated PR would be awesome also. Thx again for your reports. |
This PR introduces a kernel state and let the Output and Cell components use that state via the Kernel Executor.
This allows more control on the ZMQ messages. The Notebook component will have to use that Kernel Executor also.