GithubHelp home page GithubHelp logo

Comments (8)

davidbrochart avatar davidbrochart commented on August 30, 2024

Hi Kevin,
If you want to use your own kernel manager, you can pass it to the NotebookClient. Have you tried that?
Otherwise, nbclient having inherently an async execution model, it will indeed set up an async kernel client.

from nbclient.

kevin-bates avatar kevin-bates commented on August 30, 2024

Hi David - thanks for the quick response.

Because I'm really going through Papermill here, I am specifying kernel_manager_class and need my NotebookClient subclass to instantiate the specified kernel manager instance and its specific (async) kernel client. I do not want to have to instantiate an instance first.

So is the reason for this forced override purely to ensure an async kernel client is used even in the classic case where a synchronous kernel manager is used? That seems to be the case since the default value for the kernel_manager_class trait is already AsyncKernelManager and it already specifies AsyncKernelClient as its client.

If nbclient requires an async kernel client (and a subclass of AsyncKernelClient for that matter), it seems it should only set the client_class trait on the KernelManager if it currently specifies juptyer_client.client.KernelClient and not unconditionally. Would that be sufficient?

if self.km.client_class == 'jupyter_client.client.KernelClient':
    self.km.client_class = 'jupyter_client.asynchronous.AsyncKernelClient'

This way, other kernel managers can bring their own async kernel client implementations.
(I get the expected results in my implementation after making this change.)

from nbclient.

davidbrochart avatar davidbrochart commented on August 30, 2024

Would that be sufficient?

if self.km.client_class == 'jupyter_client.client.KernelClient':
    self.km.client_class = 'jupyter_client.asynchronous.AsyncKernelClient'

Yes, this looks good to me. Thanks for looking into it Kevin!
If you feel like opening a PR, I'll be glad to merge it. Otherwise I can make the change.

from nbclient.

MSeal avatar MSeal commented on August 30, 2024

It might be nice for KernelManagers to be able to optionally supply a suggested KernelClient class so we could let a kernel manager assignment alone apply sane default client associations when the user isn't sure.

from nbclient.

davidbrochart avatar davidbrochart commented on August 30, 2024

Isn't it why we have client_class in the kernel managers?

from nbclient.

MSeal avatar MSeal commented on August 30, 2024

Yes. That's what I get for a quick response from my phone without thinking. Apologies and ignore that comment.

from nbclient.

davidbrochart avatar davidbrochart commented on August 30, 2024

No worries Matthew! My question was really for me to check if I understood correctly 😃

from nbclient.

kevin-bates avatar kevin-bates commented on August 30, 2024

Addressed by #117

from nbclient.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.