Skip to content

Commit d4d75c6

Browse files
feat(v1): [batch] Add support for scheduling_policy (#4340)
- [ ] Regenerate this pull request now. docs(v1): Minor clarifications for TaskGroup and min_cpu_platform PiperOrigin-RevId: 540265821 Source-Link: https://togithub.com/googleapis/googleapis/commit/71856b9fcb496e11bdbbe52d3d8030c7334519e1 Source-Link: https://togithub.com/googleapis/googleapis-gen/commit/f194a119b94d3b1b96043e74ea6fef7eb42eb798 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWJhdGNoLy5Pd2xCb3QueWFtbCIsImgiOiJmMTk0YTExOWI5NGQzYjFiOTYwNDNlNzRlYTZmZWY3ZWI0MmViNzk4In0= BEGIN_NESTED_COMMIT feat: [batch] implement minCpuPlatform --- feat: Enable scheduling_policy in v1 --- feat: update TaskGroup doc PiperOrigin-RevId: 540043151 Source-Link: https://togithub.com/googleapis/googleapis/commit/50a39ef600abf842ce8a749894f674b301253091 Source-Link: https://togithub.com/googleapis/googleapis-gen/commit/5bdc561934be9a4ad3244358288bae8ea65b8bd1 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWJhdGNoLy5Pd2xCb3QueWFtbCIsImgiOiI1YmRjNTYxOTM0YmU5YTRhZDMyNDQzNTgyODhiYWU4ZWE2NWI4YmQxIn0= END_NESTED_COMMIT
1 parent e421764 commit d4d75c6

5 files changed

Lines changed: 113 additions & 12 deletions

File tree

packages/google-cloud-batch/protos/google/cloud/batch/v1/job.proto

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,6 @@ message AllocationPolicy {
332332
// The minimum CPU platform.
333333
// See
334334
// https://cloud.google.com/compute/docs/instances/specify-min-cpu-platform.
335-
// Not yet implemented.
336335
string min_cpu_platform = 3;
337336

338337
// The provisioning model.
@@ -471,14 +470,28 @@ message AllocationPolicy {
471470
PlacementPolicy placement = 10;
472471
}
473472

474-
// A TaskGroup contains one or multiple Tasks that share the same
475-
// Runnable but with different runtime parameters.
473+
// A TaskGroup defines one or more Tasks that all share the same TaskSpec.
476474
message TaskGroup {
477475
option (google.api.resource) = {
478476
type: "batch.googleapis.com/TaskGroup"
479477
pattern: "projects/{project}/locations/{location}/jobs/{job}/taskGroups/{task_group}"
480478
};
481479

480+
// How Tasks in the TaskGroup should be scheduled relative to each other.
481+
enum SchedulingPolicy {
482+
// Unspecified.
483+
SCHEDULING_POLICY_UNSPECIFIED = 0;
484+
485+
// Run Tasks as soon as resources are available.
486+
//
487+
// Tasks might be executed in parallel depending on parallelism and
488+
// task_count values.
489+
AS_SOON_AS_POSSIBLE = 1;
490+
491+
// Run Tasks sequentially with increased task index.
492+
IN_ORDER = 2;
493+
}
494+
482495
// Output only. TaskGroup name.
483496
// The system generates this field based on parent Job name.
484497
// For example:
@@ -497,6 +510,10 @@ message TaskGroup {
497510
// Field parallelism must be 1 if the scheduling_policy is IN_ORDER.
498511
int64 parallelism = 5;
499512

513+
// Scheduling policy for Tasks in the TaskGroup.
514+
// The default value is AS_SOON_AS_POSSIBLE.
515+
SchedulingPolicy scheduling_policy = 6;
516+
500517
// An array of environment variable mappings, which are passed to Tasks with
501518
// matching indices. If task_environments is used then task_count should
502519
// not be specified in the request (and will be ignored). Task count will be
@@ -506,8 +523,6 @@ message TaskGroup {
506523
// addition to any environment variables set in task_environments, specifying
507524
// the number of Tasks in the Task's parent TaskGroup, and the specific Task's
508525
// index in the TaskGroup (0 through BATCH_TASK_COUNT - 1).
509-
//
510-
// task_environments supports up to 200 entries.
511526
repeated Environment task_environments = 9;
512527

513528
// Max number of tasks that can be run on a VM at the same time.

packages/google-cloud-batch/protos/google/cloud/batch/v1alpha/job.proto

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,6 @@ message AllocationPolicy {
399399
// The minimum CPU platform.
400400
// See
401401
// https://cloud.google.com/compute/docs/instances/specify-min-cpu-platform.
402-
// Not yet implemented.
403402
string min_cpu_platform = 3;
404403

405404
// The provisioning model.
@@ -554,8 +553,7 @@ message AllocationPolicy {
554553
PlacementPolicy placement = 10;
555554
}
556555

557-
// A TaskGroup contains one or multiple Tasks that share the same
558-
// Runnable but with different runtime parameters.
556+
// A TaskGroup defines one or more Tasks that all share the same TaskSpec.
559557
message TaskGroup {
560558
option (google.api.resource) = {
561559
type: "batch.googleapis.com/TaskGroup"
@@ -574,8 +572,6 @@ message TaskGroup {
574572
AS_SOON_AS_POSSIBLE = 1;
575573

576574
// Run Tasks sequentially with increased task index.
577-
//
578-
// Not yet implemented.
579575
IN_ORDER = 2;
580576
}
581577

@@ -622,8 +618,6 @@ message TaskGroup {
622618
// addition to any environment variables set in task_environments, specifying
623619
// the number of Tasks in the Task's parent TaskGroup, and the specific Task's
624620
// index in the TaskGroup (0 through BATCH_TASK_COUNT - 1).
625-
//
626-
// task_environments supports up to 200 entries.
627621
repeated Environment task_environments = 9;
628622

629623
// Max number of tasks that can be run on a VM at the same time.

packages/google-cloud-batch/protos/protos.d.ts

Lines changed: 16 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/google-cloud-batch/protos/protos.js

Lines changed: 63 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/google-cloud-batch/protos/protos.json

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)