You are viewing documentation for version 2 of the AWS SDK for Ruby. Version 3 documentation can be found here.

Class: Aws::Batch::Client

Inherits:
Seahorse::Client::Base show all
Defined in:
(unknown)

Overview

An API client for AWS Batch. To construct a client, you need to configure a :region and :credentials.

batch = Aws::Batch::Client.new(
  region: region_name,
  credentials: credentials,
  # ...
)

See #initialize for a full list of supported configuration options.

Region

You can configure a default region in the following locations:

  • ENV['AWS_REGION']
  • Aws.config[:region]

Go here for a list of supported regions.

Credentials

Default credentials are loaded automatically from the following locations:

  • ENV['AWS_ACCESS_KEY_ID'] and ENV['AWS_SECRET_ACCESS_KEY']
  • Aws.config[:credentials]
  • The shared credentials ini file at ~/.aws/credentials (more information)
  • From an instance profile when running on EC2

You can also construct a credentials object from one of the following classes:

Alternatively, you configure credentials with :access_key_id and :secret_access_key:

# load credentials from disk
creds = YAML.load(File.read('/path/to/secrets'))

Aws::Batch::Client.new(
  access_key_id: creds['access_key_id'],
  secret_access_key: creds['secret_access_key']
)

Always load your credentials from outside your application. Avoid configuring credentials statically and never commit them to source control.

Instance Attribute Summary

Attributes inherited from Seahorse::Client::Base

#config, #handlers

Constructor collapse

API Operations collapse

Instance Method Summary collapse

Methods inherited from Seahorse::Client::Base

add_plugin, api, #build_request, clear_plugins, define, new, #operation, #operation_names, plugins, remove_plugin, set_api, set_plugins

Methods included from Seahorse::Client::HandlerBuilder

#handle, #handle_request, #handle_response

Constructor Details

#initialize(options = {}) ⇒ Aws::Batch::Client

Constructs an API client.

Options Hash (options):

  • :access_key_id (String)

    Used to set credentials statically. See Plugins::RequestSigner for more details.

  • :active_endpoint_cache (Boolean)

    When set to true, a thread polling for endpoints will be running in the background every 60 secs (default). Defaults to false. See Plugins::EndpointDiscovery for more details.

  • :convert_params (Boolean) — default: true

    When true, an attempt is made to coerce request parameters into the required types. See Plugins::ParamConverter for more details.

  • :credentials (required, Credentials)

    Your AWS credentials. The following locations will be searched in order for credentials:

    • :access_key_id, :secret_access_key, and :session_token options
    • ENV['AWS_ACCESS_KEY_ID'], ENV['AWS_SECRET_ACCESS_KEY']
    • HOME/.aws/credentials shared credentials file
    • EC2 instance profile credentials See Plugins::RequestSigner for more details.
  • :disable_host_prefix_injection (Boolean)

    Set to true to disable SDK automatically adding host prefix to default service endpoint when available. See Plugins::EndpointPattern for more details.

  • :endpoint (String)

    A default endpoint is constructed from the :region. See Plugins::RegionalEndpoint for more details.

  • :endpoint_cache_max_entries (Integer)

    Used for the maximum size limit of the LRU cache storing endpoints data for endpoint discovery enabled operations. Defaults to 1000. See Plugins::EndpointDiscovery for more details.

  • :endpoint_cache_max_threads (Integer)

    Used for the maximum threads in use for polling endpoints to be cached, defaults to 10. See Plugins::EndpointDiscovery for more details.

  • :endpoint_cache_poll_interval (Integer)

    When :endpoint_discovery and :active_endpoint_cache is enabled, Use this option to config the time interval in seconds for making requests fetching endpoints information. Defaults to 60 sec. See Plugins::EndpointDiscovery for more details.

  • :endpoint_discovery (Boolean)

    When set to true, endpoint discovery will be enabled for operations when available. Defaults to false. See Plugins::EndpointDiscovery for more details.

  • :http_continue_timeout (Float) — default: 1

    See Seahorse::Client::Plugins::NetHttp for more details.

  • :http_idle_timeout (Integer) — default: 5

    See Seahorse::Client::Plugins::NetHttp for more details.

  • :http_open_timeout (Integer) — default: 15

    See Seahorse::Client::Plugins::NetHttp for more details.

  • :http_proxy (String)

    See Seahorse::Client::Plugins::NetHttp for more details.

  • :http_read_timeout (Integer) — default: 60

    See Seahorse::Client::Plugins::NetHttp for more details.

  • :http_wire_trace (Boolean) — default: false

    See Seahorse::Client::Plugins::NetHttp for more details.

  • :log_level (Symbol) — default: :info

    The log level to send messages to the logger at. See Plugins::Logging for more details.

  • :log_formatter (Logging::LogFormatter)

    The log formatter. Defaults to Seahorse::Client::Logging::Formatter.default. See Plugins::Logging for more details.

  • :logger (Logger) — default: nil

    The Logger instance to send log messages to. If this option is not set, logging will be disabled. See Plugins::Logging for more details.

  • :profile (String)

    Used when loading credentials from the shared credentials file at HOME/.aws/credentials. When not specified, 'default' is used. See Plugins::RequestSigner for more details.

  • :raise_response_errors (Boolean) — default: true

    When true, response errors are raised. See Seahorse::Client::Plugins::RaiseResponseErrors for more details.

  • :region (required, String)

    The AWS region to connect to. The region is used to construct the client endpoint. Defaults to ENV['AWS_REGION']. Also checks AMAZON_REGION and AWS_DEFAULT_REGION. See Plugins::RegionalEndpoint for more details.

  • :retry_limit (Integer) — default: 3

    The maximum number of times to retry failed requests. Only ~ 500 level server errors and certain ~ 400 level client errors are retried. Generally, these are throttling errors, data checksum errors, networking errors, timeout errors and auth errors from expired credentials. See Plugins::RetryErrors for more details.

  • :secret_access_key (String)

    Used to set credentials statically. See Plugins::RequestSigner for more details.

  • :session_token (String)

    Used to set credentials statically. See Plugins::RequestSigner for more details.

  • :ssl_ca_bundle (String)

    See Seahorse::Client::Plugins::NetHttp for more details.

  • :ssl_ca_directory (String)

    See Seahorse::Client::Plugins::NetHttp for more details.

  • :ssl_ca_store (String)

    See Seahorse::Client::Plugins::NetHttp for more details.

  • :ssl_verify_peer (Boolean) — default: true

    See Seahorse::Client::Plugins::NetHttp for more details.

  • :stub_responses (Boolean) — default: false

    Causes the client to return stubbed responses. By default fake responses are generated and returned. You can specify the response data to return or errors to raise by calling ClientStubs#stub_responses. See ClientStubs for more information.

    Please note When response stubbing is enabled, no HTTP requests are made, and retries are disabled. See Plugins::StubResponses for more details.

  • :validate_params (Boolean) — default: true

    When true, request parameters are validated before sending the request. See Plugins::ParamValidator for more details.

Instance Method Details

#cancel_job(options = {}) ⇒ Struct

Cancels a job in an AWS Batch job queue. Jobs that are in the SUBMITTED, PENDING, or RUNNABLE state are cancelled. Jobs that have progressed to STARTING or RUNNING are not cancelled (but the API operation still succeeds, even if no job is cancelled); these jobs must be terminated with the TerminateJob operation.

Examples:

Example: To cancel a job


# This example cancels a job with the specified job ID.

resp = client.cancel_job({
  job_id: "1d828f65-7a4d-42e8-996d-3b900ed59dc4", 
  reason: "Cancelling job.", 
})

# resp.to_h outputs the following:
{
}

Request syntax with placeholder values


resp = client.cancel_job({
  job_id: "String", # required
  reason: "String", # required
})

Options Hash (options):

  • :job_id (required, String)

    The AWS Batch job ID of the job to cancel.

  • :reason (required, String)

    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 AWS Batch activity logs.

Returns:

  • (Struct)

    Returns an empty response.

See Also:

#create_compute_environment(options = {}) ⇒ Types::CreateComputeEnvironmentResponse

Creates an AWS Batch compute environment. You can create MANAGED or UNMANAGED compute environments.

In a managed compute environment, AWS 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. You can choose to use Amazon EC2 On-Demand Instances or Spot Instances in your managed compute environment. You can optionally set a maximum price so that Spot Instances only launch when the Spot Instance price is below a specified percentage of the On-Demand price.

Multi-node parallel jobs are not supported on Spot Instances.

In an unmanaged compute environment, you can manage your own compute resources. This provides more compute resource configuration options, such as using a custom AMI, but you must ensure that your AMI meets the Amazon ECS container instance AMI specification. For more information, see Container Instance AMIs in the Amazon Elastic Container Service Developer Guide. After you have created your unmanaged compute environment, you can use the DescribeComputeEnvironments operation to find the Amazon ECS cluster that is associated with it. Then, manually 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.

AWS Batch does not upgrade the AMIs in a compute environment after it is created (for example, when a newer version of the Amazon ECS-optimized AMI is available). You are responsible for the management of the guest operating system (including updates and security patches) and any additional application software or utilities that you install on the compute resources. To use a new AMI for your AWS Batch jobs:

  1. Create a new compute environment with the new AMI.

  2. Add the compute environment to an existing job queue.

  3. Remove the old compute environment from your job queue.

  4. Delete the old compute environment.

Examples:

Example: To create a managed EC2 compute environment


# This example creates a managed compute environment with specific C4 instance types that are launched on demand. The compute environment is called C4OnDemand.

