Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Sep 5, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 49 additions & 9 deletions google/cloud/batch_v1/types/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,8 @@ class InstanceStatus(proto.Message):
task_pack (int):
The max number of tasks can be assigned to
this instance type.
boot_disk (google.cloud.batch_v1.types.AllocationPolicy.Disk):
The VM boot disk.
"""

machine_type: str = proto.Field(
Expand All @@ -250,6 +252,11 @@ class InstanceStatus(proto.Message):
proto.INT64,
number=3,
)
boot_disk: "AllocationPolicy.Disk" = proto.Field(
proto.MESSAGE,
number=4,
message="AllocationPolicy.Disk",
)

class TaskGroupStatus(proto.Message):
r"""Aggregated task status for a TaskGroup.
Expand Down Expand Up @@ -457,23 +464,38 @@ class Disk(proto.Message):

Attributes:
image (str):
Name of a public or custom image used as the
data source.
Name of a public or custom image used as the data source.
For example, the following are all valid URLs: (1) Specify
the image by its family name:
projects/{project}/global/images/family/{image_family} (2)
Specify the image version:
projects/{project}/global/images/{image_version} You can
also use Batch customized image in short names. The
following image values are supported for a boot disk:
"batch-debian": use Batch Debian images. "batch-centos": use
Batch CentOS images. "batch-cos": use Batch
Container-Optimized images.

This field is a member of `oneof`_ ``data_source``.
snapshot (str):
Name of a snapshot used as the data source.

