如何在 dask-distributed 中使用 `client.start_ipython_workers()`?

How to use `client.start_ipython_workers()` in dask-distributed?

我试图让工作人员从他们的 ipython 内核输出一些信息并在 ipython 会话中执行各种命令。我尝试了文档中的示例,ipyparallel 示例有效,但第二个示例无效(使用 ipython 魔法)。我无法让工人执行任何命令。例如,我遇到了以下问题:

from dask.distributed import Client

client = Client()

info = client.start_ipython_workers()

list_workers = info.keys()

%remote info[list_workers[0]]

最后一行returns出错:

---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-19-9118451af441> in <module>
----> 1 get_ipython().run_line_magic('remote', "info['tcp://127.0.0.1:50497'] worker.active")

~/miniconda/envs/dask/lib/python3.7/site-packages/IPython/core/interactiveshell.py in run_line_magic(self, magic_name, line, _stack_depth)
   2334                 kwargs['local_ns'] = self.get_local_scope(stack_depth)
   2335             with self.builtin_trap:
-> 2336                 result = fn(*args, **kwargs)
   2337             return result
   2338 

~/miniconda/envs/dask/lib/python3.7/site-packages/distributed/_ipython_utils.py in remote_magic(line, cell)
    115     info_name = split_line[0]
    116     if info_name not in ip.user_ns:
--> 117         raise NameError(info_name)
    118     connection_info = dict(ip.user_ns[info_name])
    119 

NameError: info['tcp://127.0.0.1:50497']

如果有任何示例说明如何从 ipython 内核 运行 获取有关工作人员的任何信息,我将不胜感激。

在这里发帖只是为了跟踪,我在 GitHub 上为此提出了一个问题:https://github.com/dask/distributed/issues/4522