You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 the execute or execute_interactive) potentially using a KernelManager 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):
# using Jupyter Server APIkernel_id=find_kernel_id_for_notebook("MyNotebookRunning.ipynb")
# using jupyter-clientclient=get_kernel(kernel_id=kernel_id)
result=client.execute("""df.describe() # whatever""")
# log the result
The text was updated successfully, but these errors were encountered:
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?
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):
The text was updated successfully, but these errors were encountered: