-
Notifications
You must be signed in to change notification settings - Fork 22
/
data.proto
878 lines (718 loc) · 29.9 KB
/
data.proto
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
// Copyright 2022 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package google.events.cloud.batch.v1;
import "google/protobuf/duration.proto";
import "google/protobuf/timestamp.proto";
option csharp_namespace = "Google.Events.Protobuf.Cloud.Batch.V1";
option php_namespace = "Google\\Events\\Cloud\\Batch\\V1";
option ruby_package = "Google::Events::Cloud::Batch::V1";
// Volume describes a volume and parameters for it to be mounted to a VM.
message Volume {
// The source for the volume.
oneof source {
// A Network File System (NFS) volume. For example, a
// Filestore file share.
NFS nfs = 1;
// A Google Cloud Storage (GCS) volume.
GCS gcs = 3;
// Device name of an attached disk volume, which should align with a
// device_name specified by
// job.allocation_policy.instances[0].policy.disks[i].device_name or
// defined by the given instance template in
// job.allocation_policy.instances[0].instance_template.
string device_name = 6;
}
// The mount path for the volume, e.g. /mnt/disks/share.
string mount_path = 4;
// For Google Cloud Storage (GCS), mount options are the options supported by
// the gcsfuse tool (https://github.com/GoogleCloudPlatform/gcsfuse).
// For existing persistent disks, mount options provided by the
// mount command (https://man7.org/linux/man-pages/man8/mount.8.html) except
// writing are supported. This is due to restrictions of multi-writer mode
// (https://cloud.google.com/compute/docs/disks/sharing-disks-between-vms).
// For other attached disks and Network File System (NFS), mount options are
// these supported by the mount command
// (https://man7.org/linux/man-pages/man8/mount.8.html).
repeated string mount_options = 5;
}
// Represents an NFS volume.
message NFS {
// The IP address of the NFS.
string server = 1;
// Remote source path exported from the NFS, e.g., "/share".
string remote_path = 2;
}
// Represents a Google Cloud Storage volume.
message GCS {
// Remote path, either a bucket name or a subdirectory of a bucket, e.g.:
// bucket_name, bucket_name/subdirectory/
string remote_path = 1;
}
// Compute resource requirements
message ComputeResource {
// The milliCPU count.
int64 cpu_milli = 1;
// Memory in MiB.
int64 memory_mib = 2;
// Extra boot disk size in MiB for each task.
int64 boot_disk_mib = 4;
}
// Status event
message StatusEvent {
// Type of the event.
string type = 3;
// Description of the event.
string description = 1;
// The time this event occurred.
google.protobuf.Timestamp event_time = 2;
// Task Execution
TaskExecution task_execution = 4;
// Task State
TaskStatus.State task_state = 5;
}
// This Task Execution field includes detail information for
// task execution procedures, based on StatusEvent types.
message TaskExecution {
// When task is completed as the status of FAILED or SUCCEEDED,
// exit code is for one task execution result, default is 0 as success.
int32 exit_code = 1;
}
// Status of a task
message TaskStatus {
// Task states.
enum State {
// Unknown state.
STATE_UNSPECIFIED = 0;
// The Task is created and waiting for resources.
PENDING = 1;
// The Task is assigned to at least one VM.
ASSIGNED = 2;
// The Task is running.
RUNNING = 3;
// The Task has failed.
FAILED = 4;
// The Task has succeeded.
SUCCEEDED = 5;
// The Task has not been executed when the Job finishes.
UNEXECUTED = 6;
}
}
// Runnable describes instructions for executing a specific script or container
// as part of a Task.
message Runnable {
// Container runnable.
message Container {
// The URI to pull the container image from.
string image_uri = 1;
// Overrides the `CMD` specified in the container. If there is an ENTRYPOINT
// (either in the container image or with the entrypoint field below) then
// commands are appended as arguments to the ENTRYPOINT.
repeated string commands = 2;
// Overrides the `ENTRYPOINT` specified in the container.
string entrypoint = 3;
// Volumes to mount (bind mount) from the host machine files or directories
// into the container, formatted to match docker run's --volume option,
// e.g. /foo:/bar, or /foo:/bar:ro
repeated string volumes = 7;
// Arbitrary additional options to include in the "docker run" command when
// running this container, e.g. "--network host".
string options = 8;
// If set to true, external network access to and from container will be
// blocked, containers that are with block_external_network as true can
// still communicate with each other, network cannot be specified in the
// `container.options` field.
bool block_external_network = 9;
// Optional username for logging in to a docker registry. If username
// matches `projects/*/secrets/*/versions/*` then Batch will read the
// username from the Secret Manager.
string username = 10;
// Optional password for logging in to a docker registry. If password
// matches `projects/*/secrets/*/versions/*` then Batch will read the
// password from the Secret Manager;
string password = 11;
}
// Script runnable.
message Script {
oneof command {
// Script file path on the host VM.
//
// To specify an interpreter, please add a `#!<interpreter>`(also known as
// [shebang line](https://en.wikipedia.org/wiki/Shebang_(Unix))) as the
// first line of the file.(For example, to execute the script using bash,
// `#!/bin/bash` should be the first line of the file. To execute the
// script using`Python3`, `#!/usr/bin/env python3` should be the first
// line of the file.) Otherwise, the file will by default be excuted by
// `/bin/sh`.
string path = 1;
// Shell script text.
//
// To specify an interpreter, please add a `#!<interpreter>\n` at the
// beginning of the text.(For example, to execute the script using bash,
// `#!/bin/bash\n` should be added. To execute the script using`Python3`,
// `#!/usr/bin/env python3\n` should be added.) Otherwise, the script will
// by default be excuted by `/bin/sh`.
string text = 2;
}
}
// Barrier runnable blocks until all tasks in a taskgroup reach it.
message Barrier {
// Barriers are identified by their index in runnable list.
// Names are not required, but if present should be an identifier.
string name = 1;
}
// The script or container to run.
oneof executable {
// Container runnable.
Container container = 1;
// Script runnable.
Script script = 2;
// Barrier runnable.
Barrier barrier = 6;
}
// Normally, a non-zero exit status causes the Task to fail. This flag allows
// execution of other Runnables to continue instead.
bool ignore_exit_status = 3;
// This flag allows a Runnable to continue running in the background while the
// Task executes subsequent Runnables. This is useful to provide services to
// other Runnables (or to provide debugging support tools like SSH servers).
bool background = 4;
// By default, after a Runnable fails, no further Runnable are executed. This
// flag indicates that this Runnable must be run even if the Task has already
// failed. This is useful for Runnables that copy output files off of the VM
// or for debugging.
//
// The always_run flag does not override the Task's overall max_run_duration.
// If the max_run_duration has expired then no further Runnables will execute,
// not even always_run Runnables.
bool always_run = 5;
// Environment variables for this Runnable (overrides variables set for the
// whole Task or TaskGroup).
Environment environment = 7;
// Timeout for this Runnable.
google.protobuf.Duration timeout = 8;
// Labels for this Runnable.
map<string, string> labels = 9;
}
// Spec of a task
message TaskSpec {
// The sequence of scripts or containers to run for this Task. Each Task using
// this TaskSpec executes its list of runnables in order. The Task succeeds if
// all of its runnables either exit with a zero status or any that exit with a
// non-zero status have the ignore_exit_status flag.
//
// Background runnables are killed automatically (if they have not already
// exited) a short time after all foreground runnables have completed. Even
// though this is likely to result in a non-zero exit status for the
// background runnable, these automatic kills are not treated as Task
// failures.
repeated Runnable runnables = 8;
// ComputeResource requirements.
ComputeResource compute_resource = 3;
// Maximum duration the task should run.
// The task will be killed and marked as FAILED if over this limit.
google.protobuf.Duration max_run_duration = 4;
// Maximum number of retries on failures.
// The default, 0, which means never retry.
// The valid value range is [0, 10].
int32 max_retry_count = 5;
// Lifecycle management schema when any task in a task group is failed.
// Currently we only support one lifecycle policy.
// When the lifecycle policy condition is met,
// the action in the policy will execute.
// If task execution result does not meet with the defined lifecycle
// policy, we consider it as the default policy.
// Default policy means if the exit code is 0, exit task.
// If task ends with non-zero exit code, retry the task with max_retry_count.
repeated LifecyclePolicy lifecycle_policies = 9;
// Deprecated: please use environment(non-plural) instead.
map<string, string> environments = 6;
// Volumes to mount before running Tasks using this TaskSpec.
repeated Volume volumes = 7;
// Environment variables to set before running the Task.
Environment environment = 10;
}
// LifecyclePolicy describes how to deal with task failures
// based on different conditions.
message LifecyclePolicy {
// Conditions for actions to deal with task failures.
message ActionCondition {
// Exit codes of a task execution.
// If there are more than 1 exit codes,
// when task executes with any of the exit code in the list,
// the condition is met and the action will be executed.
repeated int32 exit_codes = 1;
}
// Action on task failures based on different conditions.
enum Action {
// Action unspecified.
ACTION_UNSPECIFIED = 0;
// Action that tasks in the group will be scheduled to re-execute.
RETRY_TASK = 1;
// Action that tasks in the group will be stopped immediately.
FAIL_TASK = 2;
}
// Action to execute when ActionCondition is true.
// When RETRY_TASK is specified, we will retry failed tasks
// if we notice any exit code match and fail tasks if no match is found.
// Likewise, when FAIL_TASK is specified, we will fail tasks
// if we notice any exit code match and retry tasks if no match is found.
Action action = 1;
// Conditions that decide why a task failure is dealt with a specific action.
ActionCondition action_condition = 2;
}
// An Environment describes a collection of environment variables to set when
// executing Tasks.
message Environment {
message KMSEnvMap {
// The name of the KMS key that will be used to decrypt the cipher text.
string key_name = 1;
// The value of the cipherText response from the `encrypt` method.
string cipher_text = 2;
}
// A map of environment variable names to values.
map<string, string> variables = 1;
// A map of environment variable names to Secret Manager secret names.
// The VM will access the named secrets to set the value of each environment
// variable.
map<string, string> secret_variables = 2;
// An encrypted JSON dictionary where the key/value pairs correspond to
// environment variable names and their values.
KMSEnvMap encrypted_variables = 3;
}
// The Cloud Batch Job description.
message Job {
// Output only. Job name.
// For example: "projects/123456/locations/us-central1/jobs/job01".
string name = 1;
// Output only. A system generated unique ID (in UUID4 format) for the Job.
string uid = 2;
// Priority of the Job.
// The valid value range is [0, 100). Default value is 0.
// Higher value indicates higher priority.
// A job with higher priority value is more likely to run earlier if all other
// requirements are satisfied.
int64 priority = 3;
// Required. TaskGroups in the Job. Only one TaskGroup is supported now.
repeated TaskGroup task_groups = 4;
// Compute resource allocation for all TaskGroups in the Job.
AllocationPolicy allocation_policy = 7;
// Labels for the Job. Labels could be user provided or system generated.
// For example,
// "labels": {
// "department": "finance",
// "environment": "test"
// }
// You can assign up to 64 labels. [Google Compute Engine label
// restrictions](https://cloud.google.com/compute/docs/labeling-resources#restrictions)
// apply.
// Label names that start with "goog-" or "google-" are reserved.
map<string, string> labels = 8;
// Output only. Job status. It is read only for users.
JobStatus status = 9;
// Output only. When the Job was created.
google.protobuf.Timestamp create_time = 11;
// Output only. The last time the Job was updated.
google.protobuf.Timestamp update_time = 12;
// Log preservation policy for the Job.
LogsPolicy logs_policy = 13;
// Notification configurations.
repeated JobNotification notifications = 14;
}
// LogsPolicy describes how outputs from a Job's Tasks (stdout/stderr) will be
// preserved.
message LogsPolicy {
// The destination (if any) for logs.
enum Destination {
// Logs are not preserved.
DESTINATION_UNSPECIFIED = 0;
// Logs are streamed to Cloud Logging.
CLOUD_LOGGING = 1;
// Logs are saved to a file path.
PATH = 2;
}
// Where logs should be saved.
Destination destination = 1;
// The path to which logs are saved when the destination = PATH. This can be a
// local file path on the VM, or under the mount point of a Persistent Disk or
// Filestore, or a Cloud Storage path.
string logs_path = 2;
}
// Job status.
message JobStatus {
// VM instance status.
message InstanceStatus {
// The Compute Engine machine type.
string machine_type = 1;
// The VM instance provisioning model.
AllocationPolicy.ProvisioningModel provisioning_model = 2;
// The max number of tasks can be assigned to this instance type.
int64 task_pack = 3;
// The VM boot disk.
AllocationPolicy.Disk boot_disk = 4;
}
// Aggregated task status for a TaskGroup.
message TaskGroupStatus {
// Count of task in each state in the TaskGroup.
// The map key is task state name.
map<string, int64> counts = 1;
// Status of instances allocated for the TaskGroup.
repeated InstanceStatus instances = 2;
}
// Valid Job states.
enum State {
// Job state unspecified.
STATE_UNSPECIFIED = 0;
// Job is admitted (validated and persisted) and waiting for resources.
QUEUED = 1;
// Job is scheduled to run as soon as resource allocation is ready.
// The resource allocation may happen at a later time but with a high
// chance to succeed.
SCHEDULED = 2;
// Resource allocation has been successful. At least one Task in the Job is
// RUNNING.
RUNNING = 3;
// All Tasks in the Job have finished successfully.
SUCCEEDED = 4;
// At least one Task in the Job has failed.
FAILED = 5;
// The Job will be deleted, but has not been deleted yet. Typically this is
// because resources used by the Job are still being cleaned up.
DELETION_IN_PROGRESS = 6;
}
// Job state
State state = 1;
// Job status events
repeated StatusEvent status_events = 2;
// Aggregated task status for each TaskGroup in the Job.
// The map key is TaskGroup ID.
map<string, TaskGroupStatus> task_groups = 4;
// The duration of time that the Job spent in status RUNNING.
google.protobuf.Duration run_duration = 5;
}
// Notification configurations.
message JobNotification {
// Message details.
// Describe the attribute that a message should have.
// Without specified message attributes, no message will be sent by default.
message Message {
// The message type.
Type type = 1;
// The new job state.
JobStatus.State new_job_state = 2;
// The new task state.
TaskStatus.State new_task_state = 3;
}
// The message type.
enum Type {
// Unspecified.
TYPE_UNSPECIFIED = 0;
// Notify users that the job state has changed.
JOB_STATE_CHANGED = 1;
// Notify users that the task state has changed.
TASK_STATE_CHANGED = 2;
}
// The Pub/Sub topic where notifications like the job state changes
// will be published. This topic exist in the same project as the job
// and billings will be charged to this project.
// If not specified, no Pub/Sub messages will be sent.
// Topic format: `projects/{project}/topics/{topic}`.
string pubsub_topic = 1;
// The attribute requirements of messages to be sent to this Pub/Sub topic.
// Without this field, no message will be sent.
Message message = 2;
}
// A Job's resource allocation policy describes when, where, and how compute
// resources should be allocated for the Job.
message AllocationPolicy {
message LocationPolicy {
// A list of allowed location names represented by internal URLs.
//
// Each location can be a region or a zone.
// Only one region or multiple zones in one region is supported now.
// For example,
// ["regions/us-central1"] allow VMs in any zones in region us-central1.
// ["zones/us-central1-a", "zones/us-central1-c"] only allow VMs
// in zones us-central1-a and us-central1-c.
//
// All locations end up in different regions would cause errors.
// For example,
// ["regions/us-central1", "zones/us-central1-a", "zones/us-central1-b",
// "zones/us-west1-a"] contains 2 regions "us-central1" and
// "us-west1". An error is expected in this case.
repeated string allowed_locations = 1;
}
// A new persistent disk or a local ssd.
// A VM can only have one local SSD setting but multiple local SSD partitions.
// See https://cloud.google.com/compute/docs/disks#pdspecs and
// https://cloud.google.com/compute/docs/disks#localssds.
message Disk {
// A data source from which a PD will be created.
oneof data_source {
// Name of a public or custom image used as the data source.
// For example, the following are all valid URLs:
//
// * Specify the image by its family name:
// projects/{project}/global/images/family/{image_family}
// * Specify the image version:
// projects/{project}/global/images/{image_version}
//
// You can also use Batch customized image in short names.
// The following image values are supported for a boot disk:
//
// * "batch-debian": use Batch Debian images.
// * "batch-centos": use Batch CentOS images.
// * "batch-cos": use Batch Container-Optimized images.
// * "batch-hpc-centos": use Batch HPC CentOS images.
string image = 4;
// Name of a snapshot used as the data source.
// Snapshot is not supported as boot disk now.
string snapshot = 5;
}
// Disk type as shown in `gcloud compute disk-types list`.
// For example, local SSD uses type "local-ssd".
// Persistent disks and boot disks use "pd-balanced", "pd-extreme", "pd-ssd"
// or "pd-standard".
string type = 1;
// Disk size in GB.
//
// For persistent disk, this field is ignored if `data_source` is `image` or
// `snapshot`.
// For local SSD, size_gb should be a multiple of 375GB,
// otherwise, the final size will be the next greater multiple of 375 GB.
// For boot disk, Batch will calculate the boot disk size based on source
// image and task requirements if you do not speicify the size.
// If both this field and the boot_disk_mib field in task spec's
// compute_resource are defined, Batch will only honor this field.
int64 size_gb = 2;
// Local SSDs are available through both "SCSI" and "NVMe" interfaces.
// If not indicated, "NVMe" will be the default one for local ssds.
// We only support "SCSI" for persistent disks now.
string disk_interface = 6;
}
// A new or an existing persistent disk (PD) or a local ssd attached to a VM
// instance.
message AttachedDisk {
oneof attached {
Disk new_disk = 1;
// Name of an existing PD.
string existing_disk = 2;
}
// 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.
string device_name = 3;
}
// Accelerator describes Compute Engine accelerators to be attached to the VM.
message Accelerator {
// The accelerator type. For example, "nvidia-tesla-t4".
// See `gcloud compute accelerator-types list`.
string type = 1;
// The number of accelerators of this type.
int64 count = 2;
// Deprecated: please use instances[0].install_gpu_drivers instead.
bool install_gpu_drivers = 3;
}
// InstancePolicy describes an instance type and resources attached to each VM
// created by this InstancePolicy.
message InstancePolicy {
// The Compute Engine machine type.
string machine_type = 2;
// The minimum CPU platform.
// See
// https://cloud.google.com/compute/docs/instances/specify-min-cpu-platform.
string min_cpu_platform = 3;
// The provisioning model.
ProvisioningModel provisioning_model = 4;
// The accelerators attached to each VM instance.
repeated Accelerator accelerators = 5;
// Boot disk to be created and attached to each VM by this InstancePolicy.
// Boot disk will be deleted when the VM is deleted.
// Batch API now only supports booting from image.
Disk boot_disk = 8;
// Non-boot disks to be attached for each VM created by this InstancePolicy.
// New disks will be deleted when the VM is deleted.
repeated AttachedDisk disks = 6;
}
// Either an InstancePolicy or an instance template.
message InstancePolicyOrTemplate {
oneof policy_template {
// InstancePolicy.
InstancePolicy policy = 1;
// Name of an instance template used to create VMs.
// Named the field as 'instance_template' instead of 'template' to avoid
// c++ keyword conflict.
string instance_template = 2;
}
// 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.
bool install_gpu_drivers = 3;
}
// A network interface.
message NetworkInterface {
// The URL of an existing network resource.
// You can specify the network as a full or partial URL.
//
// For example, the following are all valid URLs:
//
// * https://www.googleapis.com/compute/v1/projects/{project}/global/networks/{network}
// * projects/{project}/global/networks/{network}
// * global/networks/{network}
string network = 1;
// The URL of an existing subnetwork resource in the network.
// You can specify the subnetwork as a full or partial URL.
//
// For example, the following are all valid URLs:
//
// * https://www.googleapis.com/compute/v1/projects/{project}/regions/{region}/subnetworks/{subnetwork}
// * projects/{project}/regions/{region}/subnetworks/{subnetwork}
// * regions/{region}/subnetworks/{subnetwork}
string subnetwork = 2;
// Default is false (with an external IP address). Required if
// no external public IP address is attached to the VM. If no external
// public IP address, additional configuration is required to allow the VM
// to access Google Services. See
// https://cloud.google.com/vpc/docs/configure-private-google-access and
// https://cloud.google.com/nat/docs/gce-example#create-nat for more
// information.
bool no_external_ip_address = 3;
}
// NetworkPolicy describes VM instance network configurations.
message NetworkPolicy {
// Network configurations.
repeated NetworkInterface network_interfaces = 1;
}
// PlacementPolicy describes a group placement policy for the VMs controlled
// by this AllocationPolicy.
message PlacementPolicy {
// UNSPECIFIED vs. COLLOCATED (default UNSPECIFIED). Use COLLOCATED when you
// want VMs to be located close to each other for low network latency
// between the VMs. No placement policy will be generated when collocation
// is UNSPECIFIED.
string collocation = 1;
// When specified, causes the job to fail if more than max_distance logical
// switches are required between VMs. Batch uses the most compact possible
// placement of VMs even when max_distance is not specified. An explicit
// max_distance makes that level of compactness a strict requirement.
// Not yet implemented
int64 max_distance = 2;
}
// Compute Engine VM instance provisioning model.
enum ProvisioningModel {
// Unspecified.
PROVISIONING_MODEL_UNSPECIFIED = 0;
// Standard VM.
STANDARD = 1;
// SPOT VM.
SPOT = 2;
// Preemptible VM (PVM).
//
// Above SPOT VM is the preferable model for preemptible VM instances: the
// old preemptible VM model (indicated by this field) is the older model,
// and has been migrated to use the SPOT model as the underlying technology.
// This old model will still be supported.
PREEMPTIBLE = 3;
}
// Location where compute resources should be allocated for the Job.
LocationPolicy location = 1;
// Describe instances that can be created by this AllocationPolicy.
// Only instances[0] is supported now.
repeated InstancePolicyOrTemplate instances = 8;
// Service account that VMs will run as.
ServiceAccount service_account = 9;
// Labels applied to all VM instances and other resources
// created by AllocationPolicy.
// Labels could be user provided or system generated.
// You can assign up to 64 labels. [Google Compute Engine label
// restrictions](https://cloud.google.com/compute/docs/labeling-resources#restrictions)
// apply.
// Label names that start with "goog-" or "google-" are reserved.
map<string, string> labels = 6;
// The network policy.
NetworkPolicy network = 7;
// The placement policy.
PlacementPolicy placement = 10;
}
// A TaskGroup defines one or more Tasks that all share the same TaskSpec.
message TaskGroup {
// How Tasks in the TaskGroup should be scheduled relative to each other.
enum SchedulingPolicy {
// Unspecified.
SCHEDULING_POLICY_UNSPECIFIED = 0;
// Run Tasks as soon as resources are available.
//
// Tasks might be executed in parallel depending on parallelism and
// task_count values.
AS_SOON_AS_POSSIBLE = 1;
// Run Tasks sequentially with increased task index.
IN_ORDER = 2;
}
// Output only. TaskGroup name.
// The system generates this field based on parent Job name.
// For example:
// "projects/123456/locations/us-west1/jobs/job01/taskGroups/group01".
string name = 1;
// Required. Tasks in the group share the same task spec.
TaskSpec task_spec = 3;
// Number of Tasks in the TaskGroup.
// Default is 1.
int64 task_count = 4;
// 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.
int64 parallelism = 5;
// Scheduling policy for Tasks in the TaskGroup.
// The default value is AS_SOON_AS_POSSIBLE.
SchedulingPolicy scheduling_policy = 6;
// An array of environment variable mappings, which are passed to Tasks with
// matching indices. If task_environments is used then task_count should
// not be specified in the request (and will be ignored). Task count will be
// the length of task_environments.
//
// Tasks get a BATCH_TASK_INDEX and BATCH_TASK_COUNT environment variable, in
// addition to any environment variables set in task_environments, specifying
// the number of Tasks in the Task's parent TaskGroup, and the specific Task's
// index in the TaskGroup (0 through BATCH_TASK_COUNT - 1).
repeated Environment task_environments = 9;
// Max number of tasks that can be run on a VM at the same time.
// If not specified, the system will decide a value based on available
// compute resources on a VM and task requirements.
int64 task_count_per_node = 10;
// When true, Batch will populate a file with a list of all VMs assigned to
// the TaskGroup and set the BATCH_HOSTS_FILE environment variable to the path
// of that file. Defaults to false.
bool require_hosts_file = 11;
// When true, Batch will configure SSH to allow passwordless login between
// VMs running the Batch tasks in the same TaskGroup.
bool permissive_ssh = 12;
}
// Carries information about a Google Cloud service account.
message ServiceAccount {
// 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.
string email = 1;
// List of scopes to be enabled for this service account on the VM, in
// addition to the cloud-platform API scope that will be added by default.
repeated string scopes = 2;
}
// The data within all Job events.
message JobEventData {
// Optional. The Job event payload. Unset for deletion events.
optional Job payload = 1;
}