@@ -515,6 +515,8 @@ class AllocationPolicy(proto.Message):
515
515
reserved.
516
516
network (google.cloud.batch_v1alpha.types.AllocationPolicy.NetworkPolicy):
517
517
The network policy.
518
+ placement (google.cloud.batch_v1alpha.types.AllocationPolicy.PlacementPolicy):
519
+ The placement policy.
518
520
"""
519
521
520
522
class ProvisioningModel (proto .Enum ):
@@ -547,13 +549,16 @@ class LocationPolicy(proto.Message):
547
549
Attributes:
548
550
allowed_locations (MutableSequence[str]):
549
551
A list of allowed location names represented by internal
550
- URLs. Each location can be a region or a zone. Only one
551
- region or multiple zones in one region is supported now. For
552
- example, ["regions/us-central1"] allow VMs in any zones in
553
- region us-central1. ["zones/us-central1-a",
554
- "zones/us-central1-c"] only allow VMs in zones us-central1-a
555
- and us-central1-c. All locations end up in different regions
556
- would cause errors. For example, ["regions/us-central1",
552
+ URLs.
553
+
554
+ Each location can be a region or a zone. Only one region or
555
+ multiple zones in one region is supported now. For example,
556
+ ["regions/us-central1"] allow VMs in any zones in region
557
+ us-central1. ["zones/us-central1-a", "zones/us-central1-c"]
558
+ only allow VMs in zones us-central1-a and us-central1-c.
559
+
560
+ All locations end up in different regions would cause
561
+ errors. For example, ["regions/us-central1",
557
562
"zones/us-central1-a", "zones/us-central1-b",
558
563
"zones/us-west1-a"] contains 2 regions "us-central1" and
559
564
"us-west1". An error is expected in this case.
@@ -574,7 +579,8 @@ class LocationPolicy(proto.Message):
574
579
class Disk (proto .Message ):
575
580
r"""A new persistent disk or a local ssd.
576
581
A VM can only have one local SSD setting but multiple local SSD
577
- partitions. https://cloud.google.com/compute/docs/disks#pdspecs.
582
+ partitions. See
583
+ https://cloud.google.com/compute/docs/disks#pdspecs and
578
584
https://cloud.google.com/compute/docs/disks#localssds.
579
585
580
586
This message has `oneof`_ fields (mutually exclusive fields).
@@ -587,20 +593,24 @@ class Disk(proto.Message):
587
593
Attributes:
588
594
image (str):
589
595
Name of a public or custom image used as the data source.
590
- For example, the following are all valid URLs: (1) Specify
591
- the image by its family name:
592
- projects/{project}/global/images/family/{image_family} (2)
593
- Specify the image version:
594
- projects/{project}/global/images/{image_version} You can
595
- also use Batch customized image in short names. The
596
+ For example, the following are all valid URLs:
597
+
598
+ - Specify the image by its family name:
599
+ projects/{project}/global/images/family/{image_family}
600
+ - Specify the image version:
601
+ projects/{project}/global/images/{image_version}
602
+
603
+ You can also use Batch customized image in short names. The
596
604
following image values are supported for a boot disk:
597
- "batch-debian": use Batch Debian images. "batch-centos": use
598
- Batch CentOS images. "batch-cos": use Batch
599
- Container-Optimized images.
605
+
606
+ - "batch-debian": use Batch Debian images.
607
+ - "batch-centos": use Batch CentOS images.
608
+ - "batch-cos": use Batch Container-Optimized images.
600
609
601
610
This field is a member of `oneof`_ ``data_source``.
602
611
snapshot (str):
603
612
Name of a snapshot used as the data source.
613
+ Snapshot is not supported as boot disk now.
604
614
605
615
This field is a member of `oneof`_ ``data_source``.
606
616
type_ (str):
@@ -609,11 +619,13 @@ class Disk(proto.Message):
609
619
disks and boot disks use "pd-balanced", "pd-extreme",
610
620
"pd-ssd" or "pd-standard".
611
621
size_gb (int):
612
- Disk size in GB. For persistent disk, this field is ignored
613
- if ``data_source`` is ``image`` or ``snapshot``. For local
614
- SSD, size_gb should be a multiple of 375GB, otherwise, the
615
- final size will be the next greater multiple of 375 GB. For
616
- boot disk, Batch will calculate the boot disk size based on
622
+ Disk size in GB.
623
+
624
+ For persistent disk, this field is ignored if
625
+ ``data_source`` is ``image`` or ``snapshot``. For local SSD,
626
+ size_gb should be a multiple of 375GB, otherwise, the final
627
+ size will be the next greater multiple of 375 GB. For boot
628
+ disk, Batch will calculate the boot disk size based on
617
629
source image and task requirements if you do not speicify
618
630
the size. If both this field and the boot_disk_mib field in
619
631
task spec's compute_resource are defined, Batch will only
@@ -728,25 +740,29 @@ class InstancePolicy(proto.Message):
728
740
machine_type (str):
729
741
The Compute Engine machine type.
730
742
min_cpu_platform (str):
731
- The minimum CPU platform. See
732
- ``https://cloud.google.com/compute/docs/instances/specify-min-cpu-platform``.
743
+ The minimum CPU platform.
744
+ See
745
+ https://cloud.google.com/compute/docs/instances/specify-min-cpu-platform.
733
746
Not yet implemented.
734
747
provisioning_model (google.cloud.batch_v1alpha.types.AllocationPolicy.ProvisioningModel):
735
748
The provisioning model.
736
749
accelerators (MutableSequence[google.cloud.batch_v1alpha.types.AllocationPolicy.Accelerator]):
737
750
The accelerators attached to each VM
738
751
instance.
739
752
boot_disk (google.cloud.batch_v1alpha.types.AllocationPolicy.Disk):
740
- Book disk to be created and attached to each
753
+ Boot disk to be created and attached to each
741
754
VM by this InstancePolicy. Boot disk will be
742
- deleted when the VM is deleted.
755
+ deleted when the VM is deleted. Batch API now
756
+ only supports booting from image.
743
757
disks (MutableSequence[google.cloud.batch_v1alpha.types.AllocationPolicy.AttachedDisk]):
744
758
Non-boot disks to be attached for each VM
745
759
created by this InstancePolicy. New disks will
746
760
be deleted when the VM is deleted.
747
761
reservation (str):
748
- If specified, VMs will be allocated only
749
- inside the matching reservation.
762
+ If specified, VMs will consume only the
763
+ specified reservation. If not specified
764
+ (default), VMs will consume any applicable
765
+ reservation.
750
766
"""
751
767
752
768
allowed_machine_types : MutableSequence [str ] = proto .RepeatedField (
@@ -837,21 +853,23 @@ class NetworkInterface(proto.Message):
837
853
838
854
Attributes:
839
855
network (str):
840
- The URL of an existing network resource.
841
- You can specify the network as a full or partial
842
- URL. For example, the following are all valid
843
- URLs:
844
- https://www.googleapis.com/compute/v1/projects/{project}/global/networks/{network}
845
- projects/{project}/global/networks/{network}
846
- global/networks/{network}
856
+ The URL of an existing network resource. You can specify the
857
+ network as a full or partial URL.
858
+
859
+ For example, the following are all valid URLs:
860
+
861
+ - https://www.googleapis.com/compute/v1/projects/{project}/global/networks/{network}
862
+ - projects/{project}/global/networks/{network}
863
+ - global/networks/{network}
847
864
subnetwork (str):
848
- The URL of an existing subnetwork resource in
849
- the network. You can specify the subnetwork as a
850
- full or partial URL. For example, the following
851
- are all valid URLs:
852
- https://www.googleapis.com/compute/v1/projects/{project}/regions/{region}/subnetworks/{subnetwork}
853
- projects/{project}/regions/{region}/subnetworks/{subnetwork}
854
- regions/{region}/subnetworks/{subnetwork}
865
+ The URL of an existing subnetwork resource in the network.
866
+ You can specify the subnetwork as a full or partial URL.
867
+
868
+ For example, the following are all valid URLs:
869
+
870
+ - https://www.googleapis.com/compute/v1/projects/{project}/regions/{region}/subnetworks/{subnetwork}
871
+ - projects/{project}/regions/{region}/subnetworks/{subnetwork}
872
+ - regions/{region}/subnetworks/{subnetwork}
855
873
no_external_ip_address (bool):
856
874
Default is false (with an external IP
857
875
address). Required if no external public IP
@@ -894,6 +912,36 @@ class NetworkPolicy(proto.Message):
894
912
message = "AllocationPolicy.NetworkInterface" ,
895
913
)
896
914
915
+ class PlacementPolicy (proto .Message ):
916
+ r"""PlacementPolicy describes a group placement policy for the
917
+ VMs controlled by this AllocationPolicy.
918
+
919
+ Attributes:
920
+ collocation (str):
921
+ UNSPECIFIED vs. COLLOCATED (default
922
+ UNSPECIFIED). Use COLLOCATED when you want VMs
923
+ to be located close to each other for low
924
+ network latency between the VMs. No placement
925
+ policy will be generated when collocation is
926
+ UNSPECIFIED.
927
+ max_distance (int):
928
+ When specified, causes the job to fail if more than
929
+ max_distance logical switches are required between VMs.
930
+ Batch uses the most compact possible placement of VMs even
931
+ when max_distance is not specified. An explicit max_distance
932
+ makes that level of compactness a strict requirement. Not
933
+ yet implemented
934
+ """
935
+
936
+ collocation : str = proto .Field (
937
+ proto .STRING ,
938
+ number = 1 ,
939
+ )
940
+ max_distance : int = proto .Field (
941
+ proto .INT64 ,
942
+ number = 2 ,
943
+ )
944
+
897
945
location : LocationPolicy = proto .Field (
898
946
proto .MESSAGE ,
899
947
number = 1 ,
@@ -937,6 +985,11 @@ class NetworkPolicy(proto.Message):
937
985
number = 7 ,
938
986
message = NetworkPolicy ,
939
987
)
988
+ placement : PlacementPolicy = proto .Field (
989
+ proto .MESSAGE ,
990
+ number = 10 ,
991
+ message = PlacementPolicy ,
992
+ )
940
993
941
994
942
995
class TaskGroup (proto .Message ):
@@ -954,12 +1007,14 @@ class TaskGroup(proto.Message):
954
1007
task spec.
955
1008
task_count (int):
956
1009
Number of Tasks in the TaskGroup.
957
- default is 1
1010
+ Default is 1.
958
1011
parallelism (int):
959
1012
Max number of tasks that can run in parallel. Default to
960
- min(task_count, 1000).
1013
+ min(task_count, 1000). Field parallelism must be 1 if the
1014
+ scheduling_policy is IN_ORDER.
961
1015
scheduling_policy (google.cloud.batch_v1alpha.types.TaskGroup.SchedulingPolicy):
962
- Scheduling policy for Tasks in the TaskGroup.
1016
+ Scheduling policy for Tasks in the TaskGroup. The default
1017
+ value is AS_SOON_AS_POSSIBLE.
963
1018
allocation_policy (google.cloud.batch_v1alpha.types.AllocationPolicy):
964
1019
Compute resource allocation for the
965
1020
TaskGroup. If specified, it overrides resources
@@ -1011,9 +1066,17 @@ class SchedulingPolicy(proto.Enum):
1011
1066
Unspecified.
1012
1067
AS_SOON_AS_POSSIBLE (1):
1013
1068
Run Tasks as soon as resources are available.
1069
+
1070
+ Tasks might be executed in parallel depending on parallelism
1071
+ and task_count values.
1072
+ IN_ORDER (2):
1073
+ Run Tasks sequentially with increased task
1074
+ index.
1075
+ Not yet implemented.
1014
1076
"""
1015
1077
SCHEDULING_POLICY_UNSPECIFIED = 0
1016
1078
AS_SOON_AS_POSSIBLE = 1
1079
+ IN_ORDER = 2
1017
1080
1018
1081
name : str = proto .Field (
1019
1082
proto .STRING ,
0 commit comments