##// END OF EJS Templates
include errors in IPython.parallel namespace
MinRK -
Show More
@@ -1,74 +1,75 b''
1 """The IPython ZMQ-based parallel computing interface.
1 """The IPython ZMQ-based parallel computing interface.
2
2
3 Authors:
3 Authors:
4
4
5 * MinRK
5 * MinRK
6 """
6 """
7 #-----------------------------------------------------------------------------
7 #-----------------------------------------------------------------------------
8 # Copyright (C) 2011 The IPython Development Team
8 # Copyright (C) 2011 The IPython Development Team
9 #
9 #
10 # Distributed under the terms of the BSD License. The full license is in
10 # Distributed under the terms of the BSD License. The full license is in
11 # the file COPYING, distributed as part of this software.
11 # the file COPYING, distributed as part of this software.
12 #-----------------------------------------------------------------------------
12 #-----------------------------------------------------------------------------
13
13
14 #-----------------------------------------------------------------------------
14 #-----------------------------------------------------------------------------
15 # Imports
15 # Imports
16 #-----------------------------------------------------------------------------
16 #-----------------------------------------------------------------------------
17
17
18 import os
18 import os
19 import warnings
19 import warnings
20
20
21 import zmq
21 import zmq
22
22
23 from IPython.config.configurable import MultipleInstanceError
23 from IPython.config.configurable import MultipleInstanceError
24 from IPython.zmq import check_for_zmq
24 from IPython.zmq import check_for_zmq
25
25
26 if os.name == 'nt':
26 if os.name == 'nt':
27 min_pyzmq = '2.1.7'
27 min_pyzmq = '2.1.7'
28 else:
28 else:
29 min_pyzmq = '2.1.4'
29 min_pyzmq = '2.1.4'
30
30
31 check_for_zmq(min_pyzmq, 'IPython.parallel')
31 check_for_zmq(min_pyzmq, 'IPython.parallel')
32
32
33 from IPython.utils.pickleutil import Reference
33 from IPython.utils.pickleutil import Reference
34
34
35 from .client.asyncresult import *
35 from .client.asyncresult import *
36 from .client.client import Client
36 from .client.client import Client
37 from .client.remotefunction import *
37 from .client.remotefunction import *
38 from .client.view import *
38 from .client.view import *
39 from .util import interactive
40 from .controller.dependency import *
39 from .controller.dependency import *
40 from .error import *
41 from .util import interactive
41
42
42 #-----------------------------------------------------------------------------
43 #-----------------------------------------------------------------------------
43 # Functions
44 # Functions
44 #-----------------------------------------------------------------------------
45 #-----------------------------------------------------------------------------
45
46
46
47
47 def bind_kernel(**kwargs):
48 def bind_kernel(**kwargs):
48 """Bind an Engine's Kernel to be used as a full IPython kernel.
49 """Bind an Engine's Kernel to be used as a full IPython kernel.
49
50
50 This allows a running Engine to be used simultaneously as a full IPython kernel
51 This allows a running Engine to be used simultaneously as a full IPython kernel
51 with the QtConsole or other frontends.
52 with the QtConsole or other frontends.
52
53
53 This function returns immediately.
54 This function returns immediately.
54 """
55 """
55 from IPython.zmq.ipkernel import IPKernelApp
56 from IPython.zmq.ipkernel import IPKernelApp
56 from IPython.parallel.apps.ipengineapp import IPEngineApp
57 from IPython.parallel.apps.ipengineapp import IPEngineApp
57
58
58 # first check for IPKernelApp, in which case this should be a no-op
59 # first check for IPKernelApp, in which case this should be a no-op
59 # because there is already a bound kernel
60 # because there is already a bound kernel
60 if IPKernelApp.initialized() and isinstance(IPKernelApp._instance, IPKernelApp):
61 if IPKernelApp.initialized() and isinstance(IPKernelApp._instance, IPKernelApp):
61 return
62 return
62
63
63 if IPEngineApp.initialized():
64 if IPEngineApp.initialized():
64 try:
65 try:
65 app = IPEngineApp.instance()
66 app = IPEngineApp.instance()
66 except MultipleInstanceError:
67 except MultipleInstanceError:
67 pass
68 pass
68 else:
69 else:
69 return app.bind_kernel(**kwargs)
70 return app.bind_kernel(**kwargs)
70
71
71 raise RuntimeError("bind_kernel be called from an IPEngineApp instance")
72 raise RuntimeError("bind_kernel be called from an IPEngineApp instance")
72
73
73
74
74
75
General Comments 0
You need to be logged in to leave comments. Login now