resp = client.create_compute_environment({
  type: "MANAGED", 
  compute_environment_name: "C4OnDemand", 
  compute_resources: {
    type: "EC2", 
    desiredv_cpus: 48, 
    ec2_key_pair: "id_rsa", 
    instance_role: "ecsInstanceRole", 
    instance_types: [
      "c4.large", 
      "c4.xlarge", 
      "c4.2xlarge", 
      "c4.4xlarge", 
      "c4.8xlarge", 
    ], 
    maxv_cpus: 128, 
    minv_cpus: 0, 
    security_group_ids: [
      "sg-cf5093b2", 
    ], 
    subnets: [
      "subnet-220c0e0a", 
      "subnet-1a95556d", 
      "subnet-978f6dce", 
    ], 
    tags: {
      "Name" => "Batch Instance - C4OnDemand", 
    }, 
  }, 
  service_role: "arn:aws:iam::012345678910:role/AWSBatchServiceRole", 
  state: "ENABLED", 
})

# resp.to_h outputs the following:
{
  compute_environment_arn: "arn:aws:batch:us-east-1:012345678910:compute-environment/C4OnDemand", 
  compute_environment_name: "C4OnDemand", 
}

Example: To create a managed EC2 Spot compute environment


# This example creates a managed compute environment with the M4 instance type that is launched when the Spot bid price is at or below 20% of the On-Demand price for the instance type. The compute environment is called M4Spot.

resp = client.create_compute_environment({
  type: "MANAGED", 
  compute_environment_name: "M4Spot", 
  compute_resources: {
    type: "SPOT", 
    bid_percentage: 20, 
    desiredv_cpus: 4, 
    ec2_key_pair: "id_rsa", 
    instance_role: "ecsInstanceRole", 
    instance_types: [
      "m4", 
    ], 
    maxv_cpus: 128, 
    minv_cpus: 0, 
    security_group_ids: [
      "sg-cf5093b2", 
    ], 
    spot_iam_fleet_role: "arn:aws:iam::012345678910:role/aws-ec2-spot-fleet-role", 
    subnets: [
      "subnet-220c0e0a", 
      "subnet-1a95556d", 
      "subnet-978f6dce", 
    ], 
    tags: {
      "Name" => "Batch Instance - M4Spot", 
    }, 
  }, 
  service_role: "arn:aws:iam::012345678910:role/AWSBatchServiceRole", 
  state: "ENABLED", 
})

# resp.to_h outputs the following:
{
  compute_environment_arn: "arn:aws:batch:us-east-1:012345678910:compute-environment/M4Spot", 
  compute_environment_name: "M4Spot", 
}

Request syntax with placeholder values


resp = client.create_compute_environment({
  compute_environment_name: "String", # required
  type: "MANAGED", # required, accepts MANAGED, UNMANAGED
  state: "ENABLED", # accepts ENABLED, DISABLED
  compute_resources: {
    type: "EC2", # required, accepts EC2, SPOT
    allocation_strategy: "BEST_FIT", # accepts BEST_FIT, BEST_FIT_PROGRESSIVE, SPOT_CAPACITY_OPTIMIZED
    minv_cpus: 1, # required
    maxv_cpus: 1, # required
    desiredv_cpus: 1,
    instance_types: ["String"], # required
    image_id: "String",
    subnets: ["String"], # required
    security_group_ids: ["String"],
    ec2_key_pair: "String",
    instance_role: "String", # required
    tags: {
      "String" => "String",
    },
    placement_group: "String",
    bid_percentage: 1,
    spot_iam_fleet_role: "String",
    launch_template: {
      launch_template_id: "String",
      launch_template_name: "String",
      version: "String",
    },
  },
  service_role: "String", # required
  tags: {
    "TagKey" => "TagValue",
  },
})

Response structure


resp.compute_environment_name #=> String
resp.compute_environment_arn #=> String

Options Hash (options):

  • :compute_environment_name (required, String)

    The name for your compute environment. Up to 128 letters (uppercase and lowercase), numbers, hyphens, and underscores are allowed.

  • :type (required, String)

    The type of the compute environment. For more information, see Compute Environments in the AWS Batch User Guide.

  • :state (String)

    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.

  • :compute_resources (Types::ComputeResource)

    Details of the compute resources managed by the compute environment. This parameter is required for managed compute environments. For more information, see Compute Environments in the AWS Batch User Guide.

  • :service_role (required, String)

    The full Amazon Resource Name (ARN) of the IAM role that allows AWS Batch to make calls to other AWS services on your behalf.

    If your specified role has a path other than /, then you must either specify the full role ARN (this is recommended) or prefix the role name with the path.

    Depending on how you created your AWS Batch service role, its ARN may contain the service-role path prefix. When you only specify the name of the service role, AWS Batch assumes that your ARN does not 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.

  • :tags (Hash<String,String>)

    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 AWS Resources in AWS General Reference.

    These tags can be updated or removed using the TagResource and UntagResource API operations. These tags do not propagate to the underlying compute resources.

Returns:

See Also:

#create_job_queue(options = {}) ⇒ Types::CreateJobQueueResponse

Creates an AWS 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 in which the AWS 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.

Examples:

Example: To create a job queue with a single compute environment


# This example creates a job queue called LowPriority that uses the M4Spot compute environment.

resp = client.create_job_queue({
  compute_environment_order: [
    {
      compute_environment: "M4Spot", 
      order: 1, 
    }, 
  ], 
  job_queue_name: "LowPriority", 
  priority: 1, 
  state: "ENABLED", 
})

# resp.to_h outputs the following:
{
  job_queue_arn: "arn:aws:batch:us-east-1:012345678910:job-queue/LowPriority", 
  job_queue_name: "LowPriority", 
}

Example: To create a job queue with multiple compute environments


# This example creates a job queue called HighPriority that uses the C4OnDemand compute environment with an order of 1 and the M4Spot compute environment with an order of 2.

resp = client.create_job_queue({
  compute_environment_order: [
    {
      compute_environment: "C4OnDemand", 
      order: 1, 
    }, 
    {
      compute_environment: "M4Spot", 
      order: 2, 
    }, 
  ], 
  job_queue_name: "HighPriority", 
  priority: 10, 
  state: "ENABLED", 
})

# resp.to_h outputs the following:
{
  job_queue_arn: "arn:aws:batch:us-east-1:012345678910:job-queue/HighPriority", 
  job_queue_name: "HighPriority", 
}

Request syntax with placeholder values


resp = client.create_job_queue({
  job_queue_name: "String", # required
  state: "ENABLED", # accepts ENABLED, DISABLED
  priority: 1, # required
  compute_environment_order: [ # required
    {
      order: 1, # required
      compute_environment: "String", # required
    },
  ],
  tags: {
    "TagKey" => "TagValue",
  },
})

Response structure


resp.job_queue_name #=> String
resp.job_queue_arn #=> String

Options Hash (options):

  • :job_queue_name (required, String)

    The name of the job queue.

  • :state (String)

    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 cannot be added to the queue, but jobs already in the queue can finish.

  • :priority (required, Integer)

    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.

  • :compute_environment_order (required, Array<Types::ComputeEnvironmentOrder>)

    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 should execute a given 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.

  • :tags (Hash<String,String>)

    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 AWS Resources in AWS General Reference.

Returns:

See Also:

#delete_compute_environment(options = {}) ⇒ Struct

Deletes an AWS 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.

Examples:

Example: To delete a compute environment


# This example deletes the P2OnDemand compute environment.

resp = client.delete_compute_environment({
  compute_environment: "P2OnDemand", 
})

# resp.to_h outputs the following:
{
}

Request syntax with placeholder values


resp = client.delete_compute_environment({
  compute_environment: "String", # required
})

Options Hash (options):

  • :compute_environment (required, String)

    The name or Amazon Resource Name (ARN) of the compute environment to delete.

Returns:

  • (Struct)

    Returns an empty response.

See Also:

#delete_job_queue(options = {}) ⇒ Struct

Deletes the specified job queue. You must first disable submissions for a queue with the UpdateJobQueue operation. All jobs in the queue are terminated when you delete a job queue.

It is not necessary to disassociate compute environments from a queue before submitting a DeleteJobQueue request.

Examples:

Example: To delete a job queue


# This example deletes the GPGPU job queue.

resp = client.delete_job_queue({
  job_queue: "GPGPU", 
})

# resp.to_h outputs the following:
{
}

Request syntax with placeholder values


resp = client.delete_job_queue({
  job_queue: "String", # required
})

Options Hash (options):

  • :job_queue (required, String)

    The short name or full Amazon Resource Name (ARN) of the queue to delete.

Returns:

  • (Struct)

    Returns an empty response.

See Also:

#deregister_job_definition(options = {}) ⇒ Struct

Deregisters an AWS Batch job definition. Job definitions will be permanently deleted after 180 days.

Examples:

Example: To deregister a job definition


# This example deregisters a job definition called sleep10.

resp = client.deregister_job_definition({
  job_definition: "sleep10", 
})

# resp.to_h outputs the following:
{
}

Request syntax with placeholder values


resp = client.deregister_job_definition({
  job_definition: "String", # required
})

Options Hash (options):

  • :job_definition (required, String)

    The name and revision (name:revision) or full Amazon Resource Name (ARN) of the job definition to deregister.

Returns:

  • (Struct)

    Returns an empty response.

See Also:

#describe_compute_environments(options = {}) ⇒ Types::DescribeComputeEnvironmentsResponse

Describes one or more of your compute environments.

If you are using an unmanaged compute environment, you can use the DescribeComputeEnvironment operation to determine the ecsClusterArn that you should launch your Amazon ECS container instances into.

Examples:

Example: To describe a compute environment


# This example describes the P2OnDemand compute environment.

resp = client.describe_compute_environments({
  compute_environments: [
    "P2OnDemand", 
  ], 
})

# resp.to_h outputs the following:
{
  compute_environments: [
    {
      type: "MANAGED", 
      compute_environment_arn: "arn:aws:batch:us-east-1:012345678910:compute-environment/P2OnDemand", 
      compute_environment_name: "P2OnDemand", 
      compute_resources: {
        type: "EC2", 
        desiredv_cpus: 48, 
        ec2_key_pair: "id_rsa", 
        instance_role: "ecsInstanceRole", 
        instance_types: [
          "p2", 
        ], 
        maxv_cpus: 128, 
        minv_cpus: 0, 
        security_group_ids: [
          "sg-cf5093b2", 
        ], 
        subnets: [
          "subnet-220c0e0a", 
          "subnet-1a95556d", 
          "subnet-978f6dce", 
        ], 
        tags: {
          "Name" => "Batch Instance - P2OnDemand", 
        }, 
      }, 
      ecs_cluster_arn: "arn:aws:ecs:us-east-1:012345678910:cluster/P2OnDemand_Batch_2c06f29d-d1fe-3a49-879d-42394c86effc", 
      service_role: "arn:aws:iam::012345678910:role/AWSBatchServiceRole", 
      state: "ENABLED", 
      status: "VALID", 
      status_reason: "ComputeEnvironment Healthy", 
    }, 
  ], 
}

Request syntax with placeholder values


resp = client.describe_compute_environments({
  compute_environments: ["String"],
  max_results: 1,
  next_token: "String",
})

Response structure


resp.compute_environments #=> Array
resp.compute_environments[0].compute_environment_name #=> String
resp.compute_environments[0].compute_environment_arn #=> String
resp.compute_environments[0].ecs_cluster_arn #=> String
resp.compute_environments[0].tags #=> Hash
resp.compute_environments[0].tags["TagKey"] #=> String
resp.compute_environments[0].type #=> String, one of "MANAGED", "UNMANAGED"
resp.compute_environments[0].state #=> String, one of "ENABLED", "DISABLED"
resp.compute_environments[0].status #=> String, one of "CREATING", "UPDATING", "DELETING", "DELETED", "VALID", "INVALID"
resp.compute_environments[0].status_reason #=> String
resp.compute_environments[0].compute_resources.type #=> String, one of "EC2", "SPOT"
resp.compute_environments[0].compute_resources.allocation_strategy #=> String, one of "BEST_FIT", "BEST_FIT_PROGRESSIVE", "SPOT_CAPACITY_OPTIMIZED"
resp.compute_environments[0].compute_resources.minv_cpus #=> Integer
resp.compute_environments[0].compute_resources.maxv_cpus #=> Integer
resp.compute_environments[0].compute_resources.desiredv_cpus #=> Integer
resp.compute_environments[0].compute_resources.instance_types #=> Array
resp.compute_environments[0].compute_resources.instance_types[0] #=> String
resp.compute_environments[0].compute_resources.image_id #=> String
resp.compute_environments[0].compute_resources.subnets #=> Array
resp.compute_environments[0].compute_resources.subnets[0] #=> String
resp.compute_environments[0].compute_resources.security_group_ids #=> Array
resp.compute_environments[0].compute_resources.security_group_ids[0] #=> String
resp.compute_environments[0].compute_resources.ec2_key_pair #=> String
resp.compute_environments[0].compute_resources.instance_role #=> String
resp.compute_environments[0].compute_resources.tags #=> Hash
resp.compute_environments[0].compute_resources.tags["String"] #=> String
resp.compute_environments[0].compute_resources.placement_group #=> String
resp.compute_environments[0].compute_resources.bid_percentage #=> Integer
resp.compute_environments[0].compute_resources.spot_iam_fleet_role #=> String
resp.compute_environments[0].compute_resources.launch_template.launch_template_id #=> String
resp.compute_environments[0].compute_resources.launch_template.launch_template_name #=> String
resp.compute_environments[0].compute_resources.launch_template.version #=> String
resp.compute_environments[0].service_role #=> String
resp.next_token #=> String

Options Hash (options):

  • :compute_environments (Array<String>)

    A list of up to 100 compute environment names or full Amazon Resource Name (ARN) entries.

  • :max_results (Integer)

    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 is not used, then DescribeComputeEnvironments returns up to 100 results and a nextToken value if applicable.

  • :next_token (String)

    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.

    This token should be treated as an opaque identifier that is only used to retrieve the next items in a list and not for other programmatic purposes.

Returns:

See Also:

#describe_job_definitions(options = {}) ⇒ 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.

Examples:

Example: To describe active job definitions


# This example describes all of your active job definitions.

resp = client.describe_job_definitions({
  status: "ACTIVE", 
})

# resp.to_h outputs the following:
{
  job_definitions: [
    {
      type: "container", 
      container_properties: {
        command: [
          "sleep", 
          "60", 
        ], 
        environment: [
        ], 
        image: "busybox", 
        memory: 128, 
        mount_points: [
        ], 
        ulimits: [
        ], 
        vcpus: 1, 
        volumes: [
        ], 
      }, 
      job_definition_arn: "arn:aws:batch:us-east-1:012345678910:job-definition/sleep60:1", 
      job_definition_name: "sleep60", 
      revision: 1, 
      status: "ACTIVE", 
    }, 
  ], 
}

Request syntax with placeholder values


resp = client.describe_job_definitions({
  job_definitions: ["String"],
  max_results: 1,
  job_definition_name: "String",
  status: "String",
  next_token: "String",
})

Response structure


