diff --git a/.coveragerc b/.coveragerc index 2e41c36..e17b1e0 100644 --- a/.coveragerc +++ b/.coveragerc @@ -5,6 +5,7 @@ branch = True show_missing = True omit = google/cloud/batch/__init__.py + google/cloud/batch/gapic_version.py exclude_lines = # Re-enable the standard pragma pragma: NO COVER diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 889f77d..f0f3b24 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,4 +13,4 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:c43f1d918bcf817d337aa29ff833439494a158a0831508fda4ec75dc4c0d0320 + digest: sha256:f946c75373c2b0040e8e318c5e85d0cf46bc6e61d0a01f3ef94d8de974ac6790 diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 02f17d9..76d5538 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.8.1" + ".": "0.9.0" } diff --git a/CHANGELOG.md b/CHANGELOG.md index daba976..750e0b6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # Changelog +## [0.9.0](https://github.com/googleapis/python-batch/compare/v0.8.1...v0.9.0) (2023-02-04) + + +### Features + +* Add boot disk field in InstancePolicy ([3a73b21](https://github.com/googleapis/python-batch/commit/3a73b21726e1780be3782fd3eb98eca28a0759f5)) +* Add boot disk field in InstanceStatus ([3a73b21](https://github.com/googleapis/python-batch/commit/3a73b21726e1780be3782fd3eb98eca28a0759f5)) +* Support custom scopes for service account ([3a73b21](https://github.com/googleapis/python-batch/commit/3a73b21726e1780be3782fd3eb98eca28a0759f5)) + ## [0.8.1](https://github.com/googleapis/python-batch/compare/v0.8.0...v0.8.1) (2023-01-20) diff --git a/google/cloud/batch/gapic_version.py b/google/cloud/batch/gapic_version.py index 48d7dde..8e0b747 100644 --- a/google/cloud/batch/gapic_version.py +++ b/google/cloud/batch/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "0.8.1" # {x-release-please-version} +__version__ = "0.9.0" # {x-release-please-version} diff --git a/google/cloud/batch_v1/__init__.py b/google/cloud/batch_v1/__init__.py index 566e33b..a1263f8 100644 --- a/google/cloud/batch_v1/__init__.py +++ b/google/cloud/batch_v1/__init__.py @@ -13,7 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # -from google.cloud.batch import gapic_version as package_version +from google.cloud.batch_v1 import gapic_version as package_version __version__ = package_version.__version__ diff --git a/google/cloud/batch_v1/gapic_version.py b/google/cloud/batch_v1/gapic_version.py index 48d7dde..8e0b747 100644 --- a/google/cloud/batch_v1/gapic_version.py +++ b/google/cloud/batch_v1/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "0.8.1" # {x-release-please-version} +__version__ = "0.9.0" # {x-release-please-version} diff --git a/google/cloud/batch_v1/types/job.py b/google/cloud/batch_v1/types/job.py index 611a608..3f19e49 100644 --- a/google/cloud/batch_v1/types/job.py +++ b/google/cloud/batch_v1/types/job.py @@ -194,7 +194,7 @@ class State(proto.Enum): Values: STATE_UNSPECIFIED (0): - + No description available. QUEUED (1): Job is admitted (validated and persisted) and waiting for resources. @@ -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( @@ -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. @@ -457,8 +464,17 @@ 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): @@ -466,14 +482,20 @@ class Disk(proto.Message): 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" @@ -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 @@ -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, @@ -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)) diff --git a/google/cloud/batch_v1alpha/__init__.py b/google/cloud/batch_v1alpha/__init__.py index c79fd3e..365bf56 100644 --- a/google/cloud/batch_v1alpha/__init__.py +++ b/google/cloud/batch_v1alpha/__init__.py @@ -13,7 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # -from google.cloud.batch import gapic_version as package_version +from google.cloud.batch_v1alpha import gapic_version as package_version __version__ = package_version.__version__ diff --git a/google/cloud/batch_v1alpha/gapic_version.py b/google/cloud/batch_v1alpha/gapic_version.py index 48d7dde..8e0b747 100644 --- a/google/cloud/batch_v1alpha/gapic_version.py +++ b/google/cloud/batch_v1alpha/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "0.8.1" # {x-release-please-version} +__version__ = "0.9.0" # {x-release-please-version} diff --git a/google/cloud/batch_v1alpha/types/job.py b/google/cloud/batch_v1alpha/types/job.py index 6f6abf0..23de96c 100644 --- a/google/cloud/batch_v1alpha/types/job.py +++ b/google/cloud/batch_v1alpha/types/job.py @@ -275,7 +275,7 @@ class State(proto.Enum): Values: STATE_UNSPECIFIED (0): - + No description available. QUEUED (1): Job is admitted (validated and persisted) and waiting for resources. @@ -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( @@ -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. @@ -554,8 +561,17 @@ 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): @@ -563,14 +579,20 @@ class Disk(proto.Message): 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" diff --git a/noxfile.py b/noxfile.py index e716318..95e58c5 100644 --- a/noxfile.py +++ b/noxfile.py @@ -189,9 +189,9 @@ def unit(session): def install_systemtest_dependencies(session, *constraints): # Use pre-release gRPC for system tests. - # Exclude version 1.49.0rc1 which has a known issue. - # See https://github.com/grpc/grpc/pull/30642 - session.install("--pre", "grpcio!=1.49.0rc1") + # Exclude version 1.52.0rc1 which has a known issue. + # See https://github.com/grpc/grpc/issues/32163 + session.install("--pre", "grpcio!=1.52.0rc1") session.install(*SYSTEM_TEST_STANDARD_DEPENDENCIES, *constraints) @@ -346,9 +346,7 @@ def prerelease_deps(session): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS + SYSTEM_TEST_STANDARD_DEPENDENCIES + SYSTEM_TEST_EXTERNAL_DEPENDENCIES ) session.install(*system_deps_all) @@ -378,8 +376,8 @@ def prerelease_deps(session): # dependency of grpc "six", "googleapis-common-protos", - # Exclude version 1.49.0rc1 which has a known issue. See https://github.com/grpc/grpc/pull/30642 - "grpcio!=1.49.0rc1", + # Exclude version 1.52.0rc1 which has a known issue. See https://github.com/grpc/grpc/issues/32163 + "grpcio!=1.52.0rc1", "grpcio-status", "google-api-core", "proto-plus", diff --git a/samples/generated_samples/snippet_metadata_google.cloud.batch.v1.json b/samples/generated_samples/snippet_metadata_google.cloud.batch.v1.json index 49985ff..0de2313 100644 --- a/samples/generated_samples/snippet_metadata_google.cloud.batch.v1.json +++ b/samples/generated_samples/snippet_metadata_google.cloud.batch.v1.json @@ -8,7 +8,7 @@ ], "language": "PYTHON", "name": "google-cloud-batch", - "version": "0.8.1" + "version": "0.9.0" }, "snippets": [ { diff --git a/samples/generated_samples/snippet_metadata_google.cloud.batch.v1alpha.json b/samples/generated_samples/snippet_metadata_google.cloud.batch.v1alpha.json index 86cf3b8..510be98 100644 --- a/samples/generated_samples/snippet_metadata_google.cloud.batch.v1alpha.json +++ b/samples/generated_samples/snippet_metadata_google.cloud.batch.v1alpha.json @@ -8,7 +8,7 @@ ], "language": "PYTHON", "name": "google-cloud-batch", - "version": "0.8.1" + "version": "0.9.0" }, "snippets": [ { diff --git a/tests/unit/gapic/batch_v1/test_batch_service.py b/tests/unit/gapic/batch_v1/test_batch_service.py index 0bd1bb9..132b176 100644 --- a/tests/unit/gapic/batch_v1/test_batch_service.py +++ b/tests/unit/gapic/batch_v1/test_batch_service.py @@ -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", } @@ -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": [ @@ -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", } @@ -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": [