Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

add `ipython kernel` for starting just a kernel #687

Merged
merged 3 commits into from

2 participants

Min RK Fernando Perez
Min RK
Owner

Also fixed an issue that the --existing... message would be inaccurate if the heartbeat port is unspecified.

minrk added some commits
Min RK minrk specify heartbeat port at construction, not in run
when port=0, the heartbeat port would be unknown until the heartbeat
started, making the '--existing…' message inaccurate.
79472ea
Min RK minrk add 'ipython kernel' entry point
For starting a kernel without a frontend.
b7add9e
Fernando Perez
Owner

Awesome, thanks! Min, before merging, could you update the examples I wrote in examples/lib to remove the hardcoding of the hb port, since you've now fixed that? Then we can merge this and point people who are asking about all this on-list to do a master pull.

Great to have this!

Min RK
Owner

fixed.

Fernando Perez fperez merged commit 4e1a76c into from
Fernando Perez
Owner

Thanks! Merged and pushed. This is excellent to have...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Aug 8, 2011
  1. Min RK

    specify heartbeat port at construction, not in run

    minrk authored
    when port=0, the heartbeat port would be unknown until the heartbeat
    started, making the '--existing…' message inaccurate.
  2. Min RK

    add 'ipython kernel' entry point

    minrk authored
    For starting a kernel without a frontend.
  3. Min RK

    remove hardcoded hb port from internal example

    minrk authored
    The Related bug has been fixed.
This page is out of date. Refresh to see the latest.
6 IPython/frontend/terminal/ipapp.py
View
@@ -205,7 +205,11 @@ def _classes_default(self):
"""Launch the IPython Qt Console."""
),
profile = ("IPython.core.profileapp.ProfileApp",
- "Create and manage IPython profiles.")
+ "Create and manage IPython profiles."
+ ),
+ kernel = ("IPython.zmq.ipkernel.IPKernelApp",
+ "Start a kernel without an attached frontend."
+ ),
))
# *do* autocreate requested profile, but don't create the config file.
12 IPython/zmq/heartbeat.py
View
@@ -12,6 +12,7 @@
# Imports
#-----------------------------------------------------------------------------
+import socket
import sys
from threading import Thread
@@ -33,13 +34,16 @@ def __init__(self, context, addr=(LOCALHOST, 0)):
self.addr = addr
self.ip = addr[0]
self.port = addr[1]
+ if self.port == 0:
+ s = socket.socket()
+ s.bind(self.addr)
+ self.port = s.getsockname()[1]
+ s.close()
+ self.addr = (self.ip, self.port)
self.daemon = True
def run(self):
self.socket = self.context.socket(zmq.REP)
- if self.port == 0:
- self.port = self.socket.bind_to_random_port('tcp://%s' % self.ip)
- else:
- self.socket.bind('tcp://%s:%i' % self.addr)
+ self.socket.bind('tcp://%s:%i' % self.addr)
zmq.device(zmq.FORWARDER, self.socket, self.socket)
5 docs/examples/lib/internal_ipkernel.py
View
@@ -14,10 +14,7 @@ def pylab_kernel(gui):
"""Launch and return an IPython kernel with pylab support for the desired gui
"""
kernel = IPKernelApp()
- # FIXME: we're hardcoding the heartbeat port b/c of a bug in IPython 0.11
- # that will set it to 0 if not specified. Once this is fixed, the --hb
- # parameter can be omitted and all ports will be automatic
- kernel.initialize(['python', '--pylab=%s' % gui, '--hb=19999',
+ kernel.initialize(['python', '--pylab=%s' % gui,
#'--log-level=10'
])
return kernel
Something went wrong with that request. Please try again.