Comments (4)
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.
@minrk Thanks for the time on this issue. BTW, when we implemented our backend in C#, we execute the cell code in the background:
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.
@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.
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)
- jupyther
- Should ipykernel align kernel SVG with the one used by JupyterLab?
- CI failing with INTERNALERROR when skipping tests
- Jupyter notebook cell instruction after asyncio.run is not executing with 6.28.0v of ipykernel HOT 4
- Can not install ipykernel HOT 2
- Better cell magic by removing some of the syntax limitations
- python 3.11 debugpy error messages HOT 3
- Directing output of out external threads/processes to specific cells HOT 1
- Qt eventloop interferes with asyncio.call_later in _abort_queues HOT 7
- Incorrect stack traceback when try except finally is used in jupyter notebooks with pandas
- Feature request: enable editing_mode = ‘vi’ for a ZMQTerminalIPythonApp console
- TypeError: '>=' not supported between instances of 'str' and 'datetime.datetime' HOT 3
- Release 7.0 HOT 5
- "ModuleNotFoundError: No module named 'comm'" when running 'python -m ipykernel install'
- Output [ ] Alone HOT 2
- Compatibility with pytest 8 HOT 1
- Different child termination behavior during Kernel shutdown on Posix and Windows systems HOT 1
- Windows: ipykernel install prefix not usable for c:\programdata\jupyter
- AnyIO commit breaks Matplotlib display in separate windows HOT 2
- Restore to previous state with copy-on-write HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ipykernel.