resp.job_definitions #=> Array
resp.job_definitions[0].job_definition_name #=> String
resp.job_definitions[0].job_definition_arn #=> String
resp.job_definitions[0].revision #=> Integer
resp.job_definitions[0].status #=> String
resp.job_definitions[0].type #=> String
resp.job_definitions[0].parameters #=> Hash
resp.job_definitions[0].parameters["String"] #=> String
resp.job_definitions[0].retry_strategy.attempts #=> Integer
resp.job_definitions[0].retry_strategy.evaluate_on_exit #=> Array
resp.job_definitions[0].retry_strategy.evaluate_on_exit[0].on_status_reason #=> String
resp.job_definitions[0].retry_strategy.evaluate_on_exit[0].on_reason #=> String
resp.job_definitions[0].retry_strategy.evaluate_on_exit[0].on_exit_code #=> String
resp.job_definitions[0].retry_strategy.evaluate_on_exit[0].action #=> String, one of "RETRY", "EXIT"
resp.job_definitions[0].container_properties.image #=> String
resp.job_definitions[0].container_properties.vcpus #=> Integer
resp.job_definitions[0].container_properties.memory #=> Integer
resp.job_definitions[0].container_properties.command #=> Array
resp.job_definitions[0].container_properties.command[0] #=> String
resp.job_definitions[0].container_properties.job_role_arn #=> String
resp.job_definitions[0].container_properties.execution_role_arn #=> String
resp.job_definitions[0].container_properties.volumes #=> Array
resp.job_definitions[0].container_properties.volumes[0].host.source_path #=> String
resp.job_definitions[0].container_properties.volumes[0].name #=> String
resp.job_definitions[0].container_properties.environment #=> Array
resp.job_definitions[0].container_properties.environment[0].name #=> String
resp.job_definitions[0].container_properties.environment[0].value #=> String
resp.job_definitions[0].container_properties.mount_points #=> Array
resp.job_definitions[0].container_properties.mount_points[0].container_path #=> String
resp.job_definitions[0].container_properties.mount_points[0].read_only #=> true/false
resp.job_definitions[0].container_properties.mount_points[0].source_volume #=> String
resp.job_definitions[0].container_properties.readonly_root_filesystem #=> true/false
resp.job_definitions[0].container_properties.privileged #=> true/false
resp.job_definitions[0].container_properties.ulimits #=> Array
resp.job_definitions[0].container_properties.ulimits[0].hard_limit #=> Integer
resp.job_definitions[0].container_properties.ulimits[0].name #=> String
resp.job_definitions[0].container_properties.ulimits[0].soft_limit #=> Integer
resp.job_definitions[0].container_properties.user #=> String
resp.job_definitions[0].container_properties.instance_type #=> String
resp.job_definitions[0].container_properties.resource_requirements #=> Array
resp.job_definitions[0].container_properties.resource_requirements[0].value #=> String
resp.job_definitions[0].container_properties.resource_requirements[0].type #=> String, one of "GPU"
resp.job_definitions[0].container_properties.linux_parameters.devices #=> Array
resp.job_definitions[0].container_properties.linux_parameters.devices[0].host_path #=> String
resp.job_definitions[0].container_properties.linux_parameters.devices[0].container_path #=> String
resp.job_definitions[0].container_properties.linux_parameters.devices[0].permissions #=> Array
resp.job_definitions[0].container_properties.linux_parameters.devices[0].permissions[0] #=> String, one of "READ", "WRITE", "MKNOD"
resp.job_definitions[0].container_properties.linux_parameters.init_process_enabled #=> true/false
resp.job_definitions[0].container_properties.linux_parameters.shared_memory_size #=> Integer
resp.job_definitions[0].container_properties.linux_parameters.tmpfs #=> Array
resp.job_definitions[0].container_properties.linux_parameters.tmpfs[0].container_path #=> String
resp.job_definitions[0].container_properties.linux_parameters.tmpfs[0].size #=> Integer
resp.job_definitions[0].container_properties.linux_parameters.tmpfs[0].mount_options #=> Array
resp.job_definitions[0].container_properties.linux_parameters.tmpfs[0].mount_options[0] #=> String
resp.job_definitions[0].container_properties.linux_parameters.max_swap #=> Integer
resp.job_definitions[0].container_properties.linux_parameters.swappiness #=> Integer
resp.job_definitions[0].container_properties.log_configuration.log_driver #=> String, one of "json-file", "syslog", "journald", "gelf", "fluentd", "awslogs", "splunk"
resp.job_definitions[0].container_properties.log_configuration.options #=> Hash
resp.job_definitions[0].container_properties.log_configuration.options["String"] #=> String
resp.job_definitions[0].container_properties.log_configuration.secret_options #=> Array
resp.job_definitions[0].container_properties.log_configuration.secret_options[0].name #=> String
resp.job_definitions[0].container_properties.log_configuration.secret_options[0].value_from #=> String
resp.job_definitions[0].container_properties.secrets #=> Array
resp.job_definitions[0].container_properties.secrets[0].name #=> String
resp.job_definitions[0].container_properties.secrets[0].value_from #=> String
resp.job_definitions[0].timeout.attempt_duration_seconds #=> Integer
resp.job_definitions[0].node_properties.num_nodes #=> Integer
resp.job_definitions[0].node_properties.main_node #=> Integer
resp.job_definitions[0].node_properties.node_range_properties #=> Array
resp.job_definitions[0].node_properties.node_range_properties[0].target_nodes #=> String
resp.job_definitions[0].node_properties.node_range_properties[0].container.image #=> String
resp.job_definitions[0].node_properties.node_range_properties[0].container.vcpus #=> Integer
resp.job_definitions[0].node_properties.node_range_properties[0].container.memory #=> Integer
resp.job_definitions[0].node_properties.node_range_properties[0].container.command #=> Array
resp.job_definitions[0].node_properties.node_range_properties[0].container.command[0] #=> String
resp.job_definitions[0].node_properties.node_range_properties[0].container.job_role_arn #=> String
resp.job_definitions[0].node_properties.node_range_properties[0].container.execution_role_arn #=> String
resp.job_definitions[0].node_properties.node_range_properties[0].container.volumes #=> Array
resp.job_definitions[0].node_properties.node_range_properties[0].container.volumes[0].host.source_path #=> String
resp.job_definitions[0].node_properties.node_range_properties[0].container.volumes[0].name #=> String
resp.job_definitions[0].node_properties.node_range_properties[0].container.environment #=> Array
resp.job_definitions[0].node_properties.node_range_properties[0].container.environment[0].name #=> String
resp.job_definitions[0].node_properties.node_range_properties[0].container.environment[0].value #=> String
resp.job_definitions[0].node_properties.node_range_properties[0].container.mount_points #=> Array
resp.job_definitions[0].node_properties.node_range_properties[0].container.mount_points[0].container_path #=> String
resp.job_definitions[0].node_properties.node_range_properties[0].container.mount_points[0].read_only #=> true/false
resp.job_definitions[0].node_properties.node_range_properties[0].container.mount_points[0].source_volume #=> String
resp.job_definitions[0].node_properties.node_range_properties[0].container.readonly_root_filesystem #=> true/false
resp.job_definitions[0].node_properties.node_range_properties[0].container.privileged #=> true/false
resp.job_definitions[0].node_properties.node_range_properties[0].container.ulimits #=> Array
resp.job_definitions[0].node_properties.node_range_properties[0].container.ulimits[0].hard_limit #=> Integer
resp.job_definitions[0].node_properties.node_range_properties[0].container.ulimits[0].name #=> String
resp.job_definitions[0].node_properties.node_range_properties[0].container.ulimits[0].soft_limit #=> Integer
resp.job_definitions[0].node_properties.node_range_properties[0].container.user #=> String
resp.job_definitions[0].node_properties.node_range_properties[0].container.instance_type #=> String
resp.job_definitions[0].node_properties.node_range_properties[0].container.resource_requirements #=> Array
resp.job_definitions[0].node_properties.node_range_properties[0].container.resource_requirements[0].value #=> String
resp.job_definitions[0].node_properties.node_range_properties[0].container.resource_requirements[0].type #=> String, one of "GPU"
resp.job_definitions[0].node_properties.node_range_properties[0].container.linux_parameters.devices #=> Array
resp.job_definitions[0].node_properties.node_range_properties[0].container.linux_parameters.devices[0].host_path #=> String
resp.job_definitions[0].node_properties.node_range_properties[0].container.linux_parameters.devices[0].container_path #=> String
resp.job_definitions[0].node_properties.node_range_properties[0].container.linux_parameters.devices[0].permissions #=> Array
resp.job_definitions[0].node_properties.node_range_properties[0].container.linux_parameters.devices[0].permissions[0] #=> String, one of "READ", "WRITE", "MKNOD"
resp.job_definitions[0].node_properties.node_range_properties[0].container.linux_parameters.init_process_enabled #=> true/false
resp.job_definitions[0].node_properties.node_range_properties[0].container.linux_parameters.shared_memory_size #=> Integer
resp.job_definitions[0].node_properties.node_range_properties[0].container.linux_parameters.tmpfs #=> Array
resp.job_definitions[0].node_properties.node_range_properties[0].container.linux_parameters.tmpfs[0].container_path #=> String
resp.job_definitions[0].node_properties.node_range_properties[0].container.linux_parameters.tmpfs[0].size #=> Integer
resp.job_definitions[0].node_properties.node_range_properties[0].container.linux_parameters.tmpfs[0].mount_options #=> Array
resp.job_definitions[0].node_properties.node_range_properties[0].container.linux_parameters.tmpfs[0].mount_options[0] #=> String
resp.job_definitions[0].node_properties.node_range_properties[0].container.linux_parameters.max_swap #=> Integer
resp.job_definitions[0].node_properties.node_range_properties[0].container.linux_parameters.swappiness #=> Integer
resp.job_definitions[0].node_properties.node_range_properties[0].container.log_configuration.log_driver #=> String, one of "json-file", "syslog", "journald", "gelf", "fluentd", "awslogs", "splunk"
resp.job_definitions[0].node_properties.node_range_properties[0].container.log_configuration.options #=> Hash
resp.job_definitions[0].node_properties.node_range_properties[0].container.log_configuration.options["String"] #=> String
resp.job_definitions[0].node_properties.node_range_properties[0].container.log_configuration.secret_options #=> Array
resp.job_definitions[0].node_properties.node_range_properties[0].container.log_configuration.secret_options[0].name #=> String
resp.job_definitions[0].node_properties.node_range_properties[0].container.log_configuration.secret_options[0].value_from #=> String
resp.job_definitions[0].node_properties.node_range_properties[0].container.secrets #=> Array
resp.job_definitions[0].node_properties.node_range_properties[0].container.secrets[0].name #=> String
resp.job_definitions[0].node_properties.node_range_properties[0].container.secrets[0].value_from #=> String
resp.job_definitions[0].tags #=> Hash
resp.job_definitions[0].tags["TagKey"] #=> String
resp.next_token #=> String

Options Hash (options):

  • :job_definitions (Array<String>)

    A list of up to 100 job definition names or full Amazon Resource Name (ARN) entries.

  • :max_results (Integer)

    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 along with 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 is not used, then DescribeJobDefinitions returns up to 100 results and a nextToken value if applicable.

  • :job_definition_name (String)

    The name of the job definition to describe.

  • :status (String)

    The status with which to filter job definitions.

  • :next_token (String)

    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.

    This token should be treated as an opaque identifier that is only used to retrieve the next items in a list and not for other programmatic purposes.

Returns:

See Also:

#describe_job_queues(options = {}) ⇒ Types::DescribeJobQueuesResponse

Describes one or more of your job queues.

Examples:

Example: To describe a job queue


# This example describes the HighPriority job queue.

resp = client.describe_job_queues({
  job_queues: [
    "HighPriority", 
  ], 
})

# resp.to_h outputs the following:
{
  job_queues: [
    {
      compute_environment_order: [
        {
          compute_environment: "arn:aws:batch:us-east-1:012345678910:compute-environment/C4OnDemand", 
          order: 1, 
        }, 
      ], 
      job_queue_arn: "arn:aws:batch:us-east-1:012345678910:job-queue/HighPriority", 
      job_queue_name: "HighPriority", 
      priority: 1, 
      state: "ENABLED", 
      status: "VALID", 
      status_reason: "JobQueue Healthy", 
    }, 
  ], 
}

Request syntax with placeholder values


resp = client.describe_job_queues({
  job_queues: ["String"],
  max_results: 1,
  next_token: "String",
})

Response structure


resp.job_queues #=> Array
resp.job_queues[0].job_queue_name #=> String
resp.job_queues[0].job_queue_arn #=> String
resp.job_queues[0].state #=> String, one of "ENABLED", "DISABLED"
resp.job_queues[0].status #=> String, one of "CREATING", "UPDATING", "DELETING", "DELETED", "VALID", "INVALID"
resp.job_queues[0].status_reason #=> String
resp.job_queues[0].priority #=> Integer
resp.job_queues[0].compute_environment_order #=> Array
resp.job_queues[0].compute_environment_order[0].order #=> Integer
resp.job_queues[0].compute_environment_order[0].compute_environment #=> String
resp.job_queues[0].tags #=> Hash
resp.job_queues[0].tags["TagKey"] #=> String
resp.next_token #=> String

Options Hash (options):

  • :job_queues (Array<String>)

    A list of up to 100 queue names or full queue Amazon Resource Name (ARN) entries.

  • :max_results (Integer)

    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 along with 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 is not used, then DescribeJobQueues returns up to 100 results and a nextToken value if applicable.

  • :next_token (String)

    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.

    This token should be treated as an opaque identifier that is only used to retrieve the next items in a list and not for other programmatic purposes.

