Class: Aws::Batch::Client
- Inherits:
-
Seahorse::Client::Base
- Object
- Seahorse::Client::Base
- Aws::Batch::Client
- Includes:
- ClientStubs
- Defined in:
- gems/aws-sdk-batch/lib/aws-sdk-batch/client.rb
Overview
An API client for Batch. To construct a client, you need to configure a :region
and :credentials
.
client = Aws::Batch::Client.new(
region: region_name,
credentials: credentials,
# ...
)
For details on configuring region and credentials see the developer guide.
See #initialize for a full list of supported configuration options.
Instance Attribute Summary
Attributes inherited from Seahorse::Client::Base
API Operations collapse
-
#cancel_job(params = {}) ⇒ Struct
Cancels a job in an Batch job queue.
-
#create_compute_environment(params = {}) ⇒ Types::CreateComputeEnvironmentResponse
Creates an Batch compute environment.
-
#create_job_queue(params = {}) ⇒ Types::CreateJobQueueResponse
Creates an Batch job queue.
-
#create_scheduling_policy(params = {}) ⇒ Types::CreateSchedulingPolicyResponse
Creates an Batch scheduling policy.
-
#delete_compute_environment(params = {}) ⇒ Struct
Deletes an Batch compute environment.
-
#delete_job_queue(params = {}) ⇒ Struct
Deletes the specified job queue.
-
#delete_scheduling_policy(params = {}) ⇒ Struct
Deletes the specified scheduling policy.
-
#deregister_job_definition(params = {}) ⇒ Struct
Deregisters an Batch job definition.
-
#describe_compute_environments(params = {}) ⇒ Types::DescribeComputeEnvironmentsResponse
Describes one or more of your compute environments.
-
#describe_job_definitions(params = {}) ⇒ Types::DescribeJobDefinitionsResponse
Describes a list of job definitions.
-
#describe_job_queues(params = {}) ⇒ Types::DescribeJobQueuesResponse
Describes one or more of your job queues.
-
#describe_jobs(params = {}) ⇒ Types::DescribeJobsResponse
Describes a list of Batch jobs.
-
#describe_scheduling_policies(params = {}) ⇒ Types::DescribeSchedulingPoliciesResponse
Describes one or more of your scheduling policies.
-
#list_jobs(params = {}) ⇒ Types::ListJobsResponse
Returns a list of Batch jobs.
-
#list_scheduling_policies(params = {}) ⇒ Types::ListSchedulingPoliciesResponse
Returns a list of Batch scheduling policies.
-
#list_tags_for_resource(params = {}) ⇒ Types::ListTagsForResourceResponse
Lists the tags for an Batch resource.
-
#register_job_definition(params = {}) ⇒ Types::RegisterJobDefinitionResponse
Registers an Batch job definition.
-
#submit_job(params = {}) ⇒ Types::SubmitJobResponse
Submits an Batch job from a job definition.
-
#tag_resource(params = {}) ⇒ Struct
Associates the specified tags to a resource with the specified
resourceArn
. -
#terminate_job(params = {}) ⇒ Struct
Terminates a job in a job queue.
-
#untag_resource(params = {}) ⇒ Struct
Deletes specified tags from an Batch resource.
-
#update_compute_environment(params = {}) ⇒ Types::UpdateComputeEnvironmentResponse
Updates an Batch compute environment.
-
#update_job_queue(params = {}) ⇒ Types::UpdateJobQueueResponse
Updates a job queue.
-
#update_scheduling_policy(params = {}) ⇒ Struct
Updates a scheduling policy.
Instance Method Summary collapse
-
#initialize(options) ⇒ Client
constructor
A new instance of Client.
Methods included from ClientStubs
#api_requests, #stub_data, #stub_responses
Methods inherited from Seahorse::Client::Base
add_plugin, api, clear_plugins, define, new, #operation_names, plugins, remove_plugin, set_api, set_plugins
Methods included from Seahorse::Client::HandlerBuilder
#handle, #handle_request, #handle_response
Constructor Details
#initialize(options) ⇒ Client
Returns a new instance of Client.
348 349 350 |
# File 'gems/aws-sdk-batch/lib/aws-sdk-batch/client.rb', line 348 def initialize(*args) super end |
Instance Method Details
#cancel_job(params = {}) ⇒ Struct
Cancels a job in an Batch job queue. Jobs that are in the SUBMITTED
,
PENDING
, or RUNNABLE
state are canceled. Jobs that have progressed
to STARTING
or RUNNING
aren't canceled, but the API operation
still succeeds, even if no job is canceled. These jobs must be
terminated with the TerminateJob operation.
395 396 397 398 |
# File 'gems/aws-sdk-batch/lib/aws-sdk-batch/client.rb', line 395 def cancel_job(params = {}, = {}) req = build_request(:cancel_job, params) req.send_request() end |
#create_compute_environment(params = {}) ⇒ Types::CreateComputeEnvironmentResponse
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.
In an unmanaged compute environment, you can manage your own EC2 compute resources and have a lot of 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.
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 do not set the service role (
serviceRole
) parameter or set it to the AWSBatchServiceRole service-linked role.Set the allocation strategy (
allocationStrategy
) parameter toBEST_FIT_PROGRESSIVE
orSPOT_CAPACITY_OPTIMIZED
.Set the update to latest image version (
updateToLatestImageVersion
) parameter totrue
.Do not specify an AMI ID in
imageId
,imageIdOverride
(inec2Configuration
), or in the launch template (launchTemplate
). In that case Batch will select the latest Amazon ECS optimized AMI supported by Batch at the time the infrastructure update is initiated. Alternatively you can specify the AMI ID in theimageId
orimageIdOverride
parameters, or the launch template identified by theLaunchTemplate
properties. Changing any of these properties will trigger an infrastructure update. If the AMI ID is specified in the launch template, it can not be replaced by specifying an AMI ID in either theimageId
orimageIdOverride
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 triggers an
infrastructure update will cause 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 will be evaluated up at the time of the infrastructure
update, even if the launchTemplate
was not updated.
743 744 745 746 |
# File 'gems/aws-sdk-batch/lib/aws-sdk-batch/client.rb', line 743 def create_compute_environment(params = {}, = {}) req = build_request(:create_compute_environment, params) req.send_request() end |
#create_job_queue(params = {}) ⇒ Types::CreateJobQueueResponse
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.
898 899 900 901 |
# File 'gems/aws-sdk-batch/lib/aws-sdk-batch/client.rb', line 898 def create_job_queue(params = {}, = {}) req = build_request(:create_job_queue, params) req.send_request() end |
#create_scheduling_policy(params = {}) ⇒ Types::CreateSchedulingPolicyResponse
Creates an Batch scheduling policy.
961 962 963 964 |
# File 'gems/aws-sdk-batch/lib/aws-sdk-batch/client.rb', line 961 def create_scheduling_policy(params = {}, = {}) req = build_request(:create_scheduling_policy, params) req.send_request() end |
#delete_compute_environment(params = {}) ⇒ Struct
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.
1005 1006 1007 1008 |
# File 'gems/aws-sdk-batch/lib/aws-sdk-batch/client.rb', line 1005 def delete_compute_environment(params = {}, = {}) req = build_request(:delete_compute_environment, params) req.send_request() end |
#delete_job_queue(params = {}) ⇒ Struct
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.
1047 1048 1049 1050 |
# File 'gems/aws-sdk-batch/lib/aws-sdk-batch/client.rb', line 1047 def delete_job_queue(params = {}, = {}) req = build_request(:delete_job_queue, params) req.send_request() end |
#delete_scheduling_policy(params = {}) ⇒ Struct
Deletes the specified scheduling policy.
You can't delete a scheduling policy that's used in any job queues.
1071 1072 1073 1074 |
# File 'gems/aws-sdk-batch/lib/aws-sdk-batch/client.rb', line 1071 def delete_scheduling_policy(params = {}, = {}) req = build_request(:delete_scheduling_policy, params) req.send_request() end |
#deregister_job_definition(params = {}) ⇒ Struct
Deregisters an Batch job definition. Job definitions are permanently deleted after 180 days.
1108 1109 1110 1111 |
# File 'gems/aws-sdk-batch/lib/aws-sdk-batch/client.rb', line 1108 def deregister_job_definition(params = {}, = {}) req = build_request(:deregister_job_definition, params) req.send_request() end |
#describe_compute_environments(params = {}) ⇒ Types::DescribeComputeEnvironmentsResponse
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.
The returned response is a pageable response and is Enumerable. For details on usage see PageableResponse.
1259 1260 1261 1262 |
# File 'gems/aws-sdk-batch/lib/aws-sdk-batch/client.rb', line 1259 def describe_compute_environments(params = {}, = {}) req = build_request(:describe_compute_environments, params) req.send_request() end |
#describe_job_definitions(params = {}) ⇒ Types::DescribeJobDefinitionsResponse
Describes a list of job definitions. You can specify a status
(such
as ACTIVE
) to only return job definitions that match that status.
The returned response is a pageable response and is Enumerable. For details on usage see PageableResponse.
1519 1520 1521 1522 |
# File 'gems/aws-sdk-batch/lib/aws-sdk-batch/client.rb', line 1519 def describe_job_definitions(params = {}, = {}) req = build_request(:describe_job_definitions, params) req.send_request() end |
#describe_job_queues(params = {}) ⇒ Types::DescribeJobQueuesResponse
Describes one or more of your job queues.
The returned response is a pageable response and is Enumerable. For details on usage see PageableResponse.
1620 1621 1622 1623 |
# File 'gems/aws-sdk-batch/lib/aws-sdk-batch/client.rb', line 1620 def describe_job_queues(params = {}, = {}) req = build_request(:describe_job_queues, params) req.send_request() end |
#describe_jobs(params = {}) ⇒ Types::DescribeJobsResponse
Describes a list of Batch jobs.
1877 1878 1879 1880 |
# File 'gems/aws-sdk-batch/lib/aws-sdk-batch/client.rb', line 1877 def describe_jobs(params = {}, = {}) req = build_request(:describe_jobs, params) req.send_request() end |
#describe_scheduling_policies(params = {}) ⇒ Types::DescribeSchedulingPoliciesResponse
Describes one or more of your scheduling policies.
1915 1916 1917 1918 |
# File 'gems/aws-sdk-batch/lib/aws-sdk-batch/client.rb', line 1915 def describe_scheduling_policies(params = {}, = {}) req = build_request(:describe_scheduling_policies, params) req.send_request() end |
#list_jobs(params = {}) ⇒ Types::ListJobsResponse
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.
The returned response is a pageable response and is Enumerable. For details on usage see PageableResponse.
2111 2112 2113 2114 |
# File 'gems/aws-sdk-batch/lib/aws-sdk-batch/client.rb', line 2111 def list_jobs(params = {}, = {}) req = build_request(:list_jobs, params) req.send_request() end |
#list_scheduling_policies(params = {}) ⇒ Types::ListSchedulingPoliciesResponse
Returns a list of Batch scheduling policies.
The returned response is a pageable response and is Enumerable. For details on usage see PageableResponse.
2166 2167 2168 2169 |
# File 'gems/aws-sdk-batch/lib/aws-sdk-batch/client.rb', line 2166 def list_scheduling_policies(params = {}, = {}) req = build_request(:list_scheduling_policies, params) req.send_request() end |
#list_tags_for_resource(params = {}) ⇒ Types::ListTagsForResourceResponse
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 are not supported.
2220 2221 2222 2223 |
# File 'gems/aws-sdk-batch/lib/aws-sdk-batch/client.rb', line 2220 def (params = {}, = {}) req = build_request(:list_tags_for_resource, params) req.send_request() end |
#register_job_definition(params = {}) ⇒ Types::RegisterJobDefinitionResponse
Registers an Batch job definition.
2658 2659 2660 2661 |
# File 'gems/aws-sdk-batch/lib/aws-sdk-batch/client.rb', line 2658 def register_job_definition(params = {}, = {}) req = build_request(:register_job_definition, params) req.send_request() end |
#submit_job(params = {}) ⇒ Types::SubmitJobResponse
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.
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.
2913 2914 2915 2916 |
# File 'gems/aws-sdk-batch/lib/aws-sdk-batch/client.rb', line 2913 def submit_job(params = {}, = {}) req = build_request(:submit_job, params) req.send_request() end |
#tag_resource(params = {}) ⇒ Struct
Associates the specified tags to a resource with the specified
resourceArn
. If existing tags on a resource aren't specified in the
request parameters, they aren't changed. When a resource is deleted,
the tags that are associated with that resource are deleted as well.
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 are not supported.
2973 2974 2975 2976 |
# File 'gems/aws-sdk-batch/lib/aws-sdk-batch/client.rb', line 2973 def tag_resource(params = {}, = {}) req = build_request(:tag_resource, params) req.send_request() end |
#terminate_job(params = {}) ⇒ Struct
Terminates a job in a job queue. Jobs that are in the STARTING
or
RUNNING
state are terminated, which causes them to transition to
FAILED
. Jobs that have not progressed to the STARTING
state are
cancelled.
3018 3019 3020 3021 |
# File 'gems/aws-sdk-batch/lib/aws-sdk-batch/client.rb', line 3018 def terminate_job(params = {}, = {}) req = build_request(:terminate_job, params) req.send_request() end |
#untag_resource(params = {}) ⇒ Struct
Deletes specified tags from an Batch resource.
3064 3065 3066 3067 |
# File 'gems/aws-sdk-batch/lib/aws-sdk-batch/client.rb', line 3064 def untag_resource(params = {}, = {}) req = build_request(:untag_resource, params) req.send_request() end |
#update_compute_environment(params = {}) ⇒ Types::UpdateComputeEnvironmentResponse
Updates an Batch compute environment.
3224 3225 3226 3227 |
# File 'gems/aws-sdk-batch/lib/aws-sdk-batch/client.rb', line 3224 def update_compute_environment(params = {}, = {}) req = build_request(:update_compute_environment, params) req.send_request() end |
#update_job_queue(params = {}) ⇒ Types::UpdateJobQueueResponse
Updates a job queue.
3319 3320 3321 3322 |
# File 'gems/aws-sdk-batch/lib/aws-sdk-batch/client.rb', line 3319 def update_job_queue(params = {}, = {}) req = build_request(:update_job_queue, params) req.send_request() end |
#update_scheduling_policy(params = {}) ⇒ Struct
Updates a scheduling policy.
3354 3355 3356 3357 |
# File 'gems/aws-sdk-batch/lib/aws-sdk-batch/client.rb', line 3354 def update_scheduling_policy(params = {}, = {}) req = build_request(:update_scheduling_policy, params) req.send_request() end |