Skip to content

Conversation

@kozikow
Copy link
Contributor

@kozikow kozikow commented Jun 23, 2016

Use cases:

  • Start an ipython kernel on a server with lots of ram and cpu
    and connect it to local lightweight machine running emacs.
  • Ipython kernel launched by some tool. My team have a tool that
    configures ipython session and configuration can't simply be
    added to ~/.ipython/profile_default.

Simply naming session with connection json is simple solution that works well.
I considered additional parameter, "existing-session", but it would require much more code changes, as it would require passing one more argument in all tornado requests.

I am running it in my emacs and it works. To test:

  1. Start ipython session outside of org mode with:

import os
from ipykernel.kernelapp import IPKernelApp

app = IPKernelApp.instance()
app.initialize([])
kernel = app.kernel
kernel.shell.push({'print_me': 'Running in previously started kernel.'})

app.start()
2. Get json from previous command and name a session after your json file. For example:

+BEGIN_SRC ipython :session kernel-8520.json :results output

 print print_me

+END_SRC

+RESULTS:

: Running in previously started kernel.

kozikow added 2 commits June 23, 2016 00:54
Use cases:
- Start an ipython kernel on a server with lots of ram and cpu
  and connect it to local lightweight machine running emacs.
- Ipython kernel launched by some tool. My team have a tool that
  configures ipython session and configuration can't simply be
  added to profile_default.

I considered passing additional argument, but simply naming session
with connection json is simple solution that works well.

I am running it in my emacs and it works. To test:
1. Start ipython session outside of org mode with:

  import os
  from ipykernel.kernelapp import IPKernelApp

  app = IPKernelApp.instance()
  app.initialize([])
  kernel = app.kernel
  kernel.shell.push({'print_me': 'Running in previously started kernel.'})

  app.start()
2. Get json from previous command and name a session after your json
file. For example: #+BEGIN_SRC ipython :session kernel-8520.json
@gregsexton gregsexton self-assigned this Jul 3, 2016
@EmperorDali
Copy link
Contributor

@kozikow @gregsexton This PR looks interesting.

One thing I don't understand though - @kozikow 's PR seems to just directly start an ipython kernel, then point ob-ipython at the resulting json connect file to link up emacs to the kernel.

In this case, what happened to driver.py? Why do we no longer need it?

If ob-ipython.el can just directly connect to a jupyter notebook over http, what's the role of the driver.py intermediary?

@EmperorDali
Copy link
Contributor

OK, I think I understand a little bit more.

Starting a notebook server doesn't automatically start any kernels - so at the very least we need ob-ipython to start a kernel (if it's not connecting to a remote one).

But why is driver.py implementing a Tornado web app to actually execute code - doesn't Jupyter provide this exact functionality? e.g., http://blog.ibmjstart.net/2016/01/28/jupyter-notebooks-as-restful-microservices/

Maybe driver.py was written before this feature was in jupyter notebook?

@gregsexton gregsexton merged commit 7325aca into gregsexton:master Jun 28, 2017
@gregsexton
Copy link
Owner

Long overdue merge. Thanks for the PR.

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.

3 participants