如何检查是否已经存在 运行 dask 调度程序?
How do I check if there is an already running dask scheduler?
我想从 python 启动一个具有特定数量工作人员的本地集群,然后将客户端连接到它。
cluster = LocalCluster(n_workers=8, ip='127.0.0.1')
client = Client(cluster)
但之前,我想检查是否有一个现有的本地集群,例如由 dask-scheduler 命令启动。有办法吗?
没有标准约定来检查您的计算机上是否存在调度程序。您能做的最好的事情就是尝试使用较短的超时时间。默认端口为 8786
from dask.distributed import Client, TimeoutError
try:
client = Client('tcp://localhost:8786', timeout='2s')
except TimeoutError:
pass
我想从 python 启动一个具有特定数量工作人员的本地集群,然后将客户端连接到它。
cluster = LocalCluster(n_workers=8, ip='127.0.0.1')
client = Client(cluster)
但之前,我想检查是否有一个现有的本地集群,例如由 dask-scheduler 命令启动。有办法吗?
没有标准约定来检查您的计算机上是否存在调度程序。您能做的最好的事情就是尝试使用较短的超时时间。默认端口为 8786
from dask.distributed import Client, TimeoutError
try:
client = Client('tcp://localhost:8786', timeout='2s')
except TimeoutError:
pass