-
Notifications
You must be signed in to change notification settings - Fork 298
Add comm_info_[request/reply] messages #34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Since this is a spec change, the version needs to be bumped. |
Since it's a new message, that would be 5.1, not 6.0. Sorry for not specifying. |
a82b8ab
to
b8c783f
Compare
Done. |
docs/messaging.rst
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"strings"
b8c783f
to
0d74fff
Compare
So is this fine with everyone? |
Yes, I think so. I just want to bring it up at the dev meeting, first. |
Fernando, Min and I discussed this some more over lunch in Berkeley today. Some notes: We're a bit concerned that this API (list the things that are there, then use them) might be susceptible to race conditions. In an analogous example, it's frequently a mistake and sometimes a security vulnerability to check whether a file exists, and then do filesystem operations depending on that result. It's normally more reliable to try doing what you want and check for an error. A few possible alternatives we came up with:
Making comms more analogous with websockets may have other benefits - e.g. mpl has an abstraction layer over a comm or a websocket for the webagg backend. And by sticking close to an existing design, we get the benefits of the thought and discussion that has already gone into that, and we can draw inspiration from the ways people are using it. |
Oh, and the postscript to all that: we think there's quite a bit to think about here, so we think that we should hold off any message specs changes for 4.0. |
|
Re: 3 - wait, so we're saying that we're reimplementing sockets on top of the IPython message spec on top of websockets on top of html on top of tcp sockets? This is getting pretty crazy... |
I don't think we really considered reconnection in the design of comms at all, so it's worth thinking about what level that should live at. One thing that came up at lunch is that the relationship between comms and widgets is more where we've ended up as we've explored the concept of widgets, not the result of deliberate design. That shouldn't stop us from thinking about changes like this. Also, I think that if reconnection was done at the widget layer by creating new comms, you could implement whatever you need for that with no message spec changes, since we've said that the widget protocol is not yet stable. That's a pretty big advantage at the moment.
Comms are absolutely another socket-like abstraction, we had talked about this even before we implemented them. None of this discussion is changing that, and this proposal actually keeps them simpler than other ideas we're discussing, because there's no need for them to handle reconnection. Reasons for building YATLS (yet another thing like sockets):
|
The way we handle reconnection for the current persistence, is to recreate a new Comm object, and give it the same id. In any case, since the page was reloaded or just opened, a new object must be created anyway. Hence it think that it is the right approach. It is not so much about allowing the same Comm object to be connected / disconnected. |
Conceptually, this is still reconnecting to an existing comm, using the ID, not opening a new comm. With what I'm talking about, you wouldn't save comm IDs at all, only widget IDs. |
OK, then, similarly, you need a list of valid widgets when refreshing the page in the same way as you needed a list of valid comms. (The workaround I was going to make is to request this to the widget manager comm target.) |
Yes, or possibly the same kind of logic we were talking about (comm target fails if the widget ID supplied doesn't exist, so a comm_close message comes back). But, crucially, you can define all this in the widget layer, which we've said is unstable, whereas there's a higher barrier to doing it for comms because that involves message spec changes. |
The method with the Besides, to get a list of valid widgets, you will need a permanent comm with a fixed id to respond to that kind of widget list request. I find it absurd to go through such contortions while the comm_list message was a clean way to get the information. |
Well, widgets define what happens on comm_close. If the widget can be reconnected using a new comm, it would seem sensible for 'remove this widget from the page' to be an explicit message, not an implicit action when the comm is closed. We can go back and forth on specifics all day, but I'm trying to highlight that the way widgets work at the moment is not the way they have to work. We've explicitly said that there's no stability guarantee on them, so that we can keep thinking about how else they might work. So instead of starting from the current architecture of widgets and adding to the message spec to make it work, let's treat the message spec as relatively fixed and think about how best to build widgets on top of it. If we need to make changes at the comm layer, we can, but that requires a much higher bar of justification than changes to widgets at this point. After yesterday's discussions on the matter, it looks like we need to think more carefully about what abstraction comms provide before we make any changes to them to facilitate reconnecting them. |
The only usecase of comms are widgets so far. Disregarding a change on comm because the motivation is widgets does not make any sense. |
No, matplotlib uses them, as I mentioned above. But even if that wasn't the case, comms are intended to be a general purpose API that other code can build on. Widgets are the first consumer of that API, but that doesn't mean comms should just do whatever makes things easiest for widgets. |
Which is essentially a widget. |
Interjecting, matplotlib should probably use the widget framework, even if it's not synchronizing state, because a big piece of the convenience of the widget framework is the handling of cells and routing of messages. They've probably had to rewrite a lot of things that the widget framework does well. |
0d74fff
to
c70d049
Compare
e2d29af
to
dbafc87
Compare
dbafc87
to
2f7a67e
Compare
An addition we could do to this could be to add an optional |
|
@jdfreder yes, I am redoing a pass on persistence. I think it would be better to filter on the target name beforehand rather than after receiving all the comms. |
2f7a67e
to
f1ea9ed
Compare
@minrk, as discussed on gitter, I added the ability to filter by target name. Message type:
Message type:
|
I haven't been following the technical discussion on this, but I think it is important for this to start moving forward. Originally we told @SylvainCorlay that we would be releasing in a few weeks and then we could merge this right afterwards. The release took longer (just fine) but now that 4.0 is out I think we should move forward with it. |
Thanks! |
Let's see how it goes... |
Add comm_info_[request/reply] messages
Thanks for your patience, @SylvainCorlay |
Thanks! |
How should it go for the PR to the other repos? |
Good question. Maybe we want to make dev-kernel run tests with dev-client for a while, again. I know that I want to get a release of kernel out with other fixes before this lands (I probably want to get another release of client without this as well). |
Let me know what you decide. This may take some time before this trickles down to notebook and widgets. |
Since we want to get this tested, I think it makes sense to make ipykernel tests run from client-dev for a bit. If we are going to do releases before this is done, we'll just make a backport branch. There are other spec changes we probably want to bundle (completions currently underway, possibly a debug discussion) in the same release. |
OK, I guess you will want to switch to client-dev in ipykernel On Mon, Aug 24, 2015 at 6:43 PM, Min RK [email protected] wrote:
|
Adding a
comm_list_[request/reply]
shell message.