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
35 changes: 30 additions & 5 deletions google/cloud/batch_v1/types/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]):
Expand Down Expand Up @@ -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):
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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,
Expand All @@ -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,
Expand Down
8 changes: 2 additions & 6 deletions google/cloud/batch_v1alpha/types/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]):
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
],
"language": "PYTHON",
"name": "google-cloud-batch",
"version": "0.11.0"
"version": "0.1.0"
},
"snippets": [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
],
"language": "PYTHON",
"name": "google-cloud-batch",
"version": "0.11.0"
"version": "0.1.0"
},
"snippets": [
{
Expand Down
2 changes: 2 additions & 0 deletions tests/unit/gapic/batch_v1/test_batch_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down