This field is a member of `oneof`_ ``data_source``.
type_ (str):
Disk type as shown in ``gcloud compute disk-types list`` For
example, "pd-ssd", "pd-standard", "pd-balanced",
"local-ssd".
Disk type as shown in ``gcloud compute disk-types list``.
For example, local SSD uses type "local-ssd". Persistent
disks and boot disks use "pd-balanced", "pd-extreme",
"pd-ssd" or "pd-standard".
size_gb (int):
Disk size in GB. This field is ignored if ``data_source`` is
``disk`` or ``image``. If ``type`` is ``local-ssd``, size_gb
should be a multiple of 375GB, otherwise, the final size
will be the next greater multiple of 375 GB.
Disk size in GB. For persistent disk, this field is ignored
if ``data_source`` is ``image`` or ``snapshot``. For local
SSD, size_gb should be a multiple of 375GB, otherwise, the
final size will be the next greater multiple of 375 GB. For
boot disk, Batch will calculate the boot disk size based on
source image and task requirements if you do not speicify
the size. If both this field and the boot_disk_mib field in
task spec's compute_resource are defined, Batch will only
honor this field.
disk_interface (str):
Local SSDs are available through both "SCSI"
and "NVMe" interfaces. If not indicated, "NVMe"
Expand Down Expand Up @@ -590,6 +612,10 @@ class InstancePolicy(proto.Message):
accelerators (MutableSequence[google.cloud.batch_v1.types.AllocationPolicy.Accelerator]):
The accelerators attached to each VM
instance.
boot_disk (google.cloud.batch_v1.types.AllocationPolicy.Disk):
Book disk to be created and attached to each
VM by this InstancePolicy. Boot disk will be
deleted when the VM is deleted.
disks (MutableSequence[google.cloud.batch_v1.types.AllocationPolicy.AttachedDisk]):
Non-boot disks to be attached for each VM
created by this InstancePolicy. New disks will
Expand All @@ -616,6 +642,11 @@ class InstancePolicy(proto.Message):
number=5,
message="AllocationPolicy.Accelerator",
)
boot_disk: "AllocationPolicy.Disk" = proto.Field(
proto.MESSAGE,
number=8,
message="AllocationPolicy.Disk",
)
disks: MutableSequence["AllocationPolicy.AttachedDisk"] = proto.RepeatedField(
proto.MESSAGE,
number=6,
Expand Down Expand Up @@ -853,12 +884,21 @@ class ServiceAccount(proto.Message):
account has to be specified in the instance
template and it has to match the email field
here.
scopes (MutableSequence[str]):
List of scopes to be enabled for this service
account on the VM, in addition to the
cloud-platform API scope that will be added by
default.
"""

email: str = proto.Field(
proto.STRING,
number=1,
)
scopes: MutableSequence[str] = proto.RepeatedField(
proto.STRING,
number=2,
)


__all__ = tuple(sorted(__protobuf__.manifest))
40 changes: 31 additions & 9 deletions google/cloud/batch_v1alpha/types/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,8 @@ class InstanceStatus(proto.Message):
task_pack (int):
The max number of tasks can be assigned to
this instance type.
boot_disk (google.cloud.batch_v1alpha.types.AllocationPolicy.Disk):
The VM boot disk.
"""

machine_type: str = proto.Field(
Expand All @@ -331,6 +333,11 @@ class InstanceStatus(proto.Message):
proto.INT64,
number=3,
)
boot_disk: "AllocationPolicy.Disk" = proto.Field(
proto.MESSAGE,
number=4,
message="AllocationPolicy.Disk",
)

class TaskGroupStatus(proto.Message):
r"""Aggregated task status for a TaskGroup.
Expand Down Expand Up @@ -554,23 +561,38 @@ class Disk(proto.Message):

Attributes:
image (str):
Name of a public or custom image used as the
data source.
Name of a public or custom image used as the data source.
For example, the following are all valid URLs: (1) Specify
the image by its family name:
projects/{project}/global/images/family/{image_family} (2)
Specify the image version:
projects/{project}/global/images/{image_version} You can
also use Batch customized image in short names. The
following image values are supported for a boot disk:
"batch-debian": use Batch Debian images. "batch-centos": use
Batch CentOS images. "batch-cos": use Batch
Container-Optimized images.

This field is a member of `oneof`_ ``data_source``.
snapshot (str):
Name of a snapshot used as the data source.

This field is a member of `oneof`_ ``data_source``.
type_ (str):
Disk type as shown in ``gcloud compute disk-types list`` For
example, "pd-ssd", "pd-standard", "pd-balanced",
"local-ssd".
Disk type as shown in ``gcloud compute disk-types list``.
For example, local SSD uses type "local-ssd". Persistent
disks and boot disks use "pd-balanced", "pd-extreme",
"pd-ssd" or "pd-standard".
size_gb (int):
Disk size in GB. This field is ignored if ``data_source`` is
``disk`` or ``image``. If ``type`` is ``local-ssd``, size_gb
should be a multiple of 375GB, otherwise, the final size
will be the next greater multiple of 375 GB.
Disk size in GB. For persistent disk, this field is ignored
if ``data_source`` is ``image`` or ``snapshot``. For local
SSD, size_gb should be a multiple of 375GB, otherwise, the
final size will be the next greater multiple of 375 GB. For
boot disk, Batch will calculate the boot disk size based on
source image and task requirements if you do not speicify
the size. If both this field and the boot_disk_mib field in
task spec's compute_resource are defined, Batch will only
honor this field.
disk_interface (str):
Local SSDs are available through both "SCSI"
and "NVMe" interfaces. If not indicated, "NVMe"
Expand Down
40 changes: 24 additions & 16 deletions tests/unit/gapic/batch_v1/test_batch_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -2610,15 +2610,16 @@ def test_create_job_rest(request_type):
"install_gpu_drivers": True,
}
],
"boot_disk": {
"image": "image_value",
"snapshot": "snapshot_value",
"type_": "type__value",
"size_gb": 739,
"disk_interface": "disk_interface_value",
},
"disks": [
{
"new_disk": {
"image": "image_value",
"snapshot": "snapshot_value",
"type_": "type__value",
"size_gb": 739,
"disk_interface": "disk_interface_value",
},
"new_disk": {},
"existing_disk": "existing_disk_value",
"device_name": "device_name_value",
}
Expand All @@ -2628,7 +2629,10 @@ def test_create_job_rest(request_type):
"install_gpu_drivers": True,
}
],
"service_account": {"email": "email_value"},
"service_account": {
"email": "email_value",
"scopes": ["scopes_value1", "scopes_value2"],
},
"labels": {},
"network": {
"network_interfaces": [
Expand Down Expand Up @@ -2952,15 +2956,16 @@ def test_create_job_rest_bad_request(
"install_gpu_drivers": True,
}
],
"boot_disk": {
"image": "image_value",
"snapshot": "snapshot_value",
"type_": "type__value",
"size_gb": 739,
"disk_interface": "disk_interface_value",
},
"disks": [
{
"new_disk": {
"image": "image_value",
"snapshot": "snapshot_value",
"type_": "type__value",
"size_gb": 739,
"disk_interface": "disk_interface_value",
},
"new_disk": {},
"existing_disk": "existing_disk_value",
"device_name": "device_name_value",
}
Expand All @@ -2970,7 +2975,10 @@ def test_create_job_rest_bad_request(
"install_gpu_drivers": True,
}
],
"service_account": {"email": "email_value"},
"service_account": {
"email": "email_value",
"scopes": ["scopes_value1", "scopes_value2"],
},
"labels": {},
"network": {
"network_interfaces": [
Expand Down