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

history tail does not provide output #169

Open
gibiansky opened this issue Aug 2, 2016 · 3 comments
Open

history tail does not provide output #169

gibiansky opened this issue Aug 2, 2016 · 3 comments

Comments

@gibiansky
Copy link

# Set up client
from jupyter_client import *
multimanager = MultiKernelManager()
manager = multimanager.get_kernel(multimanager.start_kernel("python3"))
client = manager.client()

# Add some history
client.execute("3 + 1")
client.execute("3 + 2")
client.execute("3 + 3")
client.get_shell_msg()
client.get_shell_msg()
client.get_shell_msg()

# get history
client.history(output=True, raw=True, hist_access_type="tail", n=3)
print(client.get_shell_msg())

outputs

{'buffers': [],
 'content': {u'history': [[401, 1, [u'3 + 3', None]],
   [401, 2, [u'3 + 4', None]],
   [401, 3, [u'3 + 5', None]]]},
 'header': {u'date': datetime.datetime(2016, 8, 1, 23, 48, 33, 745530),
  u'msg_id': u'c9a53f04-e669-4955-b0e8-ad88ec40855b',
  u'msg_type': u'history_reply',
  u'session': u'0f588569-25de-47f2-865a-0f77fbc84d51',
  u'username': u'silver',
  u'version': u'5.0'},
 'metadata': {},
 'msg_id': u'c9a53f04-e669-4955-b0e8-ad88ec40855b',
 'msg_type': u'history_reply',
 'parent_header': {u'date': datetime.datetime(2016, 8, 1, 23, 48, 33, 744099),
  u'msg_id': u'338254fe-74b2-4624-a199-8b79ec37dd4e',
  u'msg_type': u'history_request',
  u'session': u'089bcf7f-ac7b-4ba5-8268-14ac9c85ce0c',
  u'username': u'silver',
  u'version': u'5.0'}}

Note that there is no output in the history.

When I do something similar with a "range" query, I get output in some history items.

@gibiansky
Copy link
Author

I see the same behaviour for search FYI

@minrk
Copy link
Member

minrk commented Aug 2, 2016

cc @takluyver if there's something funky we are doing in the history API handlers.

@takluyver
Copy link
Member

tail uses the database directly, without a special case for the current session. IPython doesn't save output to the database by default (there's an option HistoryManager.db_log_output to enable it). range does have a special case for the current session, so it does show output from the current session.

As far as I know, none of our frontends send a history_request with output=True. We only use a small subset of the history messaging interface: tail requests with raw=True and output=False. It's probably another thing that we should simplify in a future version of the messaging protocol.

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

No branches or pull requests

3 participants