##// END OF EJS Templates
bind_kernel on a bound kernel is a no-op
MinRK -
Show More
@@ -20,6 +20,7 b' import warnings'
20 20
21 21 import zmq
22 22
23 from IPython.config.configurable import MultipleInstanceError
23 24 from IPython.zmq import check_for_zmq
24 25
25 26 if os.name == 'nt':
@@ -51,12 +52,23 b' def bind_kernel(**kwargs):'
51 52
52 53 This function returns immediately.
53 54 """
55 from IPython.zmq.ipkernel import IPKernelApp
54 56 from IPython.parallel.apps.ipengineapp import IPEngineApp
57
58 # first check for IPKernelApp, in which case this should be a no-op
59 # because there is already a bound kernel
60 if IPKernelApp.initialized() and isinstance(IPKernelApp._instance, IPKernelApp):
61 return
62
55 63 if IPEngineApp.initialized():
56 app = IPEngineApp.instance()
57 else:
58 raise RuntimeError("Must be called from an IPEngineApp instance")
64 try:
65 app = IPEngineApp.instance()
66 except MultipleInstanceError:
67 pass
68 else:
69 return app.bind_kernel(**kwargs)
70
71 raise RuntimeError("bind_kernel be called from an IPEngineApp instance")
59 72
60 return app.bind_kernel(**kwargs)
61 73
62 74
General Comments 0
You need to be logged in to leave comments. Login now