Skip to content
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

Alter parent settings to messages #738

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

joemarshall
Copy link
Contributor

I don't understand quite how the parent message thing works, but setting the parent on every message breaks things.

This is why the pyolite kernel breaks if you call await input twice, because it sets 'input_reply' as the parent message, rather than keeping the 'execute_request' there. With this fix, await input works fine.

I'm not convinced that this fix is perfect and that it doesn't need setting for other messages, but I thought it was worth throwing it out for discussion.

I don't understand quite how the parent message thing works, but setting the parent on every message breaks things. 

This is why the pyolite kernel breaks if you call await input twice, because it sets 'input_reply' as the parent message, rather than keeping the 'execute_request' there.

I'm not convinced that this fix is perfect and that it doesn't need setting for other messages, but I thought it was worth throwing it out for discussion.
@github-actions
Copy link
Contributor

lite-badge 👈 Try it on ReadTheDocs

@joemarshall
Copy link
Contributor Author

Fixes issue #650

@joemarshall
Copy link
Contributor Author

This could just check if the message is 'input_response' and not update parent there. I'm not sure whether there are any other messages that need a parent message or not.

@joemarshall
Copy link
Contributor Author

I've just had a read through
https://ipython.org/ipython-doc/3/development/messaging.html

and I think parent header should only be set for execute requests for now. I think otherwise there is a risk that other messages will break the parent header stuff. I think if anything uses both execute and custom comms it will break, but that would happen now also. Really for it to work correctly, parent should be passed into the kernel execute request, which could then pass it out again, so you've always got the correct parent message.

@jtpio jtpio added the bug Something isn't working label Aug 3, 2022
@jtpio jtpio added this to the 0.1.0 milestone Aug 3, 2022
@jtpio
Copy link
Member

jtpio commented Sep 2, 2022

Thanks @joemarshall.

The current handling of the parent messages is indeed not optimal at the moment. However it's not clear whether limiting it to execute_request might have some unintended side-effects on the other messages. The parent message could for example be used by kernels to track a chain of messages (although this is not currently done in the Pyolite and JS kernels).

@jtpio jtpio modified the milestones: 0.1.0, Future Mar 14, 2023
@joemarshall joemarshall mentioned this pull request Apr 4, 2024
const msgType = msg.header.msg_type;
if (msgType === 'execute_request') {
this._parent = msg;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this be moved to this._execute maybe ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants