Skip to content

Commit d473d24

Browse files
committed
fix: remove for , add comment for
1 parent ce20743 commit d473d24

File tree

3 files changed

+19
-15
lines changed

3 files changed

+19
-15
lines changed

google/cloud/aiplatform/jobs.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -1061,7 +1061,7 @@ def from_local_script(
10611061
accelerator_count: int = 0,
10621062
boot_disk_type: str = "pd-ssd",
10631063
boot_disk_size_gb: int = 100,
1064-
reduction_server_replica_count: Optional[int] = 0,
1064+
reduction_server_replica_count: int = 0,
10651065
reduction_server_machine_type: Optional[str] = None,
10661066
reduction_server_container_uri: Optional[str] = None,
10671067
base_output_dir: Optional[str] = None,
@@ -1131,7 +1131,7 @@ def from_local_script(
11311131
Optional. Size in GB of the boot disk, default is 100GB.
11321132
boot disk size must be within the range of [100, 64000].
11331133
reduction_server_replica_count (int):
1134-
Optional. The number of reduction server replicas.
1134+
The number of reduction server replicas, default is 0.
11351135
reduction_server_machine_type (str):
11361136
Optional. The type of machine to use for reduction server.
11371137
reduction_server_container_uri (str):
@@ -1209,7 +1209,7 @@ def from_local_script(
12091209
continue
12101210

12111211
if (
1212-
spec_order == worker_spec_utils.SPEC_ORDERS["server_spec"]
1212+
spec_order == worker_spec_utils._SPEC_ORDERS["server_spec"]
12131213
and reduction_server_replica_count > 0
12141214
):
12151215
spec["container_spec"] = {

google/cloud/aiplatform/training_jobs.py

+11-11
Original file line numberDiff line numberDiff line change
@@ -1278,7 +1278,7 @@ def _prepare_and_validate_run(
12781278
accelerator_count: int = 0,
12791279
boot_disk_type: str = "pd-ssd",
12801280
boot_disk_size_gb: int = 100,
1281-
reduction_server_replica_count: Optional[int] = 0,
1281+
reduction_server_replica_count: int = 0,
12821282
reduction_server_machine_type: Optional[str] = None,
12831283
) -> Tuple[worker_spec_utils._DistributedTrainingSpec, Optional[gca_model.Model]]:
12841284
"""Create worker pool specs and managed model as well validating the
@@ -1321,7 +1321,7 @@ def _prepare_and_validate_run(
13211321
Size in GB of the boot disk, default is 100GB.
13221322
boot disk size must be within the range of [100, 64000].
13231323
reduction_server_replica_count (int):
1324-
Optional. The number of reduction server replicas.
1324+
The number of reduction server replicas, default is 0.
13251325
reduction_server_machine_type (str):
13261326
Optional. The type of machine to use for reduction server.
13271327
Returns:
@@ -1744,7 +1744,7 @@ def run(
17441744
accelerator_count: int = 0,
17451745
boot_disk_type: str = "pd-ssd",
17461746
boot_disk_size_gb: int = 100,
1747-
reduction_server_replica_count: Optional[int] = 0,
1747+
reduction_server_replica_count: int = 0,
17481748
reduction_server_machine_type: Optional[str] = None,
17491749
reduction_server_container_uri: Optional[str] = None,
17501750
training_fraction_split: Optional[float] = None,
@@ -1919,7 +1919,7 @@ def run(
19191919
Size in GB of the boot disk, default is 100GB.
19201920
boot disk size must be within the range of [100, 64000].
19211921
reduction_server_replica_count (int):
1922-
Optional. The number of reduction server replicas.
1922+
The number of reduction server replicas, default is 0.
19231923
reduction_server_machine_type (str):
19241924
Optional. The type of machine to use for reduction server.
19251925
reduction_server_container_uri (str):
@@ -2229,7 +2229,7 @@ def _run(
22292229
continue
22302230

22312231
if (
2232-
spec_order == worker_spec_utils.SPEC_ORDERS["server_spec"]
2232+
spec_order == worker_spec_utils._SPEC_ORDERS["server_spec"]
22332233
and reduction_server_container_uri
22342234
):
22352235
spec["container_spec"] = {
@@ -2536,7 +2536,7 @@ def run(
25362536
accelerator_count: int = 0,
25372537
boot_disk_type: str = "pd-ssd",
25382538
boot_disk_size_gb: int = 100,
2539-
reduction_server_replica_count: Optional[int] = 0,
2539+
reduction_server_replica_count: int = 0,
25402540
reduction_server_machine_type: Optional[str] = None,
25412541
reduction_server_container_uri: Optional[str] = None,
25422542
training_fraction_split: Optional[float] = None,
@@ -2704,7 +2704,7 @@ def run(
27042704
Size in GB of the boot disk, default is 100GB.
27052705
boot disk size must be within the range of [100, 64000].
27062706
reduction_server_replica_count (int):
2707-
Optional. The number of reduction server replicas.
2707+
The number of reduction server replicas, default is 0.
27082708
reduction_server_machine_type (str):
27092709
Optional. The type of machine to use for reduction server.
27102710
reduction_server_container_uri (str):
@@ -3003,7 +3003,7 @@ def _run(
30033003
continue
30043004

30053005
if (
3006-
spec_order == worker_spec_utils.SPEC_ORDERS["server_spec"]
3006+
spec_order == worker_spec_utils._SPEC_ORDERS["server_spec"]
30073007
and reduction_server_container_uri
30083008
):
30093009
spec["container_spec"] = {
@@ -5299,7 +5299,7 @@ def run(
52995299
accelerator_count: int = 0,
53005300
boot_disk_type: str = "pd-ssd",
53015301
boot_disk_size_gb: int = 100,
5302-
reduction_server_replica_count: Optional[int] = 0,
5302+
reduction_server_replica_count: int = 0,
53035303
reduction_server_machine_type: Optional[str] = None,
53045304
reduction_server_container_uri: Optional[str] = None,
53055305
training_fraction_split: Optional[float] = None,
@@ -5467,7 +5467,7 @@ def run(
54675467
Size in GB of the boot disk, default is 100GB.
54685468
boot disk size must be within the range of [100, 64000].
54695469
reduction_server_replica_count (int):
5470-
Optional. The number of reduction server replicas.
5470+
The number of reduction server replicas, default is 0.
54715471
reduction_server_machine_type (str):
54725472
Optional. The type of machine to use for reduction server.
54735473
reduction_server_container_uri (str):
@@ -5747,7 +5747,7 @@ def _run(
57475747
continue
57485748

57495749
if (
5750-
spec_order == worker_spec_utils.SPEC_ORDERS["server_spec"]
5750+
spec_order == worker_spec_utils._SPEC_ORDERS["server_spec"]
57515751
and reduction_server_container_uri
57525752
):
57535753
spec["container_spec"] = {

google/cloud/aiplatform/utils/worker_spec_utils.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,11 @@
2121
accelerator_type as gca_accelerator_type_compat,
2222
)
2323

24-
SPEC_ORDERS = {
24+
# `_SPEC_ORDERS` contains the worker pool spec type and its order in the `_WorkerPoolSpec`.
25+
# The `server_spec` supports either reduction server or parameter server, each
26+
# with different configuration for its `container_spec`. This mapping will be
27+
# used during configuration of `container_spec` for all worker pool specs.
28+
_SPEC_ORDERS = {
2529
"chief_spec": 0,
2630
"worker_spec": 1,
2731
"server_spec": 2,

0 commit comments

Comments
 (0)