我无法弄清楚如何正常释放分配的SLURMCluster。我的代码这样做:
from dask_import compute, delayed
from dask_jobqueue import SLURMCluster
from dask.distributed import Client
cluster = SLURMCluster(cores = 2, memory = '2GB')
workers = cluster.start_workers(5) # problem 1: workers is a NoneType object
client = Client(cluster)
def func(x):
pass
r1 = client.submit(func, 10)
r2 = client.submit(func, 20)
res = client.gather([r1, r2])
client.close()
这时,集群的状态仍然显示为“正在运行”。
我正在做
cluster.stop(cluster.running_jobs)
停止集群。这是正确的方法吗?
请注意,由于上面的cluster.stop_workers(workers)
调用返回了NoneType,因此我无法调用cluster.start_workers(5)
。
任何指针将不胜感激。