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
2 changes: 2 additions & 0 deletions google/cloud/batch_v1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
from .types.job import JobNotification
from .types.job import JobStatus
from .types.job import LogsPolicy
from .types.job import ServiceAccount
from .types.job import TaskGroup
from .types.task import ComputeResource
from .types.task import Environment
Expand Down Expand Up @@ -68,6 +69,7 @@
"NFS",
"OperationMetadata",
"Runnable",
"ServiceAccount",
"StatusEvent",
"Task",
"TaskExecution",
Expand Down
2 changes: 2 additions & 0 deletions google/cloud/batch_v1/types/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
JobNotification,
JobStatus,
LogsPolicy,
ServiceAccount,
TaskGroup,
)
from .task import (
Expand Down Expand Up @@ -64,6 +65,7 @@
"JobNotification",
"JobStatus",
"LogsPolicy",
"ServiceAccount",
"TaskGroup",
"ComputeResource",
"Environment",
Expand Down
47 changes: 43 additions & 4 deletions google/cloud/batch_v1/types/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"JobNotification",
"AllocationPolicy",
"TaskGroup",
"ServiceAccount",
},
)

Expand Down Expand Up @@ -336,6 +337,8 @@ class AllocationPolicy(proto.Message):
instances (Sequence[google.cloud.batch_v1.types.AllocationPolicy.InstancePolicyOrTemplate]):
Describe instances that can be created by this
AllocationPolicy. Only instances[0] is supported now.
service_account (google.cloud.batch_v1.types.ServiceAccount):
Service account that VMs will run as.
labels (Mapping[str, str]):
Labels applied to all VM instances and other resources
created by AllocationPolicy. Labels could be user provided
Expand Down Expand Up @@ -460,9 +463,10 @@ class AttachedDisk(proto.Message):

This field is a member of `oneof`_ ``attached``.
device_name (str):
Device name that the guest operating system
will see. If not specified, this is default to
the disk name.
Device name that the guest operating system will see. It is
used by Runnable.volumes field to mount disks. So please
specify the device_name if you want Batch to help mount the
disk, and it should match the device_name field in volumes.
"""

new_disk = proto.Field(
Expand Down Expand Up @@ -492,7 +496,8 @@ class Accelerator(proto.Message):
count (int):
The number of accelerators of this type.
install_gpu_drivers (bool):

Deprecated: please use instances[0].install_gpu_drivers
instead.
"""

type_ = proto.Field(
Expand Down Expand Up @@ -575,6 +580,11 @@ class InstancePolicyOrTemplate(proto.Message):
c++ keyword conflict.

This field is a member of `oneof`_ ``policy_template``.
install_gpu_drivers (bool):
Set this field true if users want Batch to help fetch
drivers from a third party location and install them for
GPUs specified in policy.accelerators or instance_template
on their behalf. Default is false.
"""

policy = proto.Field(
Expand All @@ -588,6 +598,10 @@ class InstancePolicyOrTemplate(proto.Message):
number=2,
oneof="policy_template",
)
install_gpu_drivers = proto.Field(
proto.BOOL,
number=3,
)

class NetworkInterface(proto.Message):
r"""A network interface.
Expand Down Expand Up @@ -647,6 +661,11 @@ class NetworkPolicy(proto.Message):
number=8,
message=InstancePolicyOrTemplate,
)
service_account = proto.Field(
proto.MESSAGE,
number=9,
message="ServiceAccount",
)
labels = proto.MapField(
proto.STRING,
proto.STRING,
Expand Down Expand Up @@ -745,4 +764,24 @@ class TaskGroup(proto.Message):
)


class ServiceAccount(proto.Message):
r"""Carries information about a Google Cloud service account.

Attributes:
email (str):
Email address of the service account. If not
specified, the default Compute Engine service
account for the project will be used. If
instance template is being used, the service
account has to be specified in the instance
template and it has to match the email field
here.
"""

