/
batch.jl
1351 lines (1260 loc) · 61.6 KB
/
batch.jl
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
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# This file is auto-generated by AWSMetadata.jl
using AWS
using AWS.AWSServices: batch
using AWS.Compat
using AWS.UUIDs
"""
cancel_job(job_id, reason)
cancel_job(job_id, reason, params::Dict{String,<:Any})
Cancels a job in an Batch job queue. Jobs that are in the SUBMITTED or PENDING are
canceled. A job inRUNNABLE remains in RUNNABLE until it reaches the head of the job queue.
Then the job status is updated to FAILED. Jobs that progressed to the STARTING or RUNNING
state aren't canceled. However, the API operation still succeeds, even if no job is
canceled. These jobs must be terminated with the TerminateJob operation.
# Arguments
- `job_id`: The Batch job ID of the job to cancel.
- `reason`: A message to attach to the job that explains the reason for canceling it. This
message is returned by future DescribeJobs operations on the job. This message is also
recorded in the Batch activity logs.
"""
function cancel_job(jobId, reason; aws_config::AbstractAWSConfig=global_aws_config())
return batch(
"POST",
"/v1/canceljob",
Dict{String,Any}("jobId" => jobId, "reason" => reason);
aws_config=aws_config,
feature_set=SERVICE_FEATURE_SET,
)
end
function cancel_job(
jobId,
reason,
params::AbstractDict{String};
aws_config::AbstractAWSConfig=global_aws_config(),
)
return batch(
"POST",
"/v1/canceljob",
Dict{String,Any}(
mergewith(
_merge, Dict{String,Any}("jobId" => jobId, "reason" => reason), params
),
);
aws_config=aws_config,
feature_set=SERVICE_FEATURE_SET,
)
end
"""
create_compute_environment(compute_environment_name, type)
create_compute_environment(compute_environment_name, type, params::Dict{String,<:Any})
Creates an Batch compute environment. You can create MANAGED or UNMANAGED compute
environments. MANAGED compute environments can use Amazon EC2 or Fargate resources.
UNMANAGED compute environments can only use EC2 resources. In a managed compute
environment, Batch manages the capacity and instance types of the compute resources within
the environment. This is based on the compute resource specification that you define or the
launch template that you specify when you create the compute environment. Either, you can
choose to use EC2 On-Demand Instances and EC2 Spot Instances. Or, you can use Fargate and
Fargate Spot capacity in your managed compute environment. You can optionally set a maximum
price so that Spot Instances only launch when the Spot Instance price is less than a
specified percentage of the On-Demand price. Multi-node parallel jobs aren't supported on
Spot Instances. In an unmanaged compute environment, you can manage your own EC2 compute
resources and have flexibility with how you configure your compute resources. For example,
you can use custom AMIs. However, you must verify that each of your AMIs meet the Amazon
ECS container instance AMI specification. For more information, see container instance AMIs
in the Amazon Elastic Container Service Developer Guide. After you created your unmanaged
compute environment, you can use the DescribeComputeEnvironments operation to find the
Amazon ECS cluster that's associated with it. Then, launch your container instances into
that Amazon ECS cluster. For more information, see Launching an Amazon ECS container
instance in the Amazon Elastic Container Service Developer Guide. To create a compute
environment that uses EKS resources, the caller must have permissions to call
eks:DescribeCluster. Batch doesn't automatically upgrade the AMIs in a compute
environment after it's created. For example, it also doesn't update the AMIs in your
compute environment when a newer version of the Amazon ECS optimized AMI is available.
You're responsible for the management of the guest operating system. This includes any
updates and security patches. You're also responsible for any additional application
software or utilities that you install on the compute resources. There are two ways to use
a new AMI for your Batch jobs. The original method is to complete these steps: Create a
new compute environment with the new AMI. Add the compute environment to an existing job
queue. Remove the earlier compute environment from your job queue. Delete the earlier
compute environment. In April 2022, Batch added enhanced support for updating compute
environments. For more information, see Updating compute environments. To use the enhanced
updating of compute environments to update AMIs, follow these rules: Either don't set the
service role (serviceRole) parameter or set it to the AWSBatchServiceRole service-linked
role. Set the allocation strategy (allocationStrategy) parameter to BEST_FIT_PROGRESSIVE
or SPOT_CAPACITY_OPTIMIZED. Set the update to latest image version
(updateToLatestImageVersion) parameter to true. Don't specify an AMI ID in imageId,
imageIdOverride (in ec2Configuration ), or in the launch template (launchTemplate). In
that case, Batch selects the latest Amazon ECS optimized AMI that's supported by Batch at
the time the infrastructure update is initiated. Alternatively, you can specify the AMI ID
in the imageId or imageIdOverride parameters, or the launch template identified by the
LaunchTemplate properties. Changing any of these properties starts an infrastructure
update. If the AMI ID is specified in the launch template, it can't be replaced by
specifying an AMI ID in either the imageId or imageIdOverride parameters. It can only be
replaced by specifying a different launch template, or if the launch template version is
set to Default or Latest, by setting either a new default version for the launch template
(if Default) or by adding a new version to the launch template (if Latest). If these
rules are followed, any update that starts an infrastructure update causes the AMI ID to be
re-selected. If the version setting in the launch template (launchTemplate) is set to
Latest or Default, the latest or default version of the launch template is evaluated up at
the time of the infrastructure update, even if the launchTemplate wasn't updated.
# Arguments
- `compute_environment_name`: The name for your compute environment. It can be up to 128
characters long. It can contain uppercase and lowercase letters, numbers, hyphens (-), and
underscores (_).
- `type`: The type of the compute environment: MANAGED or UNMANAGED. For more information,
see Compute Environments in the Batch User Guide.
# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"computeResources"`: Details about the compute resources managed by the compute
environment. This parameter is required for managed compute environments. For more
information, see Compute Environments in the Batch User Guide.
- `"eksConfiguration"`: The details for the Amazon EKS cluster that supports the compute
environment.
- `"serviceRole"`: The full Amazon Resource Name (ARN) of the IAM role that allows Batch to
make calls to other Amazon Web Services services on your behalf. For more information, see
Batch service IAM role in the Batch User Guide. If your account already created the Batch
service-linked role, that role is used by default for your compute environment unless you
specify a different role here. If the Batch service-linked role doesn't exist in your
account, and no role is specified here, the service attempts to create the Batch
service-linked role in your account. If your specified role has a path other than /, then
you must specify either the full role ARN (recommended) or prefix the role name with the
path. For example, if a role with the name bar has a path of /foo/, specify /foo/bar as the
role name. For more information, see Friendly names and paths in the IAM User Guide.
Depending on how you created your Batch service role, its ARN might contain the
service-role path prefix. When you only specify the name of the service role, Batch assumes
that your ARN doesn't use the service-role path prefix. Because of this, we recommend that
you specify the full ARN of your service role when you create compute environments.
- `"state"`: The state of the compute environment. If the state is ENABLED, then the
compute environment accepts jobs from a queue and can scale out automatically based on
queues. If the state is ENABLED, then the Batch scheduler can attempt to place jobs from an
associated job queue on the compute resources within the environment. If the compute
environment is managed, then it can scale its instances out or in automatically, based on
the job queue demand. If the state is DISABLED, then the Batch scheduler doesn't attempt to
place jobs within the environment. Jobs in a STARTING or RUNNING state continue to progress
normally. Managed compute environments in the DISABLED state don't scale out. Compute
environments in a DISABLED state may continue to incur billing charges. To prevent
additional charges, turn off and then delete the compute environment. For more information,
see State in the Batch User Guide. When an instance is idle, the instance scales down to
the minvCpus value. However, the instance size doesn't change. For example, consider a
c5.8xlarge instance with a minvCpus value of 4 and a desiredvCpus value of 36. This
instance doesn't scale down to a c5.large instance.
- `"tags"`: The tags that you apply to the compute environment to help you categorize and
organize your resources. Each tag consists of a key and an optional value. For more
information, see Tagging Amazon Web Services Resources in Amazon Web Services General
Reference. These tags can be updated or removed using the TagResource and UntagResource API
operations. These tags don't propagate to the underlying compute resources.
- `"unmanagedvCpus"`: The maximum number of vCPUs for an unmanaged compute environment.
This parameter is only used for fair share scheduling to reserve vCPU capacity for new
share identifiers. If this parameter isn't provided for a fair share job queue, no vCPU
capacity is reserved. This parameter is only supported when the type parameter is set to
UNMANAGED.
"""
function create_compute_environment(
computeEnvironmentName, type; aws_config::AbstractAWSConfig=global_aws_config()
)
return batch(
"POST",
"/v1/createcomputeenvironment",
Dict{String,Any}(
"computeEnvironmentName" => computeEnvironmentName, "type" => type
);
aws_config=aws_config,
feature_set=SERVICE_FEATURE_SET,
)
end
function create_compute_environment(
computeEnvironmentName,
type,
params::AbstractDict{String};
aws_config::AbstractAWSConfig=global_aws_config(),
)
return batch(
"POST",
"/v1/createcomputeenvironment",
Dict{String,Any}(
mergewith(
_merge,
Dict{String,Any}(
"computeEnvironmentName" => computeEnvironmentName, "type" => type
),
params,
),
);
aws_config=aws_config,
feature_set=SERVICE_FEATURE_SET,
)
end
"""
create_job_queue(compute_environment_order, job_queue_name, priority)
create_job_queue(compute_environment_order, job_queue_name, priority, params::Dict{String,<:Any})
Creates an Batch job queue. When you create a job queue, you associate one or more compute
environments to the queue and assign an order of preference for the compute environments.
You also set a priority to the job queue that determines the order that the Batch scheduler
places jobs onto its associated compute environments. For example, if a compute environment
is associated with more than one job queue, the job queue with a higher priority is given
preference for scheduling jobs to that compute environment.
# Arguments
- `compute_environment_order`: The set of compute environments mapped to a job queue and
their order relative to each other. The job scheduler uses this parameter to determine
which compute environment runs a specific job. Compute environments must be in the VALID
state before you can associate them with a job queue. You can associate up to three compute
environments with a job queue. All of the compute environments must be either EC2 (EC2 or
SPOT) or Fargate (FARGATE or FARGATE_SPOT); EC2 and Fargate compute environments can't be
mixed. All compute environments that are associated with a job queue must share the same
architecture. Batch doesn't support mixing compute environment architecture types in a
single job queue.
- `job_queue_name`: The name of the job queue. It can be up to 128 letters long. It can
contain uppercase and lowercase letters, numbers, hyphens (-), and underscores (_).
- `priority`: The priority of the job queue. Job queues with a higher priority (or a higher
integer value for the priority parameter) are evaluated first when associated with the same
compute environment. Priority is determined in descending order. For example, a job queue
with a priority value of 10 is given scheduling preference over a job queue with a priority
value of 1. All of the compute environments must be either EC2 (EC2 or SPOT) or Fargate
(FARGATE or FARGATE_SPOT); EC2 and Fargate compute environments can't be mixed.
# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"schedulingPolicyArn"`: The Amazon Resource Name (ARN) of the fair share scheduling
policy. If this parameter is specified, the job queue uses a fair share scheduling policy.
If this parameter isn't specified, the job queue uses a first in, first out (FIFO)
scheduling policy. After a job queue is created, you can replace but can't remove the fair
share scheduling policy. The format is
aws:Partition:batch:Region:Account:scheduling-policy/Name . An example is
aws:aws:batch:us-west-2:123456789012:scheduling-policy/MySchedulingPolicy.
- `"state"`: The state of the job queue. If the job queue state is ENABLED, it is able to
accept jobs. If the job queue state is DISABLED, new jobs can't be added to the queue, but
jobs already in the queue can finish.
- `"tags"`: The tags that you apply to the job queue to help you categorize and organize
your resources. Each tag consists of a key and an optional value. For more information, see
Tagging your Batch resources in Batch User Guide.
"""
function create_job_queue(
computeEnvironmentOrder,
jobQueueName,
priority;
aws_config::AbstractAWSConfig=global_aws_config(),
)
return batch(
"POST",
"/v1/createjobqueue",
Dict{String,Any}(
"computeEnvironmentOrder" => computeEnvironmentOrder,
"jobQueueName" => jobQueueName,
"priority" => priority,
);
aws_config=aws_config,
feature_set=SERVICE_FEATURE_SET,
)
end
function create_job_queue(
computeEnvironmentOrder,
jobQueueName,
priority,
params::AbstractDict{String};
aws_config::AbstractAWSConfig=global_aws_config(),
)
return batch(
"POST",
"/v1/createjobqueue",
Dict{String,Any}(
mergewith(
_merge,
Dict{String,Any}(
"computeEnvironmentOrder" => computeEnvironmentOrder,
"jobQueueName" => jobQueueName,
"priority" => priority,
),
params,
),
);
aws_config=aws_config,
feature_set=SERVICE_FEATURE_SET,
)
end
"""
create_scheduling_policy(name)
create_scheduling_policy(name, params::Dict{String,<:Any})
Creates an Batch scheduling policy.
# Arguments
- `name`: The name of the scheduling policy. It can be up to 128 letters long. It can
contain uppercase and lowercase letters, numbers, hyphens (-), and underscores (_).
# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"fairsharePolicy"`: The fair share policy of the scheduling policy.
- `"tags"`: The tags that you apply to the scheduling policy to help you categorize and
organize your resources. Each tag consists of a key and an optional value. For more
information, see Tagging Amazon Web Services Resources in Amazon Web Services General
Reference. These tags can be updated or removed using the TagResource and UntagResource API
operations.
"""
function create_scheduling_policy(name; aws_config::AbstractAWSConfig=global_aws_config())
return batch(
"POST",
"/v1/createschedulingpolicy",
Dict{String,Any}("name" => name);
aws_config=aws_config,
feature_set=SERVICE_FEATURE_SET,
)
end
function create_scheduling_policy(
name, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()
)
return batch(
"POST",
"/v1/createschedulingpolicy",
Dict{String,Any}(mergewith(_merge, Dict{String,Any}("name" => name), params));
aws_config=aws_config,
feature_set=SERVICE_FEATURE_SET,
)
end
"""
delete_compute_environment(compute_environment)
delete_compute_environment(compute_environment, params::Dict{String,<:Any})
Deletes an Batch compute environment. Before you can delete a compute environment, you must
set its state to DISABLED with the UpdateComputeEnvironment API operation and disassociate
it from any job queues with the UpdateJobQueue API operation. Compute environments that use
Fargate resources must terminate all active jobs on that compute environment before
deleting the compute environment. If this isn't done, the compute environment enters an
invalid state.
# Arguments
- `compute_environment`: The name or Amazon Resource Name (ARN) of the compute environment
to delete.
"""
function delete_compute_environment(
computeEnvironment; aws_config::AbstractAWSConfig=global_aws_config()
)
return batch(
"POST",
"/v1/deletecomputeenvironment",
Dict{String,Any}("computeEnvironment" => computeEnvironment);
aws_config=aws_config,
feature_set=SERVICE_FEATURE_SET,
)
end
function delete_compute_environment(
computeEnvironment,
params::AbstractDict{String};
aws_config::AbstractAWSConfig=global_aws_config(),
)
return batch(
"POST",
"/v1/deletecomputeenvironment",
Dict{String,Any}(
mergewith(
_merge, Dict{String,Any}("computeEnvironment" => computeEnvironment), params
),
);
aws_config=aws_config,
feature_set=SERVICE_FEATURE_SET,
)
end
"""
delete_job_queue(job_queue)
delete_job_queue(job_queue, params::Dict{String,<:Any})
Deletes the specified job queue. You must first disable submissions for a queue with the
UpdateJobQueue operation. All jobs in the queue are eventually terminated when you delete a
job queue. The jobs are terminated at a rate of about 16 jobs each second. It's not
necessary to disassociate compute environments from a queue before submitting a
DeleteJobQueue request.
# Arguments
- `job_queue`: The short name or full Amazon Resource Name (ARN) of the queue to delete.
"""
function delete_job_queue(jobQueue; aws_config::AbstractAWSConfig=global_aws_config())
return batch(
"POST",
"/v1/deletejobqueue",
Dict{String,Any}("jobQueue" => jobQueue);
aws_config=aws_config,
feature_set=SERVICE_FEATURE_SET,
)
end
function delete_job_queue(
jobQueue,
params::AbstractDict{String};
aws_config::AbstractAWSConfig=global_aws_config(),
)
return batch(
"POST",
"/v1/deletejobqueue",
Dict{String,Any}(
mergewith(_merge, Dict{String,Any}("jobQueue" => jobQueue), params)
);
aws_config=aws_config,
feature_set=SERVICE_FEATURE_SET,
)
end
"""
delete_scheduling_policy(arn)
delete_scheduling_policy(arn, params::Dict{String,<:Any})
Deletes the specified scheduling policy. You can't delete a scheduling policy that's used
in any job queues.
# Arguments
- `arn`: The Amazon Resource Name (ARN) of the scheduling policy to delete.
"""
function delete_scheduling_policy(arn; aws_config::AbstractAWSConfig=global_aws_config())
return batch(
"POST",
"/v1/deleteschedulingpolicy",
Dict{String,Any}("arn" => arn);
aws_config=aws_config,
feature_set=SERVICE_FEATURE_SET,
)
end
function delete_scheduling_policy(
arn, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()
)
return batch(
"POST",
"/v1/deleteschedulingpolicy",
Dict{String,Any}(mergewith(_merge, Dict{String,Any}("arn" => arn), params));
aws_config=aws_config,
feature_set=SERVICE_FEATURE_SET,
)
end
"""
deregister_job_definition(job_definition)
deregister_job_definition(job_definition, params::Dict{String,<:Any})
Deregisters an Batch job definition. Job definitions are permanently deleted after 180 days.
# Arguments
- `job_definition`: The name and revision (name:revision) or full Amazon Resource Name
(ARN) of the job definition to deregister.
"""
function deregister_job_definition(
jobDefinition; aws_config::AbstractAWSConfig=global_aws_config()
)
return batch(
"POST",
"/v1/deregisterjobdefinition",
Dict{String,Any}("jobDefinition" => jobDefinition);
aws_config=aws_config,
feature_set=SERVICE_FEATURE_SET,
)
end
function deregister_job_definition(
jobDefinition,
params::AbstractDict{String};
aws_config::AbstractAWSConfig=global_aws_config(),
)
return batch(
"POST",
"/v1/deregisterjobdefinition",
Dict{String,Any}(
mergewith(_merge, Dict{String,Any}("jobDefinition" => jobDefinition), params)
);
aws_config=aws_config,
feature_set=SERVICE_FEATURE_SET,
)
end
"""
describe_compute_environments()
describe_compute_environments(params::Dict{String,<:Any})
Describes one or more of your compute environments. If you're using an unmanaged compute
environment, you can use the DescribeComputeEnvironment operation to determine the
ecsClusterArn that you launch your Amazon ECS container instances into.
# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"computeEnvironments"`: A list of up to 100 compute environment names or full Amazon
Resource Name (ARN) entries.
- `"maxResults"`: The maximum number of cluster results returned by
DescribeComputeEnvironments in paginated output. When this parameter is used,
DescribeComputeEnvironments only returns maxResults results in a single page along with a
nextToken response element. The remaining results of the initial request can be seen by
sending another DescribeComputeEnvironments request with the returned nextToken value. This
value can be between 1 and 100. If this parameter isn't used, then
DescribeComputeEnvironments returns up to 100 results and a nextToken value if applicable.
- `"nextToken"`: The nextToken value returned from a previous paginated
DescribeComputeEnvironments request where maxResults was used and the results exceeded the
value of that parameter. Pagination continues from the end of the previous results that
returned the nextToken value. This value is null when there are no more results to return.
Treat this token as an opaque identifier that's only used to retrieve the next items in a
list and not for other programmatic purposes.
"""
function describe_compute_environments(; aws_config::AbstractAWSConfig=global_aws_config())
return batch(
"POST",
"/v1/describecomputeenvironments";
aws_config=aws_config,
feature_set=SERVICE_FEATURE_SET,
)
end
function describe_compute_environments(
params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()
)
return batch(
"POST",
"/v1/describecomputeenvironments",
params;
aws_config=aws_config,
feature_set=SERVICE_FEATURE_SET,
)
end
"""
describe_job_definitions()
describe_job_definitions(params::Dict{String,<:Any})
Describes a list of job definitions. You can specify a status (such as ACTIVE) to only
return job definitions that match that status.
# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"jobDefinitionName"`: The name of the job definition to describe.
- `"jobDefinitions"`: A list of up to 100 job definitions. Each entry in the list can
either be an ARN in the format
arn:aws:batch:{Region}:{Account}:job-definition/{JobDefinitionName}:{Revision} or a short
version using the form {JobDefinitionName}:{Revision}.
- `"maxResults"`: The maximum number of results returned by DescribeJobDefinitions in
paginated output. When this parameter is used, DescribeJobDefinitions only returns
maxResults results in a single page and a nextToken response element. The remaining results
of the initial request can be seen by sending another DescribeJobDefinitions request with
the returned nextToken value. This value can be between 1 and 100. If this parameter isn't
used, then DescribeJobDefinitions returns up to 100 results and a nextToken value if
applicable.
- `"nextToken"`: The nextToken value returned from a previous paginated
DescribeJobDefinitions request where maxResults was used and the results exceeded the value
of that parameter. Pagination continues from the end of the previous results that returned
the nextToken value. This value is null when there are no more results to return. Treat
this token as an opaque identifier that's only used to retrieve the next items in a list
and not for other programmatic purposes.
- `"status"`: The status used to filter job definitions.
"""
function describe_job_definitions(; aws_config::AbstractAWSConfig=global_aws_config())
return batch(
"POST",
"/v1/describejobdefinitions";
aws_config=aws_config,
feature_set=SERVICE_FEATURE_SET,
)
end
function describe_job_definitions(
params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()
)
return batch(
"POST",
"/v1/describejobdefinitions",
params;
aws_config=aws_config,
feature_set=SERVICE_FEATURE_SET,
)
end
"""
describe_job_queues()
describe_job_queues(params::Dict{String,<:Any})
Describes one or more of your job queues.
# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"jobQueues"`: A list of up to 100 queue names or full queue Amazon Resource Name (ARN)
entries.
- `"maxResults"`: The maximum number of results returned by DescribeJobQueues in paginated
output. When this parameter is used, DescribeJobQueues only returns maxResults results in a
single page and a nextToken response element. The remaining results of the initial request
can be seen by sending another DescribeJobQueues request with the returned nextToken value.
This value can be between 1 and 100. If this parameter isn't used, then DescribeJobQueues
returns up to 100 results and a nextToken value if applicable.
- `"nextToken"`: The nextToken value returned from a previous paginated DescribeJobQueues
request where maxResults was used and the results exceeded the value of that parameter.
Pagination continues from the end of the previous results that returned the nextToken
value. This value is null when there are no more results to return. Treat this token as an
opaque identifier that's only used to retrieve the next items in a list and not for other
programmatic purposes.
"""
function describe_job_queues(; aws_config::AbstractAWSConfig=global_aws_config())
return batch(
"POST",
"/v1/describejobqueues";
aws_config=aws_config,
feature_set=SERVICE_FEATURE_SET,
)
end
function describe_job_queues(
params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()
)
return batch(
"POST",
"/v1/describejobqueues",
params;
aws_config=aws_config,
feature_set=SERVICE_FEATURE_SET,
)
end
"""
describe_jobs(jobs)
describe_jobs(jobs, params::Dict{String,<:Any})
Describes a list of Batch jobs.
# Arguments
- `jobs`: A list of up to 100 job IDs.
"""
function describe_jobs(jobs; aws_config::AbstractAWSConfig=global_aws_config())
return batch(
"POST",
"/v1/describejobs",
Dict{String,Any}("jobs" => jobs);
aws_config=aws_config,
feature_set=SERVICE_FEATURE_SET,
)
end
function describe_jobs(
jobs, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()
)
return batch(
"POST",
"/v1/describejobs",
Dict{String,Any}(mergewith(_merge, Dict{String,Any}("jobs" => jobs), params));
aws_config=aws_config,
feature_set=SERVICE_FEATURE_SET,
)
end
"""
describe_scheduling_policies(arns)
describe_scheduling_policies(arns, params::Dict{String,<:Any})
Describes one or more of your scheduling policies.
# Arguments
- `arns`: A list of up to 100 scheduling policy Amazon Resource Name (ARN) entries.
"""
function describe_scheduling_policies(
arns; aws_config::AbstractAWSConfig=global_aws_config()
)
return batch(
"POST",
"/v1/describeschedulingpolicies",
Dict{String,Any}("arns" => arns);
aws_config=aws_config,
feature_set=SERVICE_FEATURE_SET,
)
end
function describe_scheduling_policies(
arns, params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()
)
return batch(
"POST",
"/v1/describeschedulingpolicies",
Dict{String,Any}(mergewith(_merge, Dict{String,Any}("arns" => arns), params));
aws_config=aws_config,
feature_set=SERVICE_FEATURE_SET,
)
end
"""
list_jobs()
list_jobs(params::Dict{String,<:Any})
Returns a list of Batch jobs. You must specify only one of the following items: A job
queue ID to return a list of jobs in that job queue A multi-node parallel job ID to
return a list of nodes for that job An array job ID to return a list of the children for
that job You can filter the results by job status with the jobStatus parameter. If you
don't specify a status, only RUNNING jobs are returned.
# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"arrayJobId"`: The job ID for an array job. Specifying an array job ID with this
parameter lists all child jobs from within the specified array.
- `"filters"`: The filter to apply to the query. Only one filter can be used at a time.
When the filter is used, jobStatus is ignored. The filter doesn't apply to child jobs in an
array or multi-node parallel (MNP) jobs. The results are sorted by the createdAt field,
with the most recent jobs being first. JOB_NAME The value of the filter is a
case-insensitive match for the job name. If the value ends with an asterisk (*), the filter
matches any job name that begins with the string before the '*'. This corresponds to the
jobName value. For example, test1 matches both Test1 and test1, and test1* matches both
test1 and Test10. When the JOB_NAME filter is used, the results are grouped by the job name
and version. JOB_DEFINITION The value for the filter is the name or Amazon Resource Name
(ARN) of the job definition. This corresponds to the jobDefinition value. The value is case
sensitive. When the value for the filter is the job definition name, the results include
all the jobs that used any revision of that job definition name. If the value ends with an
asterisk (*), the filter matches any job definition name that begins with the string before
the '*'. For example, jd1 matches only jd1, and jd1* matches both jd1 and jd1A. The version
of the job definition that's used doesn't affect the sort order. When the JOB_DEFINITION
filter is used and the ARN is used (which is in the form
arn:{Partition}:batch:{Region}:{Account}:job-definition/{JobDefinitionName}:{Revision}),
the results include jobs that used the specified revision of the job definition. Asterisk
(*) isn't supported when the ARN is used. BEFORE_CREATED_AT The value for the filter is
the time that's before the job was created. This corresponds to the createdAt value. The
value is a string representation of the number of milliseconds since 00:00:00 UTC
(midnight) on January 1, 1970. AFTER_CREATED_AT The value for the filter is the time
that's after the job was created. This corresponds to the createdAt value. The value is a
string representation of the number of milliseconds since 00:00:00 UTC (midnight) on
January 1, 1970.
- `"jobQueue"`: The name or full Amazon Resource Name (ARN) of the job queue used to list
jobs.
- `"jobStatus"`: The job status used to filter jobs in the specified queue. If the filters
parameter is specified, the jobStatus parameter is ignored and jobs with any status are
returned. If you don't specify a status, only RUNNING jobs are returned.
- `"maxResults"`: The maximum number of results returned by ListJobs in paginated output.
When this parameter is used, ListJobs only returns maxResults results in a single page and
a nextToken response element. The remaining results of the initial request can be seen by
sending another ListJobs request with the returned nextToken value. This value can be
between 1 and 100. If this parameter isn't used, then ListJobs returns up to 100 results
and a nextToken value if applicable.
- `"multiNodeJobId"`: The job ID for a multi-node parallel job. Specifying a multi-node
parallel job ID with this parameter lists all nodes that are associated with the specified
job.
- `"nextToken"`: The nextToken value returned from a previous paginated ListJobs request
where maxResults was used and the results exceeded the value of that parameter. Pagination
continues from the end of the previous results that returned the nextToken value. This
value is null when there are no more results to return. Treat this token as an opaque
identifier that's only used to retrieve the next items in a list and not for other
programmatic purposes.
"""
function list_jobs(; aws_config::AbstractAWSConfig=global_aws_config())
return batch(
"POST", "/v1/listjobs"; aws_config=aws_config, feature_set=SERVICE_FEATURE_SET
)
end
function list_jobs(
params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()
)
return batch(
"POST",
"/v1/listjobs",
params;
aws_config=aws_config,
feature_set=SERVICE_FEATURE_SET,
)
end
"""
list_scheduling_policies()
list_scheduling_policies(params::Dict{String,<:Any})
Returns a list of Batch scheduling policies.
# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"maxResults"`: The maximum number of results that's returned by ListSchedulingPolicies
in paginated output. When this parameter is used, ListSchedulingPolicies only returns
maxResults results in a single page and a nextToken response element. You can see the
remaining results of the initial request by sending another ListSchedulingPolicies request
with the returned nextToken value. This value can be between 1 and 100. If this parameter
isn't used, ListSchedulingPolicies returns up to 100 results and a nextToken value if
applicable.
- `"nextToken"`: The nextToken value that's returned from a previous paginated
ListSchedulingPolicies request where maxResults was used and the results exceeded the value
of that parameter. Pagination continues from the end of the previous results that returned
the nextToken value. This value is null when there are no more results to return. Treat
this token as an opaque identifier that's only used to retrieve the next items in a list
and not for other programmatic purposes.
"""
function list_scheduling_policies(; aws_config::AbstractAWSConfig=global_aws_config())
return batch(
"POST",
"/v1/listschedulingpolicies";
aws_config=aws_config,
feature_set=SERVICE_FEATURE_SET,
)
end
function list_scheduling_policies(
params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()
)
return batch(
"POST",
"/v1/listschedulingpolicies",
params;
aws_config=aws_config,
feature_set=SERVICE_FEATURE_SET,
)
end
"""
list_tags_for_resource(resource_arn)
list_tags_for_resource(resource_arn, params::Dict{String,<:Any})
Lists the tags for an Batch resource. Batch resources that support tags are compute
environments, jobs, job definitions, job queues, and scheduling policies. ARNs for child
jobs of array and multi-node parallel (MNP) jobs aren't supported.
# Arguments
- `resource_arn`: The Amazon Resource Name (ARN) that identifies the resource that tags are
listed for. Batch resources that support tags are compute environments, jobs, job
definitions, job queues, and scheduling policies. ARNs for child jobs of array and
multi-node parallel (MNP) jobs aren't supported.
"""
function list_tags_for_resource(
resourceArn; aws_config::AbstractAWSConfig=global_aws_config()
)
return batch(
"GET",
"/v1/tags/$(resourceArn)";
aws_config=aws_config,
feature_set=SERVICE_FEATURE_SET,
)
end
function list_tags_for_resource(
resourceArn,
params::AbstractDict{String};
aws_config::AbstractAWSConfig=global_aws_config(),
)
return batch(
"GET",
"/v1/tags/$(resourceArn)",
params;
aws_config=aws_config,
feature_set=SERVICE_FEATURE_SET,
)
end
"""
register_job_definition(job_definition_name, type)
register_job_definition(job_definition_name, type, params::Dict{String,<:Any})
Registers an Batch job definition.
# Arguments
- `job_definition_name`: The name of the job definition to register. It can be up to 128
letters long. It can contain uppercase and lowercase letters, numbers, hyphens (-), and
underscores (_).
- `type`: The type of job definition. For more information about multi-node parallel jobs,
see Creating a multi-node parallel job definition in the Batch User Guide. If the job is
run on Fargate resources, then multinode isn't supported.
# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"containerProperties"`: An object with various properties specific to Amazon ECS based
single-node container-based jobs. If the job definition's type parameter is container, then
you must specify either containerProperties or nodeProperties. This must not be specified
for Amazon EKS based job definitions. If the job runs on Fargate resources, then you must
not specify nodeProperties; use only containerProperties.
- `"eksProperties"`: An object with various properties that are specific to Amazon EKS
based jobs. This must not be specified for Amazon ECS based job definitions.
- `"nodeProperties"`: An object with various properties specific to multi-node parallel
jobs. If you specify node properties for a job, it becomes a multi-node parallel job. For
more information, see Multi-node Parallel Jobs in the Batch User Guide. If the job
definition's type parameter is container, then you must specify either containerProperties
or nodeProperties. If the job runs on Fargate resources, then you must not specify
nodeProperties; use containerProperties instead. If the job runs on Amazon EKS resources,
then you must not specify nodeProperties.
- `"parameters"`: Default parameter substitution placeholders to set in the job definition.
Parameters are specified as a key-value pair mapping. Parameters in a SubmitJob request
override any corresponding parameter defaults from the job definition.
- `"platformCapabilities"`: The platform capabilities required by the job definition. If no
value is specified, it defaults to EC2. To run the job on Fargate resources, specify
FARGATE. If the job runs on Amazon EKS resources, then you must not specify
platformCapabilities.
- `"propagateTags"`: Specifies whether to propagate the tags from the job or job definition
to the corresponding Amazon ECS task. If no value is specified, the tags are not
propagated. Tags can only be propagated to the tasks during task creation. For tags with
the same name, job tags are given priority over job definitions tags. If the total number
of combined tags from the job and job definition is over 50, the job is moved to the FAILED
state. If the job runs on Amazon EKS resources, then you must not specify propagateTags.
- `"retryStrategy"`: The retry strategy to use for failed jobs that are submitted with this
job definition. Any retry strategy that's specified during a SubmitJob operation overrides
the retry strategy defined here. If a job is terminated due to a timeout, it isn't retried.
- `"schedulingPriority"`: The scheduling priority for jobs that are submitted with this job
definition. This only affects jobs in job queues with a fair share policy. Jobs with a
higher scheduling priority are scheduled before jobs with a lower scheduling priority. The
minimum supported value is 0 and the maximum supported value is 9999.
- `"tags"`: The tags that you apply to the job definition to help you categorize and
organize your resources. Each tag consists of a key and an optional value. For more
information, see Tagging Amazon Web Services Resources in Batch User Guide.
- `"timeout"`: The timeout configuration for jobs that are submitted with this job
definition, after which Batch terminates your jobs if they have not finished. If a job is
terminated due to a timeout, it isn't retried. The minimum value for the timeout is 60
seconds. Any timeout configuration that's specified during a SubmitJob operation overrides
the timeout configuration defined here. For more information, see Job Timeouts in the Batch
User Guide.
"""
function register_job_definition(
jobDefinitionName, type; aws_config::AbstractAWSConfig=global_aws_config()
)
return batch(
"POST",
"/v1/registerjobdefinition",
Dict{String,Any}("jobDefinitionName" => jobDefinitionName, "type" => type);
aws_config=aws_config,
feature_set=SERVICE_FEATURE_SET,
)
end
function register_job_definition(
jobDefinitionName,
type,
params::AbstractDict{String};
aws_config::AbstractAWSConfig=global_aws_config(),
)
return batch(
"POST",
"/v1/registerjobdefinition",
Dict{String,Any}(
mergewith(
_merge,
Dict{String,Any}("jobDefinitionName" => jobDefinitionName, "type" => type),
params,
),
);
aws_config=aws_config,
feature_set=SERVICE_FEATURE_SET,
)
end
"""
submit_job(job_definition, job_name, job_queue)
submit_job(job_definition, job_name, job_queue, params::Dict{String,<:Any})
Submits an Batch job from a job definition. Parameters that are specified during SubmitJob
override parameters defined in the job definition. vCPU and memory requirements that are
specified in the resourceRequirements objects in the job definition are the exception. They
can't be overridden this way using the memory and vcpus parameters. Rather, you must
specify updates to job definition parameters in a resourceRequirements object that's
included in the containerOverrides parameter. Job queues with a scheduling policy are
limited to 500 active fair share identifiers at a time. Jobs that run on Fargate
resources can't be guaranteed to run for more than 14 days. This is because, after 14 days,
Fargate resources might become unavailable and job might be terminated.
# Arguments
- `job_definition`: The job definition used by this job. This value can be one of
definition-name, definition-name:revision, or the Amazon Resource Name (ARN) for the job
definition, with or without the revision
(arn:aws:batch:region:account:job-definition/definition-name:revision , or
arn:aws:batch:region:account:job-definition/definition-name ). If the revision is not
specified, then the latest active revision is used.
- `job_name`: The name of the job. It can be up to 128 letters long. The first character
must be alphanumeric, can contain uppercase and lowercase letters, numbers, hyphens (-),
and underscores (_).
- `job_queue`: The job queue where the job is submitted. You can specify either the name or
the Amazon Resource Name (ARN) of the queue.
# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"arrayProperties"`: The array properties for the submitted job, such as the size of the
array. The array size can be between 2 and 10,000. If you specify array properties for a
job, it becomes an array job. For more information, see Array Jobs in the Batch User Guide.
- `"containerOverrides"`: An object with various properties that override the defaults for
the job definition that specify the name of a container in the specified job definition and
the overrides it should receive. You can override the default command for a container,
which is specified in the job definition or the Docker image, with a command override. You
can also override existing environment variables on a container or add new environment
variables to it with an environment override.
- `"dependsOn"`: A list of dependencies for the job. A job can depend upon a maximum of 20
jobs. You can specify a SEQUENTIAL type dependency without specifying a job ID for array
jobs so that each child array job completes sequentially, starting at index 0. You can also
specify an N_TO_N type dependency with a job ID for array jobs. In that case, each index
child of this job must wait for the corresponding index child of each dependency to
complete before it can begin.
- `"eksPropertiesOverride"`: An object that can only be specified for jobs that are run on
Amazon EKS resources with various properties that override defaults for the job definition.
- `"nodeOverrides"`: A list of node overrides in JSON format that specify the node range to
target and the container overrides for that node range. This parameter isn't applicable to
jobs that are running on Fargate resources; use containerOverrides instead.
- `"parameters"`: Additional parameters passed to the job that replace parameter
substitution placeholders that are set in the job definition. Parameters are specified as a
key and value pair mapping. Parameters in a SubmitJob request override any corresponding
parameter defaults from the job definition.
- `"propagateTags"`: Specifies whether to propagate the tags from the job or job definition
to the corresponding Amazon ECS task. If no value is specified, the tags aren't propagated.
Tags can only be propagated to the tasks during task creation. For tags with the same name,
job tags are given priority over job definitions tags. If the total number of combined tags
from the job and job definition is over 50, the job is moved to the FAILED state. When
specified, this overrides the tag propagation setting in the job definition.
- `"retryStrategy"`: The retry strategy to use for failed jobs from this SubmitJob
operation. When a retry strategy is specified here, it overrides the retry strategy defined
in the job definition.
- `"schedulingPriorityOverride"`: The scheduling priority for the job. This only affects
jobs in job queues with a fair share policy. Jobs with a higher scheduling priority are
scheduled before jobs with a lower scheduling priority. This overrides any scheduling
priority in the job definition. The minimum supported value is 0 and the maximum supported
value is 9999.
- `"shareIdentifier"`: The share identifier for the job. If the job queue doesn't have a
scheduling policy, then this parameter must not be specified. If the job queue has a