Returns:

See Also:

#describe_jobs(options = {}) ⇒ Types::DescribeJobsResponse

Describes a list of AWS Batch jobs.

Examples:

Example: To describe a specific job


# This example describes a job with the specified job ID.

resp = client.describe_jobs({
  jobs: [
    "24fa2d7a-64c4-49d2-8b47-f8da4fbde8e9", 
  ], 
})

# resp.to_h outputs the following:
{
  jobs: [
    {
      container: {
        command: [
          "sleep", 
          "60", 
        ], 
        container_instance_arn: "arn:aws:ecs:us-east-1:012345678910:container-instance/5406d7cd-58bd-4b8f-9936-48d7c6b1526c", 
        environment: [
        ], 
        exit_code: 0, 
        image: "busybox", 
        memory: 128, 
        mount_points: [
        ], 
        ulimits: [
        ], 
        vcpus: 1, 
        volumes: [
        ], 
      }, 
      created_at: 1480460782010, 
      depends_on: [
      ], 
      job_definition: "sleep60", 
      job_id: "24fa2d7a-64c4-49d2-8b47-f8da4fbde8e9", 
      job_name: "example", 
      job_queue: "arn:aws:batch:us-east-1:012345678910:job-queue/HighPriority", 
      parameters: {
      }, 
      started_at: 1480460816500, 
      status: "SUCCEEDED", 
      stopped_at: 1480460880699, 
    }, 
  ], 
}

Request syntax with placeholder values


resp = client.describe_jobs({
  jobs: ["String"], # required
})

Response structure


resp.jobs #=> Array
resp.jobs[0].job_arn #=> String
resp.jobs[0].job_name #=> String
resp.jobs[0].job_id #=> String
resp.jobs[0].job_queue #=> String
resp.jobs[0].status #=> String, one of "SUBMITTED", "PENDING", "RUNNABLE", "STARTING", "RUNNING", "SUCCEEDED", "FAILED"
resp.jobs[0].attempts #=> Array
resp.jobs[0].attempts[0].container.container_instance_arn #=> String
resp.jobs[0].attempts[0].container.task_arn #=> String
resp.jobs[0].attempts[0].container.exit_code #=> Integer
resp.jobs[0].attempts[0].container.reason #=> String
resp.jobs[0].attempts[0].container.log_stream_name #=> String
resp.jobs[0].attempts[0].container.network_interfaces #=> Array
resp.jobs[0].attempts[0].container.network_interfaces[0].attachment_id #=> String
resp.jobs[0].attempts[0].container.network_interfaces[0].ipv6_address #=> String
resp.jobs[0].attempts[0].container.network_interfaces[0].private_ipv_4_address #=> String
resp.jobs[0].attempts[0].started_at #=> Integer
resp.jobs[0].attempts[0].stopped_at #=> Integer
resp.jobs[0].attempts[0].status_reason #=> String
resp.jobs[0].status_reason #=> String
resp.jobs[0].created_at #=> Integer
resp.jobs[0].retry_strategy.attempts #=> Integer
resp.jobs[0].retry_strategy.evaluate_on_exit #=> Array
resp.jobs[0].retry_strategy.evaluate_on_exit[0].on_status_reason #=> String
resp.jobs[0].retry_strategy.evaluate_on_exit[0].on_reason #=> String
resp.jobs[0].retry_strategy.evaluate_on_exit[0].on_exit_code #=> String
resp.jobs[0].retry_strategy.evaluate_on_exit[0].action #=> String, one of "RETRY", "EXIT"
resp.jobs[0].started_at #=> Integer
resp.jobs[0].stopped_at #=> Integer
resp.jobs[0].depends_on #=> Array
resp.jobs[0].depends_on[0].job_id #=> String
resp.jobs[0].depends_on[0].type #=> String, one of "N_TO_N", "SEQUENTIAL"
resp.jobs[0].job_definition #=> String
resp.jobs[0].parameters #=> Hash
resp.jobs[0].parameters["String"] #=> String
resp.jobs[0].container.image #=> String
resp.jobs[0].container.vcpus #=> Integer
resp.jobs[0].container.memory #=> Integer
resp.jobs[0].container.command #=> Array
resp.jobs[0].container.command[0] #=> String
resp.jobs[0].container.job_role_arn #=> String
resp.jobs[0].container.execution_role_arn #=> String
resp.jobs[0].container.volumes #=> Array
resp.jobs[0].container.volumes[0].host.source_path #=> String
resp.jobs[0].container.volumes[0].name #=> String
resp.jobs[0].container.environment #=> Array
resp.jobs[0].container.environment[0].name #=> String
resp.jobs[0].container.environment[0].value #=> String
resp.jobs[0].container.mount_points #=> Array
resp.jobs[0].container.mount_points[0].container_path #=> String
resp.jobs[0].container.mount_points[0].read_only #=> true/false
resp.jobs[0].container.mount_points[0].source_volume #=> String
resp.jobs[0].container.readonly_root_filesystem #=> true/false
resp.jobs[0].container.ulimits #=> Array
resp.jobs[0].container.ulimits[0].hard_limit #=> Integer
resp.jobs[0].container.ulimits[0].name #=> String
resp.jobs[0].container.ulimits[0].soft_limit #=> Integer
resp.jobs[0].container.privileged #=> true/false
resp.jobs[0].container.user #=> String
resp.jobs[0].container.exit_code #=> Integer
resp.jobs[0].container.reason #=> String
resp.jobs[0].container.container_instance_arn #=> String
resp.jobs[0].container.task_arn #=> String
resp.jobs[0].container.log_stream_name #=> String
resp.jobs[0].container.instance_type #=> String
resp.jobs[0].container.network_interfaces #=> Array
resp.jobs[0].container.network_interfaces[0].attachment_id #=> String
resp.jobs[0].container.network_interfaces[0].ipv6_address #=> String
resp.jobs[0].container.network_interfaces[0].private_ipv_4_address #=> String
resp.jobs[0].container.resource_requirements #=> Array
resp.jobs[0].container.resource_requirements[0].value #=> String
resp.jobs[0].container.resource_requirements[0].type #=> String, one of "GPU"
resp.jobs[0].container.linux_parameters.devices #=> Array
resp.jobs[0].container.linux_parameters.devices[0].host_path #=> String
resp.jobs[0].container.linux_parameters.devices[0].container_path #=> String
resp.jobs[0].container.linux_parameters.devices[0].permissions #=> Array
resp.jobs[0].container.linux_parameters.devices[0].permissions[0] #=> String, one of "READ", "WRITE", "MKNOD"
resp.jobs[0].container.linux_parameters.init_process_enabled #=> true/false
resp.jobs[0].container.linux_parameters.shared_memory_size #=> Integer
resp.jobs[0].container.linux_parameters.tmpfs #=> Array
resp.jobs[0].container.linux_parameters.tmpfs[0].container_path #=> String
resp.jobs[0].container.linux_parameters.tmpfs[0].size #=> Integer
resp.jobs[0].container.linux_parameters.tmpfs[0].mount_options #=> Array
resp.jobs[0].container.linux_parameters.tmpfs[0].mount_options[0] #=> String
resp.jobs[0].container.linux_parameters.max_swap #=> Integer
resp.jobs[0].container.linux_parameters.swappiness #=> Integer
resp.jobs[0].container.log_configuration.log_driver #=> String, one of "json-file", "syslog", "journald", "gelf", "fluentd", "awslogs", "splunk"
resp.jobs[0].container.log_configuration.options #=> Hash
resp.jobs[0].container.log_configuration.options["String"] #=> String
resp.jobs[0].container.log_configuration.secret_options #=> Array
resp.jobs[0].container.log_configuration.secret_options[0].name #=> String
resp.jobs[0].container.log_configuration.secret_options[0].value_from #=> String
resp.jobs[0].container.secrets #=> Array
resp.jobs[0].container.secrets[0].name #=> String
resp.jobs[0].container.secrets[0].value_from #=> String
resp.jobs[0].node_details.node_index #=> Integer
resp.jobs[0].node_details.is_main_node #=> true/false
resp.jobs[0].node_properties.num_nodes #=> Integer
resp.jobs[0].node_properties.main_node #=> Integer
resp.jobs[0].node_properties.node_range_properties #=> Array
resp.jobs[0].node_properties.node_range_properties[0].target_nodes #=> String
resp.jobs[0].node_properties.node_range_properties[0].container.image #=> String
resp.jobs[0].node_properties.node_range_properties[0].container.vcpus #=> Integer
resp.jobs[0].node_properties.node_range_properties[0].container.memory #=> Integer
resp.jobs[0].node_properties.node_range_properties[0].container.command #=> Array
resp.jobs[0].node_properties.node_range_properties[0].container.command[0] #=> String
resp.jobs[0].node_properties.node_range_properties[0].container.job_role_arn #=> String
resp.jobs[0].node_properties.node_range_properties[0].container.execution_role_arn #=> String
resp.jobs[0].node_properties.node_range_properties[0].container.volumes #=> Array
resp.jobs[0].node_properties.node_range_properties[0].container.volumes[0].host.source_path #=> String
resp.jobs[0].node_properties.node_range_properties[0].container.volumes[0].name #=> String
resp.jobs[0].node_properties.node_range_properties[0].container.environment #=> Array
resp.jobs[0].node_properties.node_range_properties[0].container.environment[0].name #=> String
resp.jobs[0].node_properties.node_range_properties[0].container.environment[0].value #=> String
resp.jobs[0].node_properties.node_range_properties[0].container.mount_points #=> Array
resp.jobs[0].node_properties.node_range_properties[0].container.mount_points[0].container_path #=> String
resp.jobs[0].node_properties.node_range_properties[0].container.mount_points[0].read_only #=> true/false
resp.jobs[0].node_properties.node_range_properties[0].container.mount_points[0].source_volume #=> String
resp.jobs[0].node_properties.node_range_properties[0].container.readonly_root_filesystem #=> true/false
resp.jobs[0].node_properties.node_range_properties[0].container.privileged #=> true/false
resp.jobs[0].node_properties.node_range_properties[0].container.ulimits #=> Array
resp.jobs[0].node_properties.node_range_properties[0].container.ulimits[0].hard_limit #=> Integer
resp.jobs[0].node_properties.node_range_properties[0].container.ulimits[0].name #=> String
resp.jobs[0].node_properties.node_range_properties[0].container.ulimits[0].soft_limit #=> Integer
resp.jobs[0].node_properties.node_range_properties[0].container.user #=> String
resp.jobs[0].node_properties.node_range_properties[0].container.instance_type #=> String
resp.jobs[0].node_properties.node_range_properties[0].container.resource_requirements #=> Array
resp.jobs[0].node_properties.node_range_properties[0].container.resource_requirements[0].value #=> String
resp.jobs[0].node_properties.node_range_properties[0].container.resource_requirements[0].type #=> String, one of "GPU"
resp.jobs[0].node_properties.node_range_properties[0].container.linux_parameters.devices #=> Array
resp.jobs[0].node_properties.node_range_properties[0].container.linux_parameters.devices[0].host_path #=> String
resp.jobs[0].node_properties.node_range_properties[0].container.linux_parameters.devices[0].container_path #=> String
resp.jobs[0].node_properties.node_range_properties[0].container.linux_parameters.devices[0].permissions #=> Array
resp.jobs[0].node_properties.node_range_properties[0].container.linux_parameters.devices[0].permissions[0] #=> String, one of "READ", "WRITE", "MKNOD"
resp.jobs[0].node_properties.node_range_properties[0].container.linux_parameters.init_process_enabled #=> true/false
resp.jobs[0].node_properties.node_range_properties[0].container.linux_parameters.shared_memory_size #=> Integer
resp.jobs[0].node_properties.node_range_properties[0].container.linux_parameters.tmpfs #=> Array
resp.jobs[0].node_properties.node_range_properties[0].container.linux_parameters.tmpfs[0].container_path #=> String
resp.jobs[0].node_properties.node_range_properties[0].container.linux_parameters.tmpfs[0].size #=> Integer
resp.jobs[0].node_properties.node_range_properties[0].container.linux_parameters.tmpfs[0].mount_options #=> Array
resp.jobs[0].node_properties.node_range_properties[0].container.linux_parameters.tmpfs[0].mount_options[0] #=> String
resp.jobs[0].node_properties.node_range_properties[0].container.linux_parameters.max_swap #=> Integer
resp.jobs[0].node_properties.node_range_properties[0].container.linux_parameters.swappiness #=> Integer
resp.jobs[0].node_properties.node_range_properties[0].container.log_configuration.log_driver #=> String, one of "json-file", "syslog", "journald", "gelf", "fluentd", "awslogs", "splunk"
resp.jobs[0].node_properties.node_range_properties[0].container.log_configuration.options #=> Hash
resp.jobs[0].node_properties.node_range_properties[0].container.log_configuration.options["String"] #=> String
resp.jobs[0].node_properties.node_range_properties[0].container.log_configuration.secret_options #=> Array
resp.jobs[0].node_properties.node_range_properties[0].container.log_configuration.secret_options[0].name #=> String
resp.jobs[0].node_properties.node_range_properties[0].container.log_configuration.secret_options[0].value_from #=> String
resp.jobs[0].node_properties.node_range_properties[0].container.secrets #=> Array
resp.jobs[0].node_properties.node_range_properties[0].container.secrets[0].name #=> String
resp.jobs[0].node_properties.node_range_properties[0].container.secrets[0].value_from #=> String
resp.jobs[0].array_properties.status_summary #=> Hash
resp.jobs[0].array_properties.status_summary["String"] #=> Integer
resp.jobs[0].array_properties.size #=> Integer
resp.jobs[0].array_properties.index #=> Integer
resp.jobs[0].timeout.attempt_duration_seconds #=> Integer
resp.jobs[0].tags #=> Hash
resp.jobs[0].tags["TagKey"] #=> String

