Skip to content

Conversation

minrk
Copy link
Member

@minrk minrk commented Jul 12, 2014

in the zmq console

Can result in outputs like:

In [1]: 1
[remote]In [1]: 1
[remote]Out[1]: 1
[remote]In [2]: 3
[remote]Out[2]: 3
Out[3]: 1

Note that there will be inconsistencies in prompt numbers because some execution may take place after the in-prompt is drawn.

closes #1873

  • support remote output in terminal
  • support remote output in qtconsole
  • finish sentences

@ivanov
Copy link
Member

ivanov commented Jul 12, 2014

Sweet, Min! How hard would it be to get this in qtconsole and the notebook, too?

@minrk
Copy link
Member Author

minrk commented Jul 12, 2014

QtConsole should be easy enough. Notebook seems harder, since I don't know where the output would go (I don't think it should go in an existing cell).

@minrk
Copy link
Member Author

minrk commented Jul 12, 2014

The messages already arrive, so it's just a question of what to do with them.

help="""Whether to include output from clients
other than this one sharing the same kernel.

Outputs are not displayed
Copy link
Member

Choose a reason for hiding this comment

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

Looks like you got half way through writing this - it should presumably end like "... until you next run code here."

@Carreau
Copy link
Member

Carreau commented Jul 24, 2014

+1 once in has finish his sentences.

@minrk
Copy link
Member Author

minrk commented Jul 24, 2014

I need to do the qtconsole side as well. I should focus on Contents and multi-user for the next couple of days, but I'll get back to this one.

Outputs are not displayed
"""
)
other_output_prefix = Unicode("[remote]", config=True,
Copy link
Member

Choose a reason for hiding this comment

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

I would include a space after the [remote] to separate this from the In/Out prompt visually.

@ellisonbg
Copy link
Member

Very cool! I left one inline comment. I playing around with this I did find something I would consider a bug:

  • Create a console+kernel ipython console
  • Start another console and connect to that kernel with --existing
  • Exit the second console and the kernel will the killed.

I thought we were only letting the owning frontend kill the kernel upon existing?

@ellisonbg
Copy link
Member

Adding this to the QtConsole shouldn't be too bad, but I agree that the UI for the notebook is a bit more uncertain. We will probably have to try out a few things...

@minrk
Copy link
Member Author

minrk commented Sep 28, 2014

Works in QtConsole, and sentences completed. I don't plan to address the exiting behavior here because I can't reproduce it, and I don't think it's related to this PR.

@minrk minrk added this to the 3.0 milestone Sep 28, 2014
@minrk minrk force-pushed the zmq-console-echo-other branch from 1e062ca to 8781cc0 Compare September 28, 2014 04:40
@minrk
Copy link
Member Author

minrk commented Oct 16, 2014

Should be ready to review

@@ -347,7 +347,7 @@ def _insert_continuation_prompt(self, cursor):
#---------------------------------------------------------------------------
def _handle_clear_output(self, msg):
"""Handle clear output messages."""
if not self._hidden and self._is_from_this_session(msg):
if not include_output(msg):
Copy link
Member

Choose a reason for hiding this comment

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

I think the not here is wrong.

@takluyver
Copy link
Member

Other than those things, 👍

@minrk minrk force-pushed the zmq-console-echo-other branch from 8781cc0 to 3354039 Compare October 16, 2014 19:12
minrk added 2 commits October 16, 2014 12:13
in the zmq console

Can result in outputs like:

```
In [1]: 1
[remote]In [1]: 1
[remote]Out[1]: 1
[remote]In [2]: 3
[remote]Out[2]: 3
Out[3]: 1
```

Note that there will be inconsistencies in prompt numbers
because some execution may take place after the in-prompt is drawn.
matches zmq console. Doesn't include `[remote] ` prefix,
because true async output makes it less important.
@minrk minrk force-pushed the zmq-console-echo-other branch from 3354039 to 5adedb3 Compare October 16, 2014 19:14
@minrk minrk force-pushed the zmq-console-echo-other branch from 5adedb3 to 0d5f7a8 Compare October 16, 2014 19:16
@minrk
Copy link
Member Author

minrk commented Oct 16, 2014

Typo fixed, and remote input is highlighted in the qtconsole

if self.include_other_output:
return True
else:
return from_here
Copy link
Member

Choose a reason for hiding this comment

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

Name of function is a little weird if it's other input too, but that fine I guess. Also isn't the last equivalent to return self.include_other_output and from_here ? If so it seem it could be simplified with the previous block. Handwaving i would say if (include_other and (not from_here or 'execute_input')), but maybe it becomes hard to read.

Copy link
Member

Choose a reason for hiding this comment

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

I had also looked at this block, and seen that it could be return self.include_other_output or from_here, but I don't think that's any clearer than spelling it out as Min has done.

Therefore, merging.

@Carreau
Copy link
Member

Carreau commented Oct 17, 2014

+1, small comment that we maybe can simplify logic.

takluyver added a commit that referenced this pull request Oct 20, 2014
Support echoing output from other clients
@takluyver takluyver merged commit 5ef1976 into ipython:master Oct 20, 2014
mattvonrocketstein pushed a commit to mattvonrocketstein/ipython that referenced this pull request Nov 3, 2014
Support echoing output from other clients
nheijermans pushed a commit to nheijermans/ipython that referenced this pull request Dec 3, 2014
…anything was ever incorporated into the IPython Notebook.

Here's a brief overview of the changes:

- Display of messages from other clients can be toggled on and off from within a notebook, either using the ``<M-m>e`` keyboard shortcut in the web UI, or through the option in the "Kernel" menu.
- notebook.js controls whether messages are displayed through a callback that is invoked from kernel.js when no callbacks are available for a message.
- The UI displays ``execute_input`` messages originating from an other clients in new cells at the end of the notebook. Output messages (``execute_result`` et al.) will only be displayed if a cell exists with a matching message ID.

Pending design questions:

- Should each ``execute_input`` message cause a new cell to be created?
- Should new cells be placed at the end of the notebook, or elsewhere? If the latter, what criteria should be followed?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

make zmq-console and qtconsole monitor activity they did not initiate
5 participants