Closed santiagobasulto closed 1 year ago
That was useful, thanks very much! After digging with Jupyter runtimes and the issue you linked I was able to instantiate a BlockingKernelClient
and execute code in an arbitrary Kernel of my choice.
Is the BlockingKernelClient.execute()
the preferred method to execute some code on that kernel and get the result?[0] Or should I use execute_interactive
and capture stdout
to get what I need.
Thanks!
[0] I see I receive a message ID of some sort, I assume I can then check the stdout/stderr of that message?
Maybe take inspiration from nbclient?
Thanks, will do that, I think I can contribute some docs about runtimes now if that's ok with the project. I'll go ahead and close this issue. Thank you again @davidbrochart !
I'm sorry in advance if this is a terribly n00b question. I have a jupyter server running, with a specific Notebook that has processed, and I'm trying to programmatically connect to it and execute some arbitrary code [0].
I know that somehow I have to get a
BlockingKernelClient
instance (and then use theexecute
orexecute_interactive
) potentially using aKernelManager
but I just don't know how to do it.I see everywhere that these managers receive a
config
, but I don't see much about it in the documentation.If you could point me in the right direction I'd be glad to contribute some more documentation for more n00bs like me :)
[0] There is a dataframe in memory which has some partial state that I want to log/process. I need to get that intermediate state in memory of the dataframe that is always in the
df
variable.So, I just need to somehow do (in pseudocode):