Skip to content

Commit 087bda8

Browse files
committed
Adjusting to feedback:
- added info on GPU logic in docs - adjusted scheduler GPU logic - fixed the machine type checker
1 parent 5c19ceb commit 087bda8

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

dask_cloudprovider/gcp/instances.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -453,10 +453,11 @@ class GCPCluster(VMCluster):
453453
extra_bootstrap: list[str] (optional)
454454
Extra commands to be run during the bootstrap phase.
455455
ngpus: int (optional)
456-
The number of GPUs to atatch to the instance.
456+
The number of GPUs to atatch to the worker instance. No work is expected to be done on scheduler, so no
457+
GPU there.
457458
Default is ``0``.
458459
gpu_type: str (optional)
459-
The name of the GPU to use. This must be set if ``ngpus>0``.
460+
The name of the GPU to use on worker. This must be set if ``ngpus>0``.
460461
You can see a list of GPUs available in each zone with ``gcloud compute accelerator-types list``.
461462
filesystem_size: int (optional)
462463
The VM filesystem size in GB. Defaults to ``50``.
@@ -616,6 +617,8 @@ def __init__(
616617
if machine_type is None:
617618
self.scheduler_machine_type = scheduler_machine_type or self.config.get("scheduler_machine_type")
618619
self.worker_machine_type = worker_machine_type or self.config.get("worker_machine_type")
620+
if self.scheduler_machine_type is None or self.worker_machine_type is None:
621+
raise ValueError("machine_type and scheduler_machine_type must be set")
619622
else:
620623
if scheduler_machine_type is not None or worker_machine_type is not None:
621624
raise ValueError("If you specify machine_type, you may not specify scheduler_machine_type or worker_machine_type")
@@ -657,12 +660,12 @@ def __init__(
657660
self.scheduler_options["machine_type"] = self.scheduler_machine_type
658661
self.worker_options["machine_type"] = self.worker_machine_type
659662

660-
if ngpus is not None:
661-
self.scheduler_options["ngpus"] = 0
662-
self.scheduler_options["gpu_type"] = None
663-
self.scheduler_options["gpu_instance"] = False
663+
# Scheduler always does not have GPUs as no work is expected to be done there
664+
self.scheduler_options["ngpus"] = 0
665+
self.scheduler_options["gpu_type"] = None
666+
self.scheduler_options["gpu_instance"] = False
664667

665-
self.worker_ngpus = ngpus
668+
if ngpus or self.config.get("ngpus"):
666669
self.worker_options["ngpus"] = ngpus or self.config.get("ngpus")
667670
self.worker_options["gpu_type"] = gpu_type or self.config.get("gpu_type")
668671
self.worker_options["gpu_instance"] = True

0 commit comments

Comments
 (0)