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

real time live output from background ioloop #210

Open
ppkwiatkowski opened this issue Feb 21, 2020 · 1 comment
Open

real time live output from background ioloop #210

ppkwiatkowski opened this issue Feb 21, 2020 · 1 comment

Comments

@ppkwiatkowski
Copy link

Is it possible to show output from background ioloop process in real time and not only when prompting for it? It is a problem when using applications that are logging something.

minimal repro:

  1. Run import tornado; tornado.ioloop.PeriodicCallback(lambda: print("test output"), 2000).start() in jupyter-console.
  2. When I hit enter I get "test output" lines but they dont show up live.
@ppkwiatkowski
Copy link
Author

Btw. with async prompt-toolkit version >= 3.0.3 it was fairly easy to implement for my use-case by overwriting mainloop from ZMQTerminalInteractiveShell in my inherited shell class like that:

    async def handle_background_iopub(self):
        while self.keep_running:
            self.handle_iopub()
            await asyncio.sleep(1)

    def mainloop(self):
        asyncio.ensure_future(self.handle_background_iopub())
        super().mainloop()

but maybe it could be done better

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

1 participant