Kernel 使用ipcluster时指定自定义内核

Kernel 使用ipcluster时指定自定义内核,kernel,ipython,ipython-parallel,Kernel,Ipython,Ipython Parallel,我有一个定制的Jupyter内核。它是使用kernel.json kernelspec指定的 从kernel.json提取的内容显示了如何启动自定义内核: source /opt/conda/bin/activate gdb_ipykernel && exec /opt/conda/envs/gdb_ipykernel/bin/python -m gdb_test.do_tests gdb_test._ipykernel -f {connection_file} 我想将这个内

我有一个定制的Jupyter内核。它是使用kernel.json kernelspec指定的

从kernel.json提取的内容显示了如何启动自定义内核:

source /opt/conda/bin/activate gdb_ipykernel &&  exec /opt/conda/envs/gdb_ipykernel/bin/python -m gdb_test.do_tests gdb_test._ipykernel -f {connection_file}
我想将这个内核与IPython并行使用。例如,使用其中几个自定义内核运行ipcluster

我已经创建了一个新的IPython配置文件

(ipython 5.1.0版)

这将创建一个包含各种配置(.py)文件的概要文件文件夹

我可以用个人资料运行ipython

ipython --profile gdb_gcc_par --debug
输出:

(root) dinne@654f3bb1ef03:~/.ipython/profile_gdb_gcc_par$ ipython --profile gdb_gcc_par --debug
[TerminalIPythonApp] IPYTHONDIR set to: /home/dinne/.ipython
[TerminalIPythonApp] Using existing profile dir: '/home/dinne/.ipython/profile_gdb_gcc_par'
[TerminalIPythonApp] Searching path ['/home/dinne/.ipython/profile_gdb_gcc_par', '/home/dinne/.ipython/profile_gdb_gcc_par', '/usr/local/etc/ipy
thon', '/etc/ipython'] for config files
[TerminalIPythonApp] Attempting to load config file: ipython_config.py
[TerminalIPythonApp] Looking for ipython_config in /etc/ipython
[TerminalIPythonApp] Looking for ipython_config in /usr/local/etc/ipython
[TerminalIPythonApp] Looking for ipython_config in /home/dinne/.ipython/profile_gdb_gcc_par
[TerminalIPythonApp] Loaded config file: /home/dinne/.ipython/profile_gdb_gcc_par/ipython_config.py
[TerminalIPythonApp] Looking for ipython_config in /home/dinne/.ipython/profile_gdb_gcc_par
[TerminalIPythonApp] Loaded config file: /home/dinne/.ipython/profile_gdb_gcc_par/ipython_config.py
Python 3.5.2 |Continuum Analytics, Inc.| (default, Jul  2 2016, 17:53:06)
Type "copyright", "credits" or "license" for more information.

IPython 5.1.0 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.

IPython profile: gdb_gcc_par

[TerminalIPythonApp] Loading IPython extensions...
[TerminalIPythonApp] Loading IPython extension: storemagic
[TerminalIPythonApp] Starting IPython's mainloop...

In [1]:
如果我在ipython_config.py中引入了一个错误,我会看到一条错误消息,因此我得出结论,该配置文件已被考虑在内

如果我在ipython_kernel_config.py中引入一个错误,我看不到任何更改,因此我得出结论,这个配置文件没有被考虑进去

如何指定要使用的内核

我发现这个网站:

其中包括以下代码段:

c = get_config()
c.KernelManager.kernel_cmd = ["/path/to/executable/kernel_exe",
                              "{connection_file}"]  
我将该代码段添加到ipython_config.py中。然而,这没有效果

此外,我发现kernel_cmd已被弃用

我试过一些东西:

尝试1(无效)

尝试2(无效):

添加到~/.ipython/profile\u gdb\u gcc\u par/ipython\u config.py

c.KernelManager.kernel_cmd=['python', 'simple_kernel.py', '{connection_file}']

没有效果

c = get_config()
c.KernelManager.kernel_cmd = ["/path/to/executable/kernel_exe",
                              "{connection_file}"]  
ipcluster start --n=4 --KernelManager.kernel_cmd="['python', 'simple_kernel.py', '{con
nection_file}']"
c.KernelManager.kernel_cmd=['python', 'simple_kernel.py', '{connection_file}']
ipython --profile gdb_gcc_par