Skip to content

Commit

Permalink
Assign cellpose resource to only one localcluster worker
Browse files Browse the repository at this point in the history
  • Loading branch information
Maxim Lippeveld committed May 22, 2024
1 parent c24ca27 commit 87f1435
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions src/scip/utils/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,18 @@ def __enter__(self):
self.client = Client(n_workers=1, threads_per_worker=1)
elif self.mode == "local":
from dask.distributed import LocalCluster
with dask.config.set({"distributed.worker.resources.cellpose": 1}):
self.port = self.port or "8787"
self.cluster = LocalCluster(
n_workers=self.n_workers, threads_per_worker=self.threads_per_process,
processes=True, dashboard_address=f":{self.port}"
)

self.port = self.port or "8787"
self.cluster = LocalCluster(
n_workers=self.n_workers, threads_per_worker=self.threads_per_process,
processes=True, dashboard_address=f":{self.port}"
)

if resources:= self.cluster.workers[0].resources:
resources["cellpose"] = 1
else:
self.cluster.workers[0].resources = dict(cellpose=1)

self.client = Client(self.cluster)
elif self.mode == "jobqueue":
from dask_jobqueue import PBSCluster
Expand Down

0 comments on commit 87f1435

Please sign in to comment.