Options Hash (options):

  • :jobs (required, Array<String>)

    A list of up to 100 job IDs.

Returns:

See Also:

#list_jobs(options = {}) ⇒ Types::ListJobsResponse

Returns a list of AWS Batch jobs.

You must specify only one of the following:

  • 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 that job's nodes

  • an array job ID to return a list of that job's children

You can filter the results by job status with the jobStatus parameter. If you do not specify a status, only RUNNING jobs are returned.

Examples:

Example: To list running jobs


# This example lists the running jobs in the HighPriority job queue.

resp = client.list_jobs({
  job_queue: "HighPriority", 
})

# resp.to_h outputs the following:
{
  job_summary_list: [
    {
      job_id: "e66ff5fd-a1ff-4640-b1a2-0b0a142f49bb", 
      job_name: "example", 
    }, 
  ], 
}

Example: To list submitted jobs


# This example lists jobs in the HighPriority job queue that are in the SUBMITTED job status.

resp = client.list_jobs({
  job_queue: "HighPriority", 
  job_status: "SUBMITTED", 
})

# resp.to_h outputs the following:
{
  job_summary_list: [
    {
      job_id: "68f0c163-fbd4-44e6-9fd1-25b14a434786", 
      job_name: "example", 
    }, 
  ], 
}

Request syntax with placeholder values


resp = client.list_jobs({
  job_queue: "String",
  array_job_id: "String",
  multi_node_job_id: "String",
  job_status: "SUBMITTED", # accepts SUBMITTED, PENDING, RUNNABLE, STARTING, RUNNING, SUCCEEDED, FAILED
  max_results: 1,
  next_token: "String",
})

Response structure


resp.job_summary_list #=> Array
resp.job_summary_list[0].job_arn #=> String
resp.job_summary_list[0].job_id #=> String
resp.job_summary_list[0].job_name #=> String
resp.job_summary_list[0].created_at #=> Integer
resp.job_summary_list[0].status #=> String, one of "SUBMITTED", "PENDING", "RUNNABLE", "STARTING", "RUNNING", "SUCCEEDED", "FAILED"
resp.job_summary_list[0].status_reason #=> String
resp.job_summary_list[0].started_at #=> Integer
resp.job_summary_list[0].stopped_at #=> Integer
resp.job_summary_list[0].container.exit_code #=> Integer
resp.job_summary_list[0].container.reason #=> String
resp.job_summary_list[0].array_properties.size #=> Integer
resp.job_summary_list[0].array_properties.index #=> Integer
resp.job_summary_list[0].node_properties.is_main_node #=> true/false
resp.job_summary_list[0].node_properties.num_nodes #=> Integer
resp.job_summary_list[0].node_properties.node_index #=> Integer
resp.next_token #=> String

Options Hash (options):

  • :job_queue (String)

    The name or full Amazon Resource Name (ARN) of the job queue with which to list jobs.

  • :array_job_id (String)

    The job ID for an array job. Specifying an array job ID with this parameter lists all child jobs from within the specified array.

  • :multi_node_job_id (String)

    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.

  • :job_status (String)

    The job status with which to filter jobs in the specified queue. If you do not specify a status, only RUNNING jobs are returned.

  • :max_results (Integer)

    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 along with 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 is not used, then ListJobs returns up to 100 results and a nextToken value if applicable.

  • :next_token (String)

    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.

    This token should be treated as an opaque identifier that is only used to retrieve the next items in a list and not for other programmatic purposes.

Returns:

See Also:

#list_tags_for_resource(options = {}) ⇒ Types::ListTagsForResourceResponse

List the tags for an AWS Batch resource. AWS Batch resources that support tags are compute environments, jobs, job definitions, and job queues. ARNs for child jobs of array and multi-node parallel (MNP) jobs are not supported.

Examples:

Example: ListTagsForResource Example


# This demonstrates calling the ListTagsForResource action.

resp = client.list_tags_for_resource({
  resource_arn: "arn:aws:batch:us-east-1:123456789012:job-definition/sleep30:1", 
})

# resp.to_h outputs the following:
{
  tags: {
    "Department" => "Engineering", 
    "Stage" => "Alpha", 
    "User" => "JaneDoe", 
  }, 
}

Request syntax with placeholder values


resp = client.list_tags_for_resource({
  resource_arn: "String", # required
})

Response structure


resp.tags #=> Hash
resp.tags["TagKey"] #=> String

Options Hash (options):

  • :resource_arn (required, String)

    The Amazon Resource Name (ARN) that identifies the resource for which to list the tags. AWS Batch resources that support tags are compute environments, jobs, job definitions, and job queues. ARNs for child jobs of array and multi-node parallel (MNP) jobs are not supported.

Returns:

See Also:

#register_job_definition(options = {}) ⇒ Types::RegisterJobDefinitionResponse

Registers an AWS Batch job definition.

Examples:

Example: To register a job definition


# This example registers a job definition for a simple container job.

resp = client.register_job_definition({
  type: "container", 
  container_properties: {
    command: [
      "sleep", 
      "10", 
    ], 
    image: "busybox", 
    memory: 128, 
    vcpus: 1, 
  }, 
  job_definition_name: "sleep10", 
})

