Skip to content

Commit

Permalink
Don't use the dask distributed Client if the scheduler is set to threads
Browse files Browse the repository at this point in the history
  • Loading branch information
sjperkins committed Jan 9, 2025
1 parent dabb073 commit 332f646
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions crystalball/crystalball.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,15 +157,16 @@ def construct_client(
address: str | None = None,
workers: int = 1,
) -> Client:

if scheduler not in ["threads", "distributed"]:
raise ValueError(f"Unknown scheduler type: {scheduler}")

# Following Quartical's constuction of a dask client
if scheduler == "threads":
log.info("Initializing dask client using threads scheduler.")
return exitstack.enter_context(Client(n_workers=num_workers))

exitstack.enter_context(dask.config.set(num_workers=num_workers))
return None

address = address or os.environ.get("DASK_SCHEDULER_ADDRESS")
if address:
log.info(
Expand Down

0 comments on commit 332f646

Please sign in to comment.