__init__.py
74 lines
| 2.1 KiB
| text/x-python
|
PythonLexer
MinRK
|
r4018 | """The IPython ZMQ-based parallel computing interface. | ||
Authors: | ||||
* MinRK | ||||
""" | ||||
MinRK
|
r3644 | #----------------------------------------------------------------------------- | ||
# Copyright (C) 2011 The IPython Development Team | ||||
# | ||||
# Distributed under the terms of the BSD License. The full license is in | ||||
# the file COPYING, distributed as part of this software. | ||||
#----------------------------------------------------------------------------- | ||||
#----------------------------------------------------------------------------- | ||||
# Imports | ||||
#----------------------------------------------------------------------------- | ||||
MinRK
|
r3779 | import os | ||
MinRK
|
r4248 | import warnings | ||
MinRK
|
r3661 | import zmq | ||
MinRK
|
r7312 | from IPython.config.configurable import MultipleInstanceError | ||
MinRK
|
r4725 | from IPython.zmq import check_for_zmq | ||
MinRK
|
r3779 | |||
if os.name == 'nt': | ||||
MinRK
|
r4725 | min_pyzmq = '2.1.7' | ||
else: | ||||
min_pyzmq = '2.1.4' | ||||
MinRK
|
r4248 | |||
MinRK
|
r4725 | check_for_zmq(min_pyzmq, 'IPython.parallel') | ||
MinRK
|
r4248 | |||
MinRK
|
r3666 | from IPython.utils.pickleutil import Reference | ||
MinRK
|
r3665 | |||
MinRK
|
r3673 | from .client.asyncresult import * | ||
from .client.client import Client | ||||
from .client.remotefunction import * | ||||
from .client.view import * | ||||
MinRK
|
r6832 | from .util import interactive | ||
MinRK
|
r3673 | from .controller.dependency import * | ||
MinRK
|
r6893 | #----------------------------------------------------------------------------- | ||
# Functions | ||||
#----------------------------------------------------------------------------- | ||||
def bind_kernel(**kwargs): | ||||
"""Bind an Engine's Kernel to be used as a full IPython kernel. | ||||
This allows a running Engine to be used simultaneously as a full IPython kernel | ||||
with the QtConsole or other frontends. | ||||
This function returns immediately. | ||||
""" | ||||
MinRK
|
r7312 | from IPython.zmq.ipkernel import IPKernelApp | ||
MinRK
|
r6893 | from IPython.parallel.apps.ipengineapp import IPEngineApp | ||
MinRK
|
r7312 | |||
# first check for IPKernelApp, in which case this should be a no-op | ||||
# because there is already a bound kernel | ||||
if IPKernelApp.initialized() and isinstance(IPKernelApp._instance, IPKernelApp): | ||||
return | ||||
MinRK
|
r6893 | if IPEngineApp.initialized(): | ||
MinRK
|
r7312 | try: | ||
app = IPEngineApp.instance() | ||||
except MultipleInstanceError: | ||||
pass | ||||
else: | ||||
return app.bind_kernel(**kwargs) | ||||
raise RuntimeError("bind_kernel be called from an IPEngineApp instance") | ||||
MinRK
|
r6893 | |||
MinRK
|
r3665 | |||