##// END OF EJS Templates
allow embed_kernel to be called from engine
MinRK -
Show More
@@ -37,7 +37,7 b' from zmq.eventloop.zmqstream import ZMQStream'
37 37 # Local imports
38 38 from IPython.core import pylabtools
39 39 from IPython.config.configurable import Configurable
40 from IPython.config.application import boolean_flag, catch_config_error
40 from IPython.config.application import boolean_flag, catch_config_error, Application
41 41 from IPython.core.application import ProfileDir
42 42 from IPython.core.error import StdinNotImplementedError
43 43 from IPython.core.shellapp import (
@@ -883,9 +883,21 b' def embed_kernel(module=None, local_ns=None, **kwargs):'
883 883 on the first embed_kernel call for a given process.
884 884
885 885 """
886 try:
887 from IPython.parallel.apps.ipengineapp import IPEngineApp
888 except ImportError:
889 # IPython.parallel has higher zmq dependency that IPython.zmq
890 class IPEngineApp:
891 pass
892
886 893 # get the app if it exists, or set it up if it doesn't
887 if IPKernelApp.initialized():
888 app = IPKernelApp.instance()
894 if Application.initialized():
895 app = Application.instance()
896 if isinstance(app, IPEngineApp):
897 app.listen_kernel()
898 # return right away, because we embed in the Engine's
899 # namespace, not the calling one.
900 return
889 901 else:
890 902 app = IPKernelApp.instance(**kwargs)
891 903 app.initialize([])
General Comments 0
You need to be logged in to leave comments. Login now