# resp.to_h outputs the following:
{
  job_definition_arn: "arn:aws:batch:us-east-1:012345678910:job-definition/sleep10:1", 
  job_definition_name: "sleep10", 
  revision: 1, 
}

Example: RegisterJobDefinition with tags


# This demonstrates calling the RegisterJobDefinition action, including tags.

resp = client.register_job_definition({
  type: "container", 
  container_properties: {
    command: [
      "sleep", 
      "30", 
    ], 
    image: "busybox", 
    memory: 128, 
    vcpus: 1, 
  }, 
  job_definition_name: "sleep30", 
  tags: {
    "Department" => "Engineering", 
    "User" => "JaneDoe", 
  }, 
})

# resp.to_h outputs the following:
{
  job_definition_arn: "arn:aws:batch:us-east-1:012345678910:job-definition/sleep30:1", 
  job_definition_name: "sleep30", 
  revision: 1, 
}

Request syntax with placeholder values


resp = client.register_job_definition({
  job_definition_name: "String", # required
  type: "container", # required, accepts container, multinode
  parameters: {
    "String" => "String",
  },
  container_properties: {
    image: "String",
    vcpus: 1,
    memory: 1,
    command: ["String"],
    job_role_arn: "String",
    execution_role_arn: "String",
    volumes: [
      {
        host: {
          source_path: "String",
        },
        name: "String",
      },
    ],
    environment: [
      {
        name: "String",
        value: "String",
      },
    ],
    mount_points: [
      {
        container_path: "String",
        read_only: false,
        source_volume: "String",
      },
    ],
    readonly_root_filesystem: false,
    privileged: false,
    ulimits: [
      {
        hard_limit: 1, # required
        name: "String", # required
        soft_limit: 1, # required
      },
    ],
    user: "String",
    instance_type: "String",
    resource_requirements: [
      {
        value: "String", # required
        type: "GPU", # required, accepts GPU
      },
    ],
    linux_parameters: {
      devices: [
        {
          host_path: "String", # required
          container_path: "String",
          permissions: ["READ"], # accepts READ, WRITE, MKNOD
        },
      ],
      init_process_enabled: false,
      shared_memory_size: 1,
      tmpfs: [
        {
          container_path: "String", # required
          size: 1, # required
          mount_options: ["String"],
        },
      ],
      max_swap: 1,
      swappiness: 1,
    },
    log_configuration: {
      log_driver: "json-file", # required, accepts json-file, syslog, journald, gelf, fluentd, awslogs, splunk
      options: {
        "String" => "String",
      },
      secret_options: [
        {
          name: "String", # required
          value_from: "String", # required
        },
      ],
    },
    secrets: [
      {
        name: "String", # required
        value_from: "String", # required
      },
    ],
  },
  node_properties: {
    num_nodes: 1, # required
    main_node: 1, # required
    node_range_properties: [ # required
      {
        target_nodes: "String", # required
        container: {
          image: "String",
          vcpus: 1,
          memory: 1,
          command: ["String"],
          job_role_arn: "String",
          execution_role_arn: "String",
          volumes: [
            {
              host: {
                source_path: "String",
              },
              name: "String",
            },
          ],
          environment: [
            {
              name: "String",
              value: "String",
            },
          ],
          mount_points: [
            {
              container_path: "String",
              read_only: false,
              source_volume: "String",
            },
          ],
          readonly_root_filesystem: false,
          privileged: false,
          ulimits: [
            {
              hard_limit: 1, # required
              name: "String", # required
              soft_limit: 1, # required
            },
          ],
          user: "String",
          instance_type: "String",
          resource_requirements: [
            {
              value: "String", # required
              type: "GPU", # required, accepts GPU
            },
          ],
          linux_parameters: {
            devices: [
              {
                host_path: "String", # required
                container_path: "String",
                permissions: ["READ"], # accepts READ, WRITE, MKNOD
              },
            ],
            init_process_enabled: false,
            shared_memory_size: 1,
            tmpfs: [
              {
                container_path: "String", # required
                size: 1, # required
                mount_options: ["String"],
              },
            ],
            max_swap: 1,
            swappiness: 1,
          },
          log_configuration: {
            log_driver: "json-file", # required, accepts json-file, syslog, journald, gelf, fluentd, awslogs, splunk
            options: {
              "String" => "String",
            },
            secret_options: [
              {
                name: "String", # required
                value_from: "String", # required
              },
            ],
          },
          secrets: [
            {
              name: "String", # required
              value_from: "String", # required
            },
          ],
        },
      },
    ],
  },
  retry_strategy: {
    attempts: 1,
    evaluate_on_exit: [
      {
        on_status_reason: "String",
        on_reason: "String",
        on_exit_code: "String",
        action: "RETRY", # required, accepts RETRY, EXIT
      },
    ],
  },
  timeout: {
    attempt_duration_seconds: 1,
  },
  tags: {
    "TagKey" => "TagValue",
  },
})

Response structure


resp.job_definition_name #=> String
resp.job_definition_arn #=> String
resp.revision #=> Integer

