@@ -403,6 +403,8 @@ class AllocationPolicy(proto.Message):
403403 reserved.
404404 network (google.cloud.batch_v1.types.AllocationPolicy.NetworkPolicy):
405405 The network policy.
406+ placement (google.cloud.batch_v1.types.AllocationPolicy.PlacementPolicy):
407+ The placement policy.
406408 """
407409
408410 class ProvisioningModel (proto .Enum ):
@@ -435,13 +437,16 @@ class LocationPolicy(proto.Message):
435437 Attributes:
436438 allowed_locations (MutableSequence[str]):
437439 A list of allowed location names represented by internal
438- URLs. Each location can be a region or a zone. Only one
439- region or multiple zones in one region is supported now. For
440- example, ["regions/us-central1"] allow VMs in any zones in
441- region us-central1. ["zones/us-central1-a",
442- "zones/us-central1-c"] only allow VMs in zones us-central1-a
443- and us-central1-c. All locations end up in different regions
444- would cause errors. For example, ["regions/us-central1",
440+ URLs.
441+
442+ Each location can be a region or a zone. Only one region or
443+ multiple zones in one region is supported now. For example,
444+ ["regions/us-central1"] allow VMs in any zones in region
445+ us-central1. ["zones/us-central1-a", "zones/us-central1-c"]
446+ only allow VMs in zones us-central1-a and us-central1-c.
447+
448+ All locations end up in different regions would cause
449+ errors. For example, ["regions/us-central1",
445450 "zones/us-central1-a", "zones/us-central1-b",
446451 "zones/us-west1-a"] contains 2 regions "us-central1" and
447452 "us-west1". An error is expected in this case.
@@ -455,7 +460,8 @@ class LocationPolicy(proto.Message):
455460 class Disk (proto .Message ):
456461 r"""A new persistent disk or a local ssd.
457462 A VM can only have one local SSD setting but multiple local SSD
458- partitions. https://cloud.google.com/compute/docs/disks#pdspecs.
463+ partitions. See
464+ https://cloud.google.com/compute/docs/disks#pdspecs and
459465 https://cloud.google.com/compute/docs/disks#localssds.
460466
461467 This message has `oneof`_ fields (mutually exclusive fields).
@@ -468,20 +474,24 @@ class Disk(proto.Message):
468474 Attributes:
469475 image (str):
470476 Name of a public or custom image used as the data source.
471- For example, the following are all valid URLs: (1) Specify
472- the image by its family name:
473- projects/{project}/global/images/family/{image_family} (2)
474- Specify the image version:
475- projects/{project}/global/images/{image_version} You can
476- also use Batch customized image in short names. The
477+ For example, the following are all valid URLs:
478+
479+ - Specify the image by its family name:
480+ projects/{project}/global/images/family/{image_family}
481+ - Specify the image version:
482+ projects/{project}/global/images/{image_version}
483+
484+ You can also use Batch customized image in short names. The
477485 following image values are supported for a boot disk:
478- "batch-debian": use Batch Debian images. "batch-centos": use
479- Batch CentOS images. "batch-cos": use Batch
480- Container-Optimized images.
486+
487+ - "batch-debian": use Batch Debian images.
488+ - "batch-centos": use Batch CentOS images.
489+ - "batch-cos": use Batch Container-Optimized images.
481490
482491 This field is a member of `oneof`_ ``data_source``.
483492 snapshot (str):
484493 Name of a snapshot used as the data source.
494+ Snapshot is not supported as boot disk now.
485495
486496 This field is a member of `oneof`_ ``data_source``.
487497 type_ (str):
@@ -490,11 +500,13 @@ class Disk(proto.Message):
490500 disks and boot disks use "pd-balanced", "pd-extreme",
491501 "pd-ssd" or "pd-standard".
492502 size_gb (int):
493- Disk size in GB. For persistent disk, this field is ignored
494- if ``data_source`` is ``image`` or ``snapshot``. For local
495- SSD, size_gb should be a multiple of 375GB, otherwise, the
496- final size will be the next greater multiple of 375 GB. For
497- boot disk, Batch will calculate the boot disk size based on
503+ Disk size in GB.
504+
505+ For persistent disk, this field is ignored if
506+ ``data_source`` is ``image`` or ``snapshot``. For local SSD,
507+ size_gb should be a multiple of 375GB, otherwise, the final
508+ size will be the next greater multiple of 375 GB. For boot
509+ disk, Batch will calculate the boot disk size based on
498510 source image and task requirements if you do not speicify
499511 the size. If both this field and the boot_disk_mib field in
500512 task spec's compute_resource are defined, Batch will only
@@ -607,18 +619,20 @@ class InstancePolicy(proto.Message):
607619 machine_type (str):
608620 The Compute Engine machine type.
609621 min_cpu_platform (str):
610- The minimum CPU platform. See
611- ``https://cloud.google.com/compute/docs/instances/specify-min-cpu-platform``.
622+ The minimum CPU platform.
623+ See
624+ https://cloud.google.com/compute/docs/instances/specify-min-cpu-platform.
612625 Not yet implemented.
613626 provisioning_model (google.cloud.batch_v1.types.AllocationPolicy.ProvisioningModel):
614627 The provisioning model.
615628 accelerators (MutableSequence[google.cloud.batch_v1.types.AllocationPolicy.Accelerator]):
616629 The accelerators attached to each VM
617630 instance.
618631 boot_disk (google.cloud.batch_v1.types.AllocationPolicy.Disk):
619- Book disk to be created and attached to each
632+ Boot disk to be created and attached to each
620633 VM by this InstancePolicy. Boot disk will be
621- deleted when the VM is deleted.
634+ deleted when the VM is deleted. Batch API now
635+ only supports booting from image.
622636 disks (MutableSequence[google.cloud.batch_v1.types.AllocationPolicy.AttachedDisk]):
623637 Non-boot disks to be attached for each VM
624638 created by this InstancePolicy. New disks will
@@ -705,21 +719,23 @@ class NetworkInterface(proto.Message):
705719
706720 Attributes:
707721 network (str):
708- The URL of an existing network resource.
709- You can specify the network as a full or partial
710- URL. For example, the following are all valid
711- URLs:
712- https://www.googleapis.com/compute/v1/projects/{project}/global/networks/{network}
713- projects/{project}/global/networks/{network}
714- global/networks/{network}
722+ The URL of an existing network resource. You can specify the
723+ network as a full or partial URL.
724+
725+ For example, the following are all valid URLs:
726+
727+ - https://www.googleapis.com/compute/v1/projects/{project}/global/networks/{network}
728+ - projects/{project}/global/networks/{network}
729+ - global/networks/{network}
715730 subnetwork (str):
716- The URL of an existing subnetwork resource in
717- the network. You can specify the subnetwork as a
718- full or partial URL. For example, the following
719- are all valid URLs:
720- https://www.googleapis.com/compute/v1/projects/{project}/regions/{region}/subnetworks/{subnetwork}
721- projects/{project}/regions/{region}/subnetworks/{subnetwork}
722- regions/{region}/subnetworks/{subnetwork}
731+ The URL of an existing subnetwork resource in the network.
732+ You can specify the subnetwork as a full or partial URL.
733+
734+ For example, the following are all valid URLs:
735+
736+ - https://www.googleapis.com/compute/v1/projects/{project}/regions/{region}/subnetworks/{subnetwork}
737+ - projects/{project}/regions/{region}/subnetworks/{subnetwork}
738+ - regions/{region}/subnetworks/{subnetwork}
723739 no_external_ip_address (bool):
724740 Default is false (with an external IP
725741 address). Required if no external public IP
@@ -762,6 +778,36 @@ class NetworkPolicy(proto.Message):
762778 message = "AllocationPolicy.NetworkInterface" ,
763779 )
764780
781+ class PlacementPolicy (proto .Message ):
782+ r"""PlacementPolicy describes a group placement policy for the
783+ VMs controlled by this AllocationPolicy.
784+
785+ Attributes:
786+ collocation (str):
787+ UNSPECIFIED vs. COLLOCATED (default
788+ UNSPECIFIED). Use COLLOCATED when you want VMs
789+ to be located close to each other for low
790+ network latency between the VMs. No placement
791+ policy will be generated when collocation is
792+ UNSPECIFIED.
793+ max_distance (int):
794+ When specified, causes the job to fail if more than
795+ max_distance logical switches are required between VMs.
796+ Batch uses the most compact possible placement of VMs even
797+ when max_distance is not specified. An explicit max_distance
798+ makes that level of compactness a strict requirement. Not
799+ yet implemented
800+ """
801+
802+ collocation : str = proto .Field (
803+ proto .STRING ,
804+ number = 1 ,
805+ )
806+ max_distance : int = proto .Field (
807+ proto .INT64 ,
808+ number = 2 ,
809+ )
810+
765811 location : LocationPolicy = proto .Field (
766812 proto .MESSAGE ,
767813 number = 1 ,
@@ -787,6 +833,11 @@ class NetworkPolicy(proto.Message):
787833 number = 7 ,
788834 message = NetworkPolicy ,
789835 )
836+ placement : PlacementPolicy = proto .Field (
837+ proto .MESSAGE ,
838+ number = 10 ,
839+ message = PlacementPolicy ,
840+ )
790841
791842
792843class TaskGroup (proto .Message ):
@@ -804,10 +855,11 @@ class TaskGroup(proto.Message):
804855 task spec.
805856 task_count (int):
806857 Number of Tasks in the TaskGroup.
807- default is 1
858+ Default is 1.
808859 parallelism (int):
809860 Max number of tasks that can run in parallel. Default to
810- min(task_count, 1000).
861+ min(task_count, 1000). Field parallelism must be 1 if the
862+ scheduling_policy is IN_ORDER.
811863 task_environments (MutableSequence[google.cloud.batch_v1.types.Environment]):
812864 An array of environment variable mappings, which are passed
813865 to Tasks with matching indices. If task_environments is used
0 commit comments