Dask - 如何连接到 运行 集群调度程序并访问 'total_occupancy'?
Dask - How to connect to running cluster scheduler and access 'total_occupancy'?
我使用以下方法从 Jupyter notebook 创建本地集群:
from dask.distributed import Client, LocalCluster
cluster = LocalCluster(n_workers=24)
c = Client(cluster)
是否可以在内核被占用时从另一个笔记本连接(计算操作)?
例如,我的目标是访问 'total_occupancy'。
您可以连接到 运行 集群:
c_diffrent_notebook = Client('127.0.0.1:8786') # '127.0.0.1:8786' is the default
我建议在原始集群中明确指定主机,不要依赖默认值。
您可以通过客户端集群访问调度程序:
c_diffrent_notebook.cluster.scheduler.total_occupancy
按照@moshevi 的建议,您可以通过提供地址连接到调度程序。
client = Client("address-of-scheduler")
然后可以使用client.run_on_scheduler
命令在远程调度器上执行操作
client.run_on_scheduler(lambda dask_scheduler: dask_scheduler.total_occupancy)
https://docs.dask.org/en/latest/futures.html#distributed.Client.run_on_scheduler
我使用以下方法从 Jupyter notebook 创建本地集群:
from dask.distributed import Client, LocalCluster
cluster = LocalCluster(n_workers=24)
c = Client(cluster)
是否可以在内核被占用时从另一个笔记本连接(计算操作)?
例如,我的目标是访问 'total_occupancy'。
您可以连接到 运行 集群:
c_diffrent_notebook = Client('127.0.0.1:8786') # '127.0.0.1:8786' is the default
我建议在原始集群中明确指定主机,不要依赖默认值。
您可以通过客户端集群访问调度程序:
c_diffrent_notebook.cluster.scheduler.total_occupancy
按照@moshevi 的建议,您可以通过提供地址连接到调度程序。
client = Client("address-of-scheduler")
然后可以使用client.run_on_scheduler
命令在远程调度器上执行操作
client.run_on_scheduler(lambda dask_scheduler: dask_scheduler.total_occupancy)
https://docs.dask.org/en/latest/futures.html#distributed.Client.run_on_scheduler