Options Hash (options):

  • :job_definition_name (required, String)

    The name of the job definition to register. Up to 128 letters (uppercase and lowercase), numbers, hyphens, and underscores are allowed.

  • :type (required, String)

    The type of job definition.

  • :parameters (Hash<String,String>)

    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.

  • :container_properties (Types::ContainerProperties)

    An object with various properties specific to single-node container-based jobs. If the job definition\'s type parameter is container, then you must specify either containerProperties or nodeProperties.

  • :node_properties (Types::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 AWS Batch User Guide. If the job definition\'s type parameter is container, then you must specify either containerProperties or nodeProperties.

  • :retry_strategy (Types::RetryStrategy)

    The retry strategy to use for failed jobs that are submitted with this job definition. Any retry strategy that is specified during a SubmitJob operation overrides the retry strategy defined here. If a job is terminated due to a timeout, it is not retried.

  • :timeout (Types::JobTimeout)

    The timeout configuration for jobs that are submitted with this job definition, after which AWS Batch terminates your jobs if they have not finished. If a job is terminated due to a timeout, it is not retried. The minimum value for the timeout is 60 seconds. Any timeout configuration that is specified during a SubmitJob operation overrides the timeout configuration defined here. For more information, see Job Timeouts in the Amazon Elastic Container Service Developer Guide.

  • :tags (Hash<String,String>)

    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 AWS Resources in AWS General Reference.

Returns:

See Also:

#submit_job(options = {}) ⇒ Types::SubmitJobResponse

Submits an AWS Batch job from a job definition. Parameters specified during SubmitJob override parameters defined in the job definition.

Examples:

Example: To submit a job to a queue


# This example submits a simple container job called example to the HighPriority job queue.

resp = client.submit_job({
  job_definition: "sleep60", 
  job_name: "example", 
  job_queue: "HighPriority", 
})

# resp.to_h outputs the following:
{
  job_id: "876da822-4198-45f2-a252-6cea32512ea8", 
  job_name: "example", 
}

Request syntax with placeholder values


resp = client.submit_job({
  job_name: "String", # required
  job_queue: "String", # required
  array_properties: {
    size: 1,
  },
  depends_on: [
    {
      job_id: "String",
      type: "N_TO_N", # accepts N_TO_N, SEQUENTIAL
    },
  ],
  job_definition: "String", # required
  parameters: {
    "String" => "String",
  },
  container_overrides: {
    vcpus: 1,
    memory: 1,
    command: ["String"],
    instance_type: "String",
    environment: [
      {
        name: "String",
        value: "String",
      },
    ],
    resource_requirements: [
      {
        value: "String", # required
        type: "GPU", # required, accepts GPU
      },
    ],
  },
  node_overrides: {
    num_nodes: 1,
    node_property_overrides: [
      {
        target_nodes: "String", # required
        container_overrides: {
          vcpus: 1,
          memory: 1,
          command: ["String"],
          instance_type: "String",
          environment: [
            {
              name: "String",
              value: "String",
            },
          ],
          resource_requirements: [
            {
              value: "String", # required
              type: "GPU", # required, accepts GPU
            },
          ],
        },
      },
    ],
  },
  retry_strategy: {
    attempts: 1,
    evaluate_on_exit: [
      {
        on_status_reason: "String",
        on_reason: "String",
        on_exit_code: "String",
        action: "RETRY", # required, accepts RETRY, EXIT
      },
    ],
  },
  timeout: {
    attempt_duration_seconds: 1,
  },
  tags: {
    "TagKey" => "TagValue",
  },
})

Response structure


resp.job_arn #=> String
resp.job_name #=> String
resp.job_id #=> String

Options Hash (options):

  • :job_name (required, String)

    The name of the job. The first character must be alphanumeric, and up to 128 letters (uppercase and lowercase), numbers, hyphens, and underscores are allowed.

  • :job_queue (required, String)

    The job queue into which the job is submitted. You can specify either the name or the Amazon Resource Name (ARN) of the queue.

  • :array_properties (Types::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 AWS Batch User Guide.

  • :depends_on (Array<Types::JobDependency>)

    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.

  • :job_definition (required, String)

    The job definition used by this job. This value can be one of name, name:revision, or the Amazon Resource Name (ARN) for the job definition. If name is specified without a revision then the latest active revision is used.

  • :parameters (Hash<String,String>)

    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.

  • :container_overrides (Types::ContainerOverrides)

    A list of container overrides in JSON format 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 (that is specified in the job definition or the Docker image) with a command override. You can also override existing environment variables (that are specified in the job definition or Docker image) on a container or add new environment variables to it with an environment override.

  • :node_overrides (Types::NodeOverrides)

    A list of node overrides in JSON format that specify the node range to target and the container overrides for that node range.

  • :retry_strategy (Types::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.

  • :timeout (Types::JobTimeout)

    The timeout configuration for this SubmitJob operation. You can specify a timeout duration after which AWS Batch terminates your jobs if they have not finished. If a job is terminated due to a timeout, it is not retried. The minimum value for the timeout is 60 seconds. This configuration overrides any timeout configuration specified in the job definition. For array jobs, child jobs have the same timeout configuration as the parent job. For more information, see Job Timeouts in the Amazon Elastic Container Service Developer Guide.

  • :tags (Hash<String,String>)

    The tags that you apply to the job request to help you categorize and organize your resources. Each tag consists of a key and an optional value. For more information, see Tagging AWS Resources in AWS General Reference.

Returns:

See Also:

#tag_resource(options = {}) ⇒ Struct

Associates the specified tags to a resource with the specified resourceArn. If existing tags on a resource are not specified in the request parameters, they are not changed. When a resource is deleted, the tags associated with that resource are deleted as well. AWS Batch resources that support tags are compute environments, jobs, job definitions, and job queues. ARNs for child jobs of array and multi-node parallel (MNP) jobs are not supported.

Examples:

Example: TagResource Example


# This demonstrates calling the TagResource action.

resp = client.tag_resource({
  resource_arn: "arn:aws:batch:us-east-1:123456789012:job-definition/sleep30:1", 
  tags: {
    "Stage" => "Alpha", 
  }, 
})

# resp.to_h outputs the following:
{
}

Request syntax with placeholder values


resp = client.tag_resource({
  resource_arn: "String", # required
  tags: { # required
    "TagKey" => "TagValue",
  },
})

Options Hash (options):

  • :resource_arn (required, String)

    The Amazon Resource Name (ARN) of the resource to which to add tags. AWS Batch resources that support tags are compute environments, jobs, job definitions, and job queues. ARNs for child jobs of array and multi-node parallel (MNP) jobs are not supported.

  • :tags (required, Hash<String,String>)

    The tags that you apply to the resource to help you categorize and organize your resources. Each tag consists of a key and an optional value. For more information, see Tagging AWS Resources in AWS General Reference.

Returns:

  • (Struct)

    Returns an empty response.

See Also:

#terminate_job(options = {}) ⇒ 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.

Examples:

Example: To terminate a job


# This example terminates a job with the specified job ID.

resp = client.terminate_job({
  job_id: "61e743ed-35e4-48da-b2de-5c8333821c84", 
  reason: "Terminating job.", 
})

# resp.to_h outputs the following:
{
}

Request syntax with placeholder values


resp = client.terminate_job({
  job_id: "String", # required
  reason: "String", # required
})

Options Hash (options):

  • :job_id (required, String)

    The AWS Batch job ID of the job to terminate.

  • :reason (required, String)

    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 AWS Batch activity logs.

Returns:

  • (Struct)

    Returns an empty response.

See Also:

#untag_resource(options = {}) ⇒ Struct

Deletes specified tags from an AWS Batch resource.

Examples:

Example: UntagResource Example


# This demonstrates calling the UntagResource action.

resp = client.untag_resource({
  resource_arn: "arn:aws:batch:us-east-1:123456789012:job-definition/sleep30:1", 
  tag_keys: [
    "Stage", 
  ], 
})

# resp.to_h outputs the following:
{
}

Request syntax with placeholder values


resp = client.untag_resource({
  resource_arn: "String", # required
  tag_keys: ["TagKey"], # required
})

Options Hash (options):

  • :resource_arn (required, String)

    The Amazon Resource Name (ARN) of the resource from which to delete tags. AWS Batch resources that support tags are compute environments, jobs, job definitions, and job queues. ARNs for child jobs of array and multi-node parallel (MNP) jobs are not supported.

  • :tag_keys (required, Array<String>)

    The keys of the tags to be removed.

Returns:

  • (Struct)

    Returns an empty response.

See Also:

#update_compute_environment(options = {}) ⇒ Types::UpdateComputeEnvironmentResponse

Updates an AWS Batch compute environment.

Examples:

Example: To update a compute environment


# This example disables the P2OnDemand compute environment so it can be deleted.

resp = client.update_compute_environment({
  compute_environment: "P2OnDemand", 
  state: "DISABLED", 
})

# resp.to_h outputs the following:
{
  compute_environment_arn: "arn:aws:batch:us-east-1:012345678910:compute-environment/P2OnDemand", 
  compute_environment_name: "P2OnDemand", 
}

Request syntax with placeholder values


resp = client.update_compute_environment({
  compute_environment: "String", # required
  state: "ENABLED", # accepts ENABLED, DISABLED
  compute_resources: {
    minv_cpus: 1,
    maxv_cpus: 1,
    desiredv_cpus: 1,
  },
  service_role: "String",
})

Response structure


resp.compute_environment_name #=> String
resp.compute_environment_arn #=> String

Options Hash (options):

  • :compute_environment (required, String)

    The name or full Amazon Resource Name (ARN) of the compute environment to update.

  • :state (String)

    The state of the compute environment. Compute environments in the ENABLED state can accept jobs from a queue and scale in or out automatically based on the workload demand of its associated queues.

  • :compute_resources (Types::ComputeResourceUpdate)

    Details of the compute resources managed by the compute environment. Required for a managed compute environment.

  • :service_role (String)

    The full Amazon Resource Name (ARN) of the IAM role that allows AWS Batch to make calls to other AWS services on your behalf.

    If your specified role has a path other than /, then you must either specify the full role ARN (this is recommended) or prefix the role name with the path.

    Depending on how you created your AWS Batch service role, its ARN may contain the service-role path prefix. When you only specify the name of the service role, AWS Batch assumes that your ARN does not 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.

Returns:

See Also:

#update_job_queue(options = {}) ⇒ Types::UpdateJobQueueResponse

Updates a job queue.

Examples:

Example: To update a job queue


# This example disables a job queue so that it can be deleted.

resp = client.update_job_queue({
  job_queue: "GPGPU", 
  state: "DISABLED", 
})

# resp.to_h outputs the following:
{
  job_queue_arn: "arn:aws:batch:us-east-1:012345678910:job-queue/GPGPU", 
  job_queue_name: "GPGPU", 
}

Request syntax with placeholder values


resp = client.update_job_queue({
  job_queue: "String", # required
  state: "ENABLED", # accepts ENABLED, DISABLED
  priority: 1,
  compute_environment_order: [
    {
      order: 1, # required
      compute_environment: "String", # required
    },
  ],
})

Response structure


resp.job_queue_name #=> String
resp.job_queue_arn #=> String

Options Hash (options):

  • :job_queue (required, String)

    The name or the Amazon Resource Name (ARN) of the job queue.

  • :state (String)

    Describes the queue\'s ability to accept new jobs. If the job queue state is ENABLED, it is able to accept jobs. If the job queue state is DISABLED, new jobs cannot be added to the queue, but jobs already in the queue can finish.

  • :priority (Integer)

    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.

  • :compute_environment_order (Array<Types::ComputeEnvironmentOrder>)

    Details the set of compute environments mapped to a job queue and their order relative to each other. This is one of the parameters used by the job scheduler to determine which compute environment should execute a given job.

Returns:

See Also:

#wait_until(waiter_name, params = {}) {|waiter| ... } ⇒ Boolean

Waiters polls an API operation until a resource enters a desired state.

Basic Usage

Waiters will poll until they are succesful, they fail by entering a terminal state, or until a maximum number of attempts are made.

# polls in a loop, sleeping between attempts client.waiter_until(waiter_name, params)

Configuration

You can configure the maximum number of polling attempts, and the delay (in seconds) between each polling attempt. You configure waiters by passing a block to #wait_until:

# poll for ~25 seconds
client.wait_until(...) do |w|
  w.max_attempts = 5
  w.delay = 5
end

Callbacks

You can be notified before each polling attempt and before each delay. If you throw :success or :failure from these callbacks, it will terminate the waiter.

started_at = Time.now
client.wait_until(...) do |w|

  # disable max attempts
  w.max_attempts = nil

  # poll for 1 hour, instead of a number of attempts
  w.before_wait do |attempts, response|
    throw :failure if Time.now - started_at > 3600
  end

end

Handling Errors

When a waiter is successful, it returns true. When a waiter fails, it raises an error. All errors raised extend from Waiters::Errors::WaiterFailed.

begin
  client.wait_until(...)
rescue Aws::Waiters::Errors::WaiterFailed
  # resource did not enter the desired state in time
end

Parameters:

  • waiter_name (Symbol)

    The name of the waiter. See #waiter_names for a full list of supported waiters.

  • params (Hash) (defaults to: {})

    Additional request parameters. See the #waiter_names for a list of supported waiters and what request they call. The called request determines the list of accepted parameters.

Yield Parameters:

Returns:

  • (Boolean)

    Returns true if the waiter was successful.

Raises:

  • (Errors::FailureStateError)

    Raised when the waiter terminates because the waiter has entered a state that it will not transition out of, preventing success.

  • (Errors::TooManyAttemptsError)

    Raised when the configured maximum number of attempts have been made, and the waiter is not yet successful.

  • (Errors::UnexpectedError)

    Raised when an error is encounted while polling for a resource that is not expected.

  • (Errors::NoSuchWaiterError)

    Raised when you request to wait for an unknown state.

#waiter_namesArray<Symbol>

Returns the list of supported waiters. The following table lists the supported waiters and the client method they call:

Waiter NameClient MethodDefault Delay:Default Max Attempts:

Returns:

  • (Array<Symbol>)

    the list of supported waiters.