email = proto.Field(
proto.STRING,
number=1,
)


__all__ = tuple(sorted(__protobuf__.manifest))
42 changes: 22 additions & 20 deletions google/cloud/batch_v1alpha/types/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class Job(proto.Message):
Output only. Job status. It is read only for
users.
notification (google.cloud.batch_v1alpha.types.JobNotification):
Job notification.
Deprecated: please use notifications instead.
create_time (google.protobuf.timestamp_pb2.Timestamp):
Output only. When the Job was created.
update_time (google.protobuf.timestamp_pb2.Timestamp):
Expand Down Expand Up @@ -399,26 +399,19 @@ class AllocationPolicy(proto.Message):
Location where compute resources should be
allocated for the Job.
instance (google.cloud.batch_v1alpha.types.AllocationPolicy.InstancePolicy):
Create only instances allowed by this policy.
Deprecated: please use instances[0].policy instead.
instances (Sequence[google.cloud.batch_v1alpha.types.AllocationPolicy.InstancePolicyOrTemplate]):
Describe instances that can be created by this
AllocationPolicy. Only instances[0] is supported now.
instance_templates (Sequence[str]):
Instance templates that are used to VMs. If specified, only
instance_templates[0] is used.
Deprecated: please use instances[0].template instead.
provisioning_models (Sequence[google.cloud.batch_v1alpha.types.AllocationPolicy.ProvisioningModel]):
Create only instances in the listed provisiong models.
Default to allow all.

Currently only the first model of the provisioning_models
list will be considered; specifying additional models (e.g.,
2nd, 3rd, etc.) is a no-op.
Deprecated: please use
instances[i].policy.provisioning_model instead.
service_account_email (str):
Email of the service account that VMs will
run as.
Deprecated: please use service_account instead.
service_account (google.cloud.batch_v1alpha.types.ServiceAccount):
Service account that VMs will run as.
Not yet implemented.
labels (Mapping[str, str]):
Labels applied to all VM instances and other resources
created by AllocationPolicy. Labels could be user provided
Expand Down Expand Up @@ -550,9 +543,10 @@ class AttachedDisk(proto.Message):

This field is a member of `oneof`_ ``attached``.
device_name (str):
Device name that the guest operating system
will see. If not specified, this is default to
the disk name.
Device name that the guest operating system will see. It is
used by Runnable.volumes field to mount disks. So please
specify the device_name if you want Batch to help mount the
disk, and it should match the device_name field in volumes.
"""

new_disk = proto.Field(
Expand Down Expand Up @@ -582,7 +576,8 @@ class Accelerator(proto.Message):
count (int):
The number of accelerators of this type.
install_gpu_drivers (bool):

Deprecated: please use instances[0].install_gpu_drivers
instead.
"""

type_ = proto.Field(
Expand All @@ -604,7 +599,7 @@ class InstancePolicy(proto.Message):

Attributes:
allowed_machine_types (Sequence[str]):

Deprecated: please use machine_type instead.
machine_type (str):
The Compute Engine machine type.
min_cpu_platform (str):
Expand Down Expand Up @@ -672,7 +667,10 @@ class InstancePolicyOrTemplate(proto.Message):

This field is a member of `oneof`_ ``policy_template``.
install_gpu_drivers (bool):

Set this field true if users want Batch to help fetch
drivers from a third party location and install them for
GPUs specified in policy.accelerators or instance_template
on their behalf. Default is false.
"""

policy = proto.Field(
Expand Down Expand Up @@ -912,7 +910,11 @@ class ServiceAccount(proto.Message):
email (str):
Email address of the service account. If not
specified, the default Compute Engine service
account for the project will be used.
account for the project will be used. If
instance template is being used, the service
account has to be specified in the instance
template and it has to match the email field
here.
scopes (Sequence[str]):
List of scopes to be enabled for this service
account on the VM, in addition to the
Expand Down
Loading