diff --git a/google/cloud/batch_v1/types/job.py b/google/cloud/batch_v1/types/job.py index a509f7b..08888e8 100644 --- a/google/cloud/batch_v1/types/job.py +++ b/google/cloud/batch_v1/types/job.py @@ -622,7 +622,6 @@ class InstancePolicy(proto.Message): The minimum CPU platform. See https://cloud.google.com/compute/docs/instances/specify-min-cpu-platform. - Not yet implemented. provisioning_model (google.cloud.batch_v1.types.AllocationPolicy.ProvisioningModel): The provisioning model. accelerators (MutableSequence[google.cloud.batch_v1.types.AllocationPolicy.Accelerator]): @@ -841,8 +840,8 @@ class PlacementPolicy(proto.Message): class TaskGroup(proto.Message): - r"""A TaskGroup contains one or multiple Tasks that share the - same Runnable but with different runtime parameters. + r"""A TaskGroup defines one or more Tasks that all share the same + TaskSpec. Attributes: name (str): @@ -860,6 +859,9 @@ class TaskGroup(proto.Message): Max number of tasks that can run in parallel. Default to min(task_count, 1000). Field parallelism must be 1 if the scheduling_policy is IN_ORDER. + scheduling_policy (google.cloud.batch_v1.types.TaskGroup.SchedulingPolicy): + Scheduling policy for Tasks in the TaskGroup. The default + value is AS_SOON_AS_POSSIBLE. task_environments (MutableSequence[google.cloud.batch_v1.types.Environment]): An array of environment variable mappings, which are passed to Tasks with matching indices. If task_environments is used @@ -873,8 +875,6 @@ class TaskGroup(proto.Message): Tasks in the Task's parent TaskGroup, and the specific Task's index in the TaskGroup (0 through BATCH_TASK_COUNT - 1). - - task_environments supports up to 200 entries. task_count_per_node (int): Max number of tasks that can be run on a VM at the same time. If not specified, the system @@ -891,6 +891,26 @@ class TaskGroup(proto.Message): tasks in the same TaskGroup. """ + class SchedulingPolicy(proto.Enum): + r"""How Tasks in the TaskGroup should be scheduled relative to + each other. + + Values: + SCHEDULING_POLICY_UNSPECIFIED (0): + Unspecified. + AS_SOON_AS_POSSIBLE (1): + Run Tasks as soon as resources are available. + + Tasks might be executed in parallel depending on parallelism + and task_count values. + IN_ORDER (2): + Run Tasks sequentially with increased task + index. + """ + SCHEDULING_POLICY_UNSPECIFIED = 0 + AS_SOON_AS_POSSIBLE = 1 + IN_ORDER = 2 + name: str = proto.Field( proto.STRING, number=1, @@ -908,6 +928,11 @@ class TaskGroup(proto.Message): proto.INT64, number=5, ) + scheduling_policy: SchedulingPolicy = proto.Field( + proto.ENUM, + number=6, + enum=SchedulingPolicy, + ) task_environments: MutableSequence[task.Environment] = proto.RepeatedField( proto.MESSAGE, number=9, diff --git a/google/cloud/batch_v1alpha/types/job.py b/google/cloud/batch_v1alpha/types/job.py index ea83fd1..ce1d06c 100644 --- a/google/cloud/batch_v1alpha/types/job.py +++ b/google/cloud/batch_v1alpha/types/job.py @@ -743,7 +743,6 @@ class InstancePolicy(proto.Message): The minimum CPU platform. See https://cloud.google.com/compute/docs/instances/specify-min-cpu-platform. - Not yet implemented. provisioning_model (google.cloud.batch_v1alpha.types.AllocationPolicy.ProvisioningModel): The provisioning model. accelerators (MutableSequence[google.cloud.batch_v1alpha.types.AllocationPolicy.Accelerator]): @@ -993,8 +992,8 @@ class PlacementPolicy(proto.Message): class TaskGroup(proto.Message): - r"""A TaskGroup contains one or multiple Tasks that share the - same Runnable but with different runtime parameters. + r"""A TaskGroup defines one or more Tasks that all share the same + TaskSpec. Attributes: name (str): @@ -1039,8 +1038,6 @@ class TaskGroup(proto.Message): Tasks in the Task's parent TaskGroup, and the specific Task's index in the TaskGroup (0 through BATCH_TASK_COUNT - 1). - - task_environments supports up to 200 entries. task_count_per_node (int): Max number of tasks that can be run on a VM at the same time. If not specified, the system @@ -1072,7 +1069,6 @@ class SchedulingPolicy(proto.Enum): IN_ORDER (2): Run Tasks sequentially with increased task index. - Not yet implemented. """ SCHEDULING_POLICY_UNSPECIFIED = 0 AS_SOON_AS_POSSIBLE = 1 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 1c3fed7..e2df106 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.11.0" + "version": "0.1.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 d9dd8c3..4862cc9 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.11.0" + "version": "0.1.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 4f7842f..e4f31a4 100644 --- a/tests/unit/gapic/batch_v1/test_batch_service.py +++ b/tests/unit/gapic/batch_v1/test_batch_service.py @@ -2582,6 +2582,7 @@ def test_create_job_rest(request_type): }, "task_count": 1083, "parallelism": 1174, + "scheduling_policy": 1, "task_environments": {}, "task_count_per_node": 2022, "require_hosts_file": True, @@ -2931,6 +2932,7 @@ def test_create_job_rest_bad_request( }, "task_count": 1083, "parallelism": 1174, + "scheduling_policy": 1, "task_environments": {}, "task_count_per_node": 2022, "require_hosts_file": True,