Giter VIP home page Giter VIP logo

Comments (4)

minrk avatar minrk commented on May 27, 2024

I think this can be handled by processing messages in a thread while running code in another. What complicates things is that comm messages come on the same queue as execution, but I think we can deal with that if we are careful. I've been designing the threaded IO in my head for a bit, because I think it would solve several problems with flushing stdout as well.

from ipykernel.

dsblank avatar dsblank commented on May 27, 2024

@minrk Thanks for the time on this issue. BTW, when we implemented our backend in C#, we execute the cell code in the background:

https://bitbucket.org/ipre/calico/src/master/Source/Calico/ZMQServer.cs?fileviewer=file-view-default#ZMQServer.cs-964

I thought that that was the way it was supposed to work. I don't remember any adverse effects, but I think we made sure that the kernel acted as if it were blocking (didn't accept another cell execution message, for example). I do remember testing parallel cell execution, which worked, if you keep the output cells associated with the execution. Although, that can be a confusing UI. It might be nice to have a magic that would allow cell code to run in background, and not block. No need to write specific code to have it run in a thread if it is already running in a thread.

from ipykernel.

AlexTugarev avatar AlexTugarev commented on May 27, 2024

@minrk I'm glad, I found this issue, because I also need to handle comm messages in background. I'm about to prototype a kernel based on IPythonKernel which processes comm messages in another thread. My plan is to use two queues for comm and other messages, which would be polled in different threads. Please share your ideas on the treaded IO, maybe it's helpful.

Also I'd like to create a PR once it passes existing tests, and it would be great to receive feedback on this.

from ipykernel.

oeway avatar oeway commented on May 27, 2024

I recently encountered the same issue, in the cell we run something like await prompt("x=?") and the front end popup a dialog to get user input, once done, it sends a comm message to the backend. However, because the cell is running, the comm message cannot go through, it ended up with a dead state that we can only send an interrupt execution command to end it.

@AlexTugarev do you have a chance to work on a solution? Two queues for comm and other messages sounds like a good idea.

from ipykernel.

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.