-
-
Notifications
You must be signed in to change notification settings - Fork 994
/
__init__.py
85 lines (66 loc) · 2.39 KB
/
__init__.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# coding: utf-8
"""The IPython ZMQ-based parallel computing interface."""
# Copyright (c) IPython Development Team.
# Distributed under the terms of the Modified BSD License.
import os
import warnings
import zmq
from traitlets.config.configurable import MultipleInstanceError
from ._version import __version__
from ._version import version_info
from .client.asyncresult import *
from .client.client import Client
from .client.remotefunction import *
from .client.view import *
from .cluster import Cluster
from .cluster import ClusterManager
from .controller.dependency import *
from .error import *
from .serialize import *
from .util import interactive
# -----------------------------------------------------------------------------
# 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.
"""
from ipykernel.kernelapp import IPKernelApp
from ipyparallel.engine.app import IPEngine
# 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
if IPEngine.initialized():
try:
app = IPEngine.instance()
except MultipleInstanceError:
pass
else:
return app.bind_kernel(**kwargs)
raise RuntimeError("bind_kernel be called from an IPEngine instance")
def register_joblib_backend(name='ipyparallel', make_default=False):
"""Register the default ipyparallel backend for joblib."""
from .joblib import register
return register(name=name, make_default=make_default)
# nbextension installation (requires notebook ≥ 4.2)
def _jupyter_server_extension_paths():
return [{'module': 'ipyparallel.nbextension'}]
def _jupyter_nbextension_paths():
return [
{
'section': 'tree',
'src': 'nbextension/static',
'dest': 'ipyparallel',
'require': 'ipyparallel/main',
}
]
def _jupyter_labextension_paths():
return [
{
"src": "labextension",
"dest": "ipyparallel-labextension",
}
]