Skip to content

Commit 37e457c

Browse files
feat: Add more compute resource API descriptions to match with VM's machine type field (googleapis#11588)
Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: ohmayr <omairnaveed@ymail.com>
1 parent 541d296 commit 37e457c

7 files changed

Lines changed: 58 additions & 8 deletions

File tree

‎packages/google-cloud-batch/google/cloud/batch/gapic_version.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
__version__ = "0.16.0" # {x-release-please-version}
16+
__version__ = "0.0.0" # {x-release-please-version}

‎packages/google-cloud-batch/google/cloud/batch_v1/gapic_version.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
__version__ = "0.16.0" # {x-release-please-version}
16+
__version__ = "0.0.0" # {x-release-please-version}

‎packages/google-cloud-batch/google/cloud/batch_v1alpha/gapic_version.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
__version__ = "0.16.0" # {x-release-please-version}
16+
__version__ = "0.0.0" # {x-release-please-version}

‎packages/google-cloud-batch/google/cloud/batch_v1alpha/types/job.py‎

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -784,7 +784,10 @@ class InstancePolicy(proto.Message):
784784
disks (MutableSequence[google.cloud.batch_v1alpha.types.AllocationPolicy.AttachedDisk]):
785785
Non-boot disks to be attached for each VM
786786
created by this InstancePolicy. New disks will
787-
be deleted when the VM is deleted.
787+
be deleted when the VM is deleted. A non
788+
bootable disk is a disk that can be of a device
789+
with a file system or a raw storage drive that
790+
is not ready for data storage and accessing.
788791
reservation (str):
789792
If specified, VMs will consume only the
790793
specified reservation. If not specified
@@ -832,7 +835,11 @@ class InstancePolicy(proto.Message):
832835
)
833836

834837
class InstancePolicyOrTemplate(proto.Message):
835-
r"""Either an InstancePolicy or an instance template.
838+
r"""InstancePolicyOrTemplate lets you define the type of
839+
resources to use for this job either with an InstancePolicy or
840+
an instance template. If undefined, Batch picks the type of VM
841+
to use and doesn't include optional VM resources such as GPUs
842+
and extra disks.
836843
837844
This message has `oneof`_ fields (mutually exclusive fields).
838845
For each oneof, at most one member field can be set at the same time.

‎packages/google-cloud-batch/google/cloud/batch_v1alpha/types/task.py‎

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,56 @@
4141

4242

4343
class ComputeResource(proto.Message):
44-
r"""Compute resource requirements
44+
r"""Compute resource requirements.
45+
46+
ComputeResource defines the amount of resources required for each
47+
task. Make sure your tasks have enough resources to successfully
48+
run. If you also define the types of resources for a job to use with
49+
the
50+
`InstancePolicyOrTemplate <https://cloud.google.com/batch/docs/reference/rest/v1/projects.locations.jobs#instancepolicyortemplate>`__
51+
field, make sure both fields are compatible with each other.
4552
4653
Attributes:
4754
cpu_milli (int):
4855
The milliCPU count.
56+
57+
``cpuMilli`` defines the amount of CPU resources per task in
58+
milliCPU units. For example, ``1000`` corresponds to 1 vCPU
59+
per task. If undefined, the default value is ``2000``.
60+
61+
If you also define the VM's machine type using the
62+
``machineType`` in
63+
`InstancePolicy <https://cloud.google.com/batch/docs/reference/rest/v1/projects.locations.jobs#instancepolicy>`__
64+
field or inside the ``instanceTemplate`` in the
65+
`InstancePolicyOrTemplate <https://cloud.google.com/batch/docs/reference/rest/v1/projects.locations.jobs#instancepolicyortemplate>`__
66+
field, make sure the CPU resources for both fields are
67+
compatible with each other and with how many tasks you want
68+
to allow to run on the same VM at the same time.
69+
70+
For example, if you specify the ``n2-standard-2`` machine
71+
type, which has 2 vCPUs each, you are recommended to set
72+
``cpuMilli`` no more than ``2000``, or you are recommended
73+
to run two tasks on the same VM if you set ``cpuMilli`` to
74+
``1000`` or less.
4975
memory_mib (int):
5076
Memory in MiB.
77+
78+
``memoryMib`` defines the amount of memory per task in MiB
79+
units. If undefined, the default value is ``2000``. If you
80+
also define the VM's machine type using the ``machineType``
81+
in
82+
`InstancePolicy <https://cloud.google.com/batch/docs/reference/rest/v1/projects.locations.jobs#instancepolicy>`__
83+
field or inside the ``instanceTemplate`` in the
84+
`InstancePolicyOrTemplate <https://cloud.google.com/batch/docs/reference/rest/v1/projects.locations.jobs#instancepolicyortemplate>`__
85+
field, make sure the memory resources for both fields are
86+
compatible with each other and with how many tasks you want
87+
to allow to run on the same VM at the same time.
88+
89+
For example, if you specify the ``n2-standard-2`` machine
90+
type, which has 8 GiB each, you are recommended to set
91+
``memoryMib`` to no more than ``8192``, or you are
92+
recommended to run two tasks on the same VM if you set
93+
``memoryMib`` to ``4096`` or less.
5194
gpu_count (int):
5295
The GPU count.
5396
Not yet implemented.

‎packages/google-cloud-batch/samples/generated_samples/snippet_metadata_google.cloud.batch.v1.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
],
99
"language": "PYTHON",
1010
"name": "google-cloud-batch",
11-
"version": "0.16.0"
11+
"version": "0.1.0"
1212
},
1313
"snippets": [
1414
{

‎packages/google-cloud-batch/samples/generated_samples/snippet_metadata_google.cloud.batch.v1alpha.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
],
99
"language": "PYTHON",
1010
"name": "google-cloud-batch",
11-
"version": "0.16.0"
11+
"version": "0.1.0"
1212
},
1313
"snippets": [
1414
{

0 commit comments

Comments
 (0)