On Mon, Nov 6, 2017 at 12:19 PM, vitalije <[email protected]> wrote:
>
Here is example script that I have made so far.
Totally excellent!
>
It doesn't do too much. It calculates sin(1).
Actually, it shows how to evaluate any python string.
Function jupyter_client.run_kernel returns a blocking version of jupyter
> client enclosed in a context. That means that the methods get_shell_msg,
> and others get_..._msg will block until the message arrives.
>
The script does not use getMessagesUntilIdle. Does it do what you are
talking about?
Clearly, I have not paid enough attention to the methods of the manager
module, to which jupyter_client.run_kernel refers.
This simplifies the example but for real use, we should use non-blocking
> client and read messages on iopub channel which inform us when kernel has
> started to execute our code (it becomes busy), and when it becomes idle
> again, we can read the result message from the shell channel.
>
The KernelManager class contains these statements:
# the class to create with our `client` method
client_class =
DottedObjectName('jupyter_client.blocking.BlockingKernelClient')
client_factory = Type(klass='jupyter_client.KernelClient')
The Dotted and Type functions are part of the traitlets type system.
Presumably there is a way to change client_class to:
client_class = DottedObjectName('jupyter_client.KernelClient')
but I don't know how to do this.
> Instead of using every time another kernel enclosed in a python context
> which will expire when the context is left, perhaps kernel client can be
> created directly using jupyter_client.KernelClient(**kwargs) and instance
> stored in c.user_dict. It is non-blocking client.
>
It's worth a try.
Many thanks for this script. It's a big step forward.
Edward
--
You received this message because you are subscribed to the Google Groups
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.