AWS Batch

2025/07/29 - AWS Batch - 8 new3 updated api methods

Changes  AWS Batch for SageMaker Training jobs feature support. Includes new APIs for service job submission (e.g., SubmitServiceJob) and managing service environments (e.g., CreateServiceEnvironment) that enable queueing SageMaker Training jobs.

DeleteServiceEnvironment (new) Link ¶

Deletes a Service environment. Before you can delete a service environment, you must first set its state to DISABLED with the UpdateServiceEnvironment API operation and disassociate it from any job queues with the UpdateJobQueue API operation.

See also: AWS API Documentation

Request Syntax

client.delete_service_environment(
    serviceEnvironment='string'
)
type serviceEnvironment:

string

param serviceEnvironment:

[REQUIRED]

The name or ARN of the service environment to delete.

rtype:

dict

returns:

Response Syntax

{}

Response Structure

  • (dict) --

DescribeServiceEnvironments (new) Link ¶

Describes one or more of your service environments.

See also: AWS API Documentation

Request Syntax

client.describe_service_environments(
    serviceEnvironments=[
        'string',
    ],
    maxResults=123,
    nextToken='string'
)
type serviceEnvironments:

list

param serviceEnvironments:

An array of service environment names or ARN entries.

  • (string) --

type maxResults:

integer

param maxResults:

The maximum number of results returned by DescribeServiceEnvironments in paginated output. When this parameter is used, DescribeServiceEnvironments only returns maxResults results in a single page and a nextToken response element. The remaining results of the initial request can be seen by sending another DescribeServiceEnvironments request with the returned nextToken value. This value can be between 1 and 100. If this parameter isn't used, then DescribeServiceEnvironments returns up to 100 results and a nextToken value if applicable.

type nextToken:

string

param nextToken:

The nextToken value returned from a previous paginated DescribeServiceEnvironments 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.

rtype:

dict

returns:

Response Syntax

{
    'serviceEnvironments': [
        {
            'serviceEnvironmentName': 'string',
            'serviceEnvironmentArn': 'string',
            'serviceEnvironmentType': 'SAGEMAKER_TRAINING',
            'state': 'ENABLED'|'DISABLED',
            'status': 'CREATING'|'UPDATING'|'DELETING'|'DELETED'|'VALID'|'INVALID',
            'capacityLimits': [
                {
                    'maxCapacity': 123,
                    'capacityUnit': 'string'
                },
            ],
            'tags': {
                'string': 'string'
            }
        },
    ],
    'nextToken': 'string'
}

Response Structure

  • (dict) --

    • serviceEnvironments (list) --

      The list of service environments that match the request.

      • (dict) --

        Detailed information about a service environment, including its configuration, state, and capacity limits.

        • serviceEnvironmentName (string) --

          The name of the service environment.

        • serviceEnvironmentArn (string) --

          The Amazon Resource Name (ARN) of the service environment.

        • serviceEnvironmentType (string) --

          The type of service environment. For SageMaker Training jobs, this value is SAGEMAKER_TRAINING.

        • state (string) --

          The state of the service environment. Valid values are ENABLED and DISABLED.

        • status (string) --

          The current status of the service environment.

        • capacityLimits (list) --

          The capacity limits for the service environment. This defines the maximum resources that can be used by service jobs in this environment.

          • (dict) --

            Defines the capacity limit for a service environment. This structure specifies the maximum amount of resources that can be used by service jobs in the environment.

            • maxCapacity (integer) --

              The maximum capacity available for the service environment. This value represents the maximum amount of resources that can be allocated to service jobs.

              For example, maxCapacity=50, capacityUnit=NUM_INSTANCES. This indicates that the maximum number of instances that can be run on this service environment is 50. You could then run 5 SageMaker Training jobs that each use 10 instances. However, if you submit another job that requires 10 instances, it will wait in the queue.

            • capacityUnit (string) --

              The unit of measure for the capacity limit. This defines how the maxCapacity value should be interpreted. For SAGEMAKER_TRAINING jobs, use NUM_INSTANCES.

        • tags (dict) --

          The tags associated with the service environment. Each tag consists of a key and an optional value. For more information, see Tagging your Batch resources.

          • (string) --

            • (string) --

    • nextToken (string) --

      The nextToken value to include in a future DescribeServiceEnvironments request. When the results of a DescribeServiceEnvironments request exceed maxResults, this value can be used to retrieve the next page of results. This value is null when there are no more results to return.

SubmitServiceJob (new) Link ¶

Submits a service job to a specified job queue to run on SageMaker AI. A service job is a unit of work that you submit to Batch for execution on SageMaker AI.

See also: AWS API Documentation

Request Syntax

client.submit_service_job(
    jobName='string',
    jobQueue='string',
    retryStrategy={
        'attempts': 123,
        'evaluateOnExit': [
            {
                'action': 'RETRY'|'EXIT',
                'onStatusReason': 'string'
            },
        ]
    },
    schedulingPriority=123,
    serviceRequestPayload='string',
    serviceJobType='SAGEMAKER_TRAINING',
    shareIdentifier='string',
    timeoutConfig={
        'attemptDurationSeconds': 123
    },
    tags={
        'string': 'string'
    },
    clientToken='string'
)
type jobName:

string

param jobName:

[REQUIRED]

The name of the service job. It can be up to 128 characters long. It can contain uppercase and lowercase letters, numbers, hyphens (-), and underscores (_).

type jobQueue:

string

param jobQueue:

[REQUIRED]

The job queue into which the service job is submitted. You can specify either the name or the ARN of the queue. The job queue must have the type SAGEMAKER_TRAINING.

type retryStrategy:

dict

param retryStrategy:

The retry strategy to use for failed service jobs that are submitted with this service job request.

  • attempts (integer) -- [REQUIRED]

    The number of times to move a service job to RUNNABLE status. You can specify between 1 and 10 attempts.

  • evaluateOnExit (list) --

    Array of ServiceJobEvaluateOnExit objects that specify conditions under which the service job should be retried or failed.

    • (dict) --

      Specifies conditions for when to exit or retry a service job based on the exit status or status reason.

      • action (string) --

        The action to take if the service job exits with the specified condition. Valid values are RETRY and EXIT.

      • onStatusReason (string) --

        Contains a glob pattern to match against the StatusReason returned for a job. The pattern can contain up to 512 characters and can contain all printable characters. It can optionally end with an asterisk (*) so that only the start of the string needs to be an exact match.

type schedulingPriority:

integer

param schedulingPriority:

The scheduling priority of the service job. Valid values are integers between 0 and 9999.

type serviceRequestPayload:

string

param serviceRequestPayload:

[REQUIRED]

The request, in JSON, for the service that the SubmitServiceJob operation is queueing.

type serviceJobType:

string

param serviceJobType:

[REQUIRED]

The type of service job. For SageMaker Training jobs, specify SAGEMAKER_TRAINING.

type shareIdentifier:

string

param shareIdentifier:

The share identifier for the service job. Don't specify this parameter if the job queue doesn't have a fair- share scheduling policy. If the job queue has a fair-share scheduling policy, then this parameter must be specified.

type timeoutConfig:

dict

param timeoutConfig:

The timeout configuration for the service job. If none is specified, Batch defers to the default timeout of the underlying service handling the job.

  • attemptDurationSeconds (integer) --

    The maximum duration in seconds that a service job attempt can run. After this time is reached, Batch terminates the service job attempt.

type tags:

dict

param tags:

The tags that you apply to the service job request. Each tag consists of a key and an optional value. For more information, see Tagging your Batch resources.

  • (string) --

    • (string) --

type clientToken:

string

param clientToken:

A unique identifier for the request. This token is used to ensure idempotency of requests. If this parameter is specified and two submit requests with identical payloads and ``clientToken``s are received, these requests are considered the same request and the second request is rejected.

This field is autopopulated if not provided.

rtype:

dict

returns:

Response Syntax

{
    'jobArn': 'string',
    'jobName': 'string',
    'jobId': 'string'
}

Response Structure

  • (dict) --

    • jobArn (string) --

      The Amazon Resource Name (ARN) for the service job.

    • jobName (string) --

      The name of the service job.

    • jobId (string) --

      The unique identifier for the service job.

DescribeServiceJob (new) Link ¶

The details of a service job.

See also: AWS API Documentation

Request Syntax

client.describe_service_job(
    jobId='string'
)
type jobId:

string

param jobId:

[REQUIRED]

The job ID for the service job to describe.

rtype:

dict

returns:

Response Syntax

{
    'attempts': [
        {
            'serviceResourceId': {
                'name': 'TrainingJobArn',
                'value': 'string'
            },
            'startedAt': 123,
            'stoppedAt': 123,
            'statusReason': 'string'
        },
    ],
    'createdAt': 123,
    'isTerminated': True|False,
    'jobArn': 'string',
    'jobId': 'string',
    'jobName': 'string',
    'jobQueue': 'string',
    'latestAttempt': {
        'serviceResourceId': {
            'name': 'TrainingJobArn',
            'value': 'string'
        }
    },
    'retryStrategy': {
        'attempts': 123,
        'evaluateOnExit': [
            {
                'action': 'RETRY'|'EXIT',
                'onStatusReason': 'string'
            },
        ]
    },
    'schedulingPriority': 123,
    'serviceRequestPayload': 'string',
    'serviceJobType': 'SAGEMAKER_TRAINING',
    'shareIdentifier': 'string',
    'startedAt': 123,
    'status': 'SUBMITTED'|'PENDING'|'RUNNABLE'|'SCHEDULED'|'STARTING'|'RUNNING'|'SUCCEEDED'|'FAILED',
    'statusReason': 'string',
    'stoppedAt': 123,
    'tags': {
        'string': 'string'
    },
    'timeoutConfig': {
        'attemptDurationSeconds': 123
    }
}

Response Structure

  • (dict) --

    • attempts (list) --

      A list of job attempts associated with the service job.

      • (dict) --

        Detailed information about an attempt to run a service job.

        • serviceResourceId (dict) --

          The service resource identifier associated with the service job attempt.

          • name (string) --

            The name of the resource identifier.

          • value (string) --

            The value of the resource identifier.

        • startedAt (integer) --

          The Unix timestamp (in milliseconds) for when the service job attempt was started.

        • stoppedAt (integer) --

          The Unix timestamp (in milliseconds) for when the service job attempt stopped running.

        • statusReason (string) --

          A string that provides additional details for the current status of the service job attempt.

    • createdAt (integer) --

      The Unix timestamp (in milliseconds) for when the service job was created.

    • isTerminated (boolean) --

      Indicates whether the service job has been terminated.

    • jobArn (string) --

      The Amazon Resource Name (ARN) of the service job.

    • jobId (string) --

      The job ID for the service job.

    • jobName (string) --

      The name of the service job.

    • jobQueue (string) --

      The ARN of the job queue that the service job is associated with.

    • latestAttempt (dict) --

      The latest attempt associated with the service job.

      • serviceResourceId (dict) --

        The service resource identifier associated with the service job attempt.

        • name (string) --

          The name of the resource identifier.

        • value (string) --

          The value of the resource identifier.

    • retryStrategy (dict) --

      The retry strategy to use for failed service jobs that are submitted with this service job.

      • attempts (integer) --

        The number of times to move a service job to RUNNABLE status. You can specify between 1 and 10 attempts.

      • evaluateOnExit (list) --

        Array of ServiceJobEvaluateOnExit objects that specify conditions under which the service job should be retried or failed.

        • (dict) --

          Specifies conditions for when to exit or retry a service job based on the exit status or status reason.

          • action (string) --

            The action to take if the service job exits with the specified condition. Valid values are RETRY and EXIT.

          • onStatusReason (string) --

            Contains a glob pattern to match against the StatusReason returned for a job. The pattern can contain up to 512 characters and can contain all printable characters. It can optionally end with an asterisk (*) so that only the start of the string needs to be an exact match.

    • schedulingPriority (integer) --

      The scheduling priority of the service job.

    • serviceRequestPayload (string) --

      The request, in JSON, for the service that the SubmitServiceJob operation is queueing.

    • serviceJobType (string) --

      The type of service job. For SageMaker Training jobs, this value is SAGEMAKER_TRAINING.

    • shareIdentifier (string) --

      The share identifier for the service job. This is used for fair-share scheduling.

    • startedAt (integer) --

      The Unix timestamp (in milliseconds) for when the service job was started.

    • status (string) --

      The current status of the service job.

    • statusReason (string) --

      A short, human-readable string to provide more details for the current status of the service job.

    • stoppedAt (integer) --

      The Unix timestamp (in milliseconds) for when the service job stopped running.

    • tags (dict) --

      The tags that are associated with the service job. Each tag consists of a key and an optional value. For more information, see Tagging your Batch resources.

      • (string) --

        • (string) --

    • timeoutConfig (dict) --

      The timeout configuration for the service job.

      • attemptDurationSeconds (integer) --

        The maximum duration in seconds that a service job attempt can run. After this time is reached, Batch terminates the service job attempt.

UpdateServiceEnvironment (new) Link ¶

Updates a service environment. You can update the state of a service environment from ENABLED to DISABLED to prevent new service jobs from being placed in the service environment.

See also: AWS API Documentation

Request Syntax

client.update_service_environment(
    serviceEnvironment='string',
    state='ENABLED'|'DISABLED',
    capacityLimits=[
        {
            'maxCapacity': 123,
            'capacityUnit': 'string'
        },
    ]
)
type serviceEnvironment:

string

param serviceEnvironment:

[REQUIRED]

The name or ARN of the service environment to update.

type state:

string

param state:

The state of the service environment.

type capacityLimits:

list

param capacityLimits:

The capacity limits for the service environment. This defines the maximum resources that can be used by service jobs in this environment.

  • (dict) --

    Defines the capacity limit for a service environment. This structure specifies the maximum amount of resources that can be used by service jobs in the environment.

    • maxCapacity (integer) --

      The maximum capacity available for the service environment. This value represents the maximum amount of resources that can be allocated to service jobs.

      For example, maxCapacity=50, capacityUnit=NUM_INSTANCES. This indicates that the maximum number of instances that can be run on this service environment is 50. You could then run 5 SageMaker Training jobs that each use 10 instances. However, if you submit another job that requires 10 instances, it will wait in the queue.

    • capacityUnit (string) --

      The unit of measure for the capacity limit. This defines how the maxCapacity value should be interpreted. For SAGEMAKER_TRAINING jobs, use NUM_INSTANCES.

rtype:

dict

returns:

Response Syntax

{
    'serviceEnvironmentName': 'string',
    'serviceEnvironmentArn': 'string'
}

Response Structure

  • (dict) --

    • serviceEnvironmentName (string) --

      The name of the service environment that was updated.

    • serviceEnvironmentArn (string) --

      The Amazon Resource Name (ARN) of the service environment that was updated.

ListServiceJobs (new) Link ¶

Returns a list of service jobs for a specified job queue.

See also: AWS API Documentation

Request Syntax

client.list_service_jobs(
    jobQueue='string',
    jobStatus='SUBMITTED'|'PENDING'|'RUNNABLE'|'SCHEDULED'|'STARTING'|'RUNNING'|'SUCCEEDED'|'FAILED',
    maxResults=123,
    nextToken='string',
    filters=[
        {
            'name': 'string',
            'values': [
                'string',
            ]
        },
    ]
)
type jobQueue:

string

param jobQueue:

The name or ARN of the job queue with which to list service jobs.

type jobStatus:

string

param jobStatus:

The job status with which to filter service jobs.

type maxResults:

integer

param maxResults:

The maximum number of results returned by ListServiceJobs in paginated output. When this parameter is used, ListServiceJobs only returns maxResults results in a single page and a nextToken response element. The remaining results of the initial request can be seen by sending another ListServiceJobs request with the returned nextToken value. This value can be between 1 and 100. If this parameter isn't used, then ListServiceJobs returns up to 100 results and a nextToken value if applicable.

type nextToken:

string

param nextToken:

The nextToken value returned from a previous paginated ListServiceJobs 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.

type filters:

list

param filters:

The filters to apply to the service job list query. The filter names and values can be:

  • name: JOB_STATUS values: SUBMITTED | PENDING | RUNNABLE | STARTING | RUNNING | SUCCEEDED | FAILED | SCHEDULED

  • name: JOB_NAME values: case-insensitive matches for the job name. If a filter value ends with an asterisk (*), it matches any job name that begins with the string before the '*'.

  • (dict) --

    A filter name and value pair that's used to return a more specific list of results from a ListJobs or ListJobsByConsumableResource API operation.

    • name (string) --

      The name of the filter. Filter names are case sensitive.

    • values (list) --

      The filter values.

      • (string) --

rtype:

dict

returns:

Response Syntax

{
    'jobSummaryList': [
        {
            'latestAttempt': {
                'serviceResourceId': {
                    'name': 'TrainingJobArn',
                    'value': 'string'
                }
            },
            'createdAt': 123,
            'jobArn': 'string',
            'jobId': 'string',
            'jobName': 'string',
            'serviceJobType': 'SAGEMAKER_TRAINING',
            'shareIdentifier': 'string',
            'status': 'SUBMITTED'|'PENDING'|'RUNNABLE'|'SCHEDULED'|'STARTING'|'RUNNING'|'SUCCEEDED'|'FAILED',
            'statusReason': 'string',
            'startedAt': 123,
            'stoppedAt': 123
        },
    ],
    'nextToken': 'string'
}

Response Structure

  • (dict) --

    • jobSummaryList (list) --

      A list of service job summaries.

      • (dict) --

        Summary information about a service job.

        • latestAttempt (dict) --

          Information about the latest attempt for the service job.

          • serviceResourceId (dict) --

            The service resource identifier associated with the service job attempt.

            • name (string) --

              The name of the resource identifier.

            • value (string) --

              The value of the resource identifier.

        • createdAt (integer) --

          The Unix timestamp (in milliseconds) for when the service job was created.

        • jobArn (string) --

          The Amazon Resource Name (ARN) of the service job.

        • jobId (string) --

          The job ID for the service job.

        • jobName (string) --

          The name of the service job.

        • serviceJobType (string) --

          The type of service job. For SageMaker Training jobs, this value is SAGEMAKER_TRAINING.

        • shareIdentifier (string) --

          The share identifier for the job.

        • status (string) --

          The current status of the service job.

        • statusReason (string) --

          A short string to provide more details on the current status of the service job.

        • startedAt (integer) --

          The Unix timestamp (in milliseconds) for when the service job was started.

        • stoppedAt (integer) --

          The Unix timestamp (in milliseconds) for when the service job stopped running.

    • nextToken (string) --

      The nextToken value to include in a future ListServiceJobs request. When the results of a ListServiceJobs request exceed maxResults, this value can be used to retrieve the next page of results. This value is null when there are no more results to return.

CreateServiceEnvironment (new) Link ¶

Creates a service environment for running service jobs. Service environments define capacity limits for specific service types such as SageMaker Training jobs.

See also: AWS API Documentation

Request Syntax

client.create_service_environment(
    serviceEnvironmentName='string',
    serviceEnvironmentType='SAGEMAKER_TRAINING',
    state='ENABLED'|'DISABLED',
    capacityLimits=[
        {
            'maxCapacity': 123,
            'capacityUnit': 'string'
        },
    ],
    tags={
        'string': 'string'
    }
)
type serviceEnvironmentName:

string

param serviceEnvironmentName:

[REQUIRED]

The name for the service environment. It can be up to 128 characters long and can contain letters, numbers, hyphens (-), and underscores (_).

type serviceEnvironmentType:

string

param serviceEnvironmentType:

[REQUIRED]

The type of service environment. For SageMaker Training jobs, specify SAGEMAKER_TRAINING.

type state:

string

param state:

The state of the service environment. Valid values are ENABLED and DISABLED. The default value is ENABLED.

type capacityLimits:

list

param capacityLimits:

[REQUIRED]

The capacity limits for the service environment. The number of instances a job consumes is the total number of instances requested in the submit training job request resource configuration.

  • (dict) --

    Defines the capacity limit for a service environment. This structure specifies the maximum amount of resources that can be used by service jobs in the environment.

    • maxCapacity (integer) --

      The maximum capacity available for the service environment. This value represents the maximum amount of resources that can be allocated to service jobs.

      For example, maxCapacity=50, capacityUnit=NUM_INSTANCES. This indicates that the maximum number of instances that can be run on this service environment is 50. You could then run 5 SageMaker Training jobs that each use 10 instances. However, if you submit another job that requires 10 instances, it will wait in the queue.

    • capacityUnit (string) --

      The unit of measure for the capacity limit. This defines how the maxCapacity value should be interpreted. For SAGEMAKER_TRAINING jobs, use NUM_INSTANCES.

type tags:

dict

param tags:

The tags that you apply to the service environment to help you categorize and organize your resources. Each tag consists of a key and an optional value. For more information, see Tagging your Batch resources.

  • (string) --

    • (string) --

rtype:

dict

returns:

Response Syntax

{
    'serviceEnvironmentName': 'string',
    'serviceEnvironmentArn': 'string'
}

Response Structure

  • (dict) --

    • serviceEnvironmentName (string) --

      The name of the service environment.

    • serviceEnvironmentArn (string) --

      The Amazon Resource Name (ARN) of the service environment.

TerminateServiceJob (new) Link ¶

Terminates a service job in a job queue.

See also: AWS API Documentation

Request Syntax

client.terminate_service_job(
    jobId='string',
    reason='string'
)
type jobId:

string

param jobId:

[REQUIRED]

The service job ID of the service job to terminate.

type reason:

string

param reason:

[REQUIRED]

A message to attach to the service job that explains the reason for canceling it. This message is returned by DescribeServiceJob operations on the service job.

rtype:

dict

returns:

Response Syntax

{}

Response Structure

  • (dict) --

CreateJobQueue (updated) Link ¶
Changes (request)
{'jobQueueType': 'EKS | ECS | ECS_FARGATE | SAGEMAKER_TRAINING',
 'jobStateTimeLimitActions': {'action': {'TERMINATE'}},
 'serviceEnvironmentOrder': [{'order': 'integer',
                              'serviceEnvironment': 'string'}]}

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.

See also: AWS API Documentation

Request Syntax

client.create_job_queue(
    jobQueueName='string',
    state='ENABLED'|'DISABLED',
    schedulingPolicyArn='string',
    priority=123,
    computeEnvironmentOrder=[
        {
            'order': 123,
            'computeEnvironment': 'string'
        },
    ],
    serviceEnvironmentOrder=[
        {
            'order': 123,
            'serviceEnvironment': 'string'
        },
    ],
    jobQueueType='EKS'|'ECS'|'ECS_FARGATE'|'SAGEMAKER_TRAINING',
    tags={
        'string': 'string'
    },
    jobStateTimeLimitActions=[
        {
            'reason': 'string',
            'state': 'RUNNABLE',
            'maxTimeSeconds': 123,
            'action': 'CANCEL'|'TERMINATE'
        },
    ]
)
type jobQueueName:

string

param jobQueueName:

[REQUIRED]

The name of the job queue. It can be up to 128 letters long. It can contain uppercase and lowercase letters, numbers, hyphens (-), and underscores (_).

type state:

string

param state:

The state of the job queue. If the job queue state is ENABLED, it is able to accept jobs. If the job queue state is DISABLED, new jobs can't be added to the queue, but jobs already in the queue can finish.

type schedulingPolicyArn:

string

param schedulingPolicyArn:

The Amazon Resource Name (ARN) of the fair-share scheduling policy. Job queues that don't have a fair-share scheduling policy are scheduled in a first-in, first-out (FIFO) model. After a job queue has a fair-share scheduling policy, it can be replaced but can't be removed.

The format is ``aws:Partition:batch:Region:Account:scheduling-policy/Name ``.

An example is aws:aws:batch:us-west-2:123456789012:scheduling-policy/MySchedulingPolicy.

A job queue without a fair-share scheduling policy is scheduled as a FIFO job queue and can't have a fair-share scheduling policy added. Jobs queues with a fair-share scheduling policy can have a maximum of 500 active share identifiers. When the limit has been reached, submissions of any jobs that add a new share identifier fail.

type priority:

integer

param priority:

[REQUIRED]

The priority of the job queue. Job queues with a higher priority (or a higher integer value for the priority parameter) are evaluated first when associated with the same compute environment. Priority is determined in descending order. For example, a job queue with a priority value of 10 is given scheduling preference over a job queue with a priority value of 1. All of the compute environments must be either EC2 ( EC2 or SPOT) or Fargate ( FARGATE or FARGATE_SPOT); EC2 and Fargate compute environments can't be mixed.

type computeEnvironmentOrder:

list

param 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 runs a specific job. Compute environments must be in the VALID state before you can associate them with a job queue. You can associate up to three compute environments with a job queue. All of the compute environments must be either EC2 ( EC2 or SPOT) or Fargate ( FARGATE or FARGATE_SPOT); EC2 and Fargate compute environments can't be mixed.

  • (dict) --

    The order that compute environments are tried in for job placement within a queue. Compute environments are tried in ascending order. For example, if two compute environments are associated with a job queue, the compute environment with a lower order integer value is tried for job placement first. Compute environments must be in the VALID state before you can associate them with a job queue. All of the compute environments must be either EC2 ( EC2 or SPOT) or Fargate ( FARGATE or FARGATE_SPOT); Amazon EC2 and Fargate compute environments can't be mixed.

    • order (integer) -- [REQUIRED]

      The order of the compute environment. Compute environments are tried in ascending order. For example, if two compute environments are associated with a job queue, the compute environment with a lower order integer value is tried for job placement first.

    • computeEnvironment (string) -- [REQUIRED]

      The Amazon Resource Name (ARN) of the compute environment.

type serviceEnvironmentOrder:

list

param serviceEnvironmentOrder:

A list of service environments that this job queue can use to allocate jobs. All serviceEnvironments must have the same type. A job queue can't have both a serviceEnvironmentOrder and a computeEnvironmentOrder field.

  • (dict) --

    Specifies the order of a service environment for a job queue. This determines the priority order when multiple service environments are associated with the same job queue.

    • order (integer) -- [REQUIRED]

      The order of the service environment. Job queues with a higher priority are evaluated first when associated with the same service environment.

    • serviceEnvironment (string) -- [REQUIRED]

      The name or ARN of the service environment.

type jobQueueType:

string

param jobQueueType:

The type of job queue. For service jobs that run on SageMaker Training, this value is SAGEMAKER_TRAINING. For regular container jobs, this value is EKS, ECS, or ECS_FARGATE depending on the compute environment.

type tags:

dict

param tags:

The tags that you apply to the job queue to help you categorize and organize your resources. Each tag consists of a key and an optional value. For more information, see Tagging your Batch resources in Batch User Guide.

  • (string) --

    • (string) --

type jobStateTimeLimitActions:

list

param jobStateTimeLimitActions:

The set of actions that Batch performs on jobs that remain at the head of the job queue in the specified state longer than specified times. Batch will perform each action after maxTimeSeconds has passed. (Note: The minimum value for maxTimeSeconds is 600 (10 minutes) and its maximum value is 86,400 (24 hours).)

  • (dict) --

    Specifies an action that Batch will take after the job has remained at the head of the queue in the specified state for longer than the specified time.

    • reason (string) -- [REQUIRED]

      The reason to log for the action being taken.

    • state (string) -- [REQUIRED]

      The state of the job needed to trigger the action. The only supported value is RUNNABLE.

    • maxTimeSeconds (integer) -- [REQUIRED]

      The approximate amount of time, in seconds, that must pass with the job in the specified state before the action is taken. The minimum value is 600 (10 minutes) and the maximum value is 86,400 (24 hours).

    • action (string) -- [REQUIRED]

      The action to take when a job is at the head of the job queue in the specified state for the specified period of time. The only supported value is CANCEL, which will cancel the job.

rtype:

dict

returns:

Response Syntax

{
    'jobQueueName': 'string',
    'jobQueueArn': 'string'
}

Response Structure

  • (dict) --

    • jobQueueName (string) --

      The name of the job queue.

    • jobQueueArn (string) --

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

DescribeJobQueues (updated) Link ¶
Changes (response)
{'jobQueues': {'jobQueueType': 'EKS | ECS | ECS_FARGATE | SAGEMAKER_TRAINING',
               'jobStateTimeLimitActions': {'action': {'TERMINATE'}},
               'serviceEnvironmentOrder': [{'order': 'integer',
                                            'serviceEnvironment': 'string'}]}}

Describes one or more of your job queues.

See also: AWS API Documentation

Request Syntax

client.describe_job_queues(
    jobQueues=[
        'string',
    ],
    maxResults=123,
    nextToken='string'
)
type jobQueues:

list

param jobQueues:

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

  • (string) --

type maxResults:

integer

param maxResults:

The maximum number of results returned by DescribeJobQueues in paginated output. When this parameter is used, DescribeJobQueues only returns maxResults results in a single page and a nextToken response element. The remaining results of the initial request can be seen by sending another DescribeJobQueues request with the returned nextToken value. This value can be between 1 and 100. If this parameter isn't used, then DescribeJobQueues returns up to 100 results and a nextToken value if applicable.

type nextToken:

string

param nextToken:

The nextToken value returned from a previous paginated DescribeJobQueues request where maxResults was used and the results exceeded the value of that parameter. Pagination continues from the end of the previous results that returned the nextToken value. This value is null when there are no more results to return.

rtype:

dict

returns:

Response Syntax

{
    'jobQueues': [
        {
            'jobQueueName': 'string',
            'jobQueueArn': 'string',
            'state': 'ENABLED'|'DISABLED',
            'schedulingPolicyArn': 'string',
            'status': 'CREATING'|'UPDATING'|'DELETING'|'DELETED'|'VALID'|'INVALID',
            'statusReason': 'string',
            'priority': 123,
            'computeEnvironmentOrder': [
                {
                    'order': 123,
                    'computeEnvironment': 'string'
                },
            ],
            'serviceEnvironmentOrder': [
                {
                    'order': 123,
                    'serviceEnvironment': 'string'
                },
            ],
            'jobQueueType': 'EKS'|'ECS'|'ECS_FARGATE'|'SAGEMAKER_TRAINING',
            'tags': {
                'string': 'string'
            },
            'jobStateTimeLimitActions': [
                {
                    'reason': 'string',
                    'state': 'RUNNABLE',
                    'maxTimeSeconds': 123,
                    'action': 'CANCEL'|'TERMINATE'
                },
            ]
        },
    ],
    'nextToken': 'string'
}

Response Structure

  • (dict) --

    • jobQueues (list) --

      The list of job queues.

      • (dict) --

        An object that represents the details for an Batch job queue.

        • jobQueueName (string) --

          The job queue name.

        • jobQueueArn (string) --

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

        • state (string) --

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

        • schedulingPolicyArn (string) --

          The Amazon Resource Name (ARN) of the scheduling policy. The format is aws:Partition:batch:Region:Account:scheduling-policy/Name ``. For example, ``aws:aws:batch:us-west-2:123456789012:scheduling-policy/MySchedulingPolicy.

        • status (string) --

          The status of the job queue (for example, CREATING or VALID).

        • statusReason (string) --

          A short, human-readable string to provide additional details for the current status of the job queue.

        • priority (integer) --

          The priority of the job queue. Job queue priority determines the order that job queues are evaluated when multiple queues dispatch jobs within a shared compute environment. A higher value for priority indicates a higher priority. Queues are evaluated in cycles, in descending order by priority. For example, a job queue with a priority value of 10 is evaluated before a queue with a priority value of 1. All of the compute environments must be either Amazon EC2 ( EC2 or SPOT) or Fargate ( FARGATE or FARGATE_SPOT). Amazon EC2 and Fargate compute environments can't be mixed.

        • computeEnvironmentOrder (list) --

          The compute environments that are attached to the job queue and the order that job placement is preferred. Compute environments are selected for job placement in ascending order.

          • (dict) --

            The order that compute environments are tried in for job placement within a queue. Compute environments are tried in ascending order. For example, if two compute environments are associated with a job queue, the compute environment with a lower order integer value is tried for job placement first. Compute environments must be in the VALID state before you can associate them with a job queue. All of the compute environments must be either EC2 ( EC2 or SPOT) or Fargate ( FARGATE or FARGATE_SPOT); Amazon EC2 and Fargate compute environments can't be mixed.

            • order (integer) --

              The order of the compute environment. Compute environments are tried in ascending order. For example, if two compute environments are associated with a job queue, the compute environment with a lower order integer value is tried for job placement first.

            • computeEnvironment (string) --

              The Amazon Resource Name (ARN) of the compute environment.

        • serviceEnvironmentOrder (list) --

          The order of the service environment associated with the job queue. Job queues with a higher priority are evaluated first when associated with the same service environment.

          • (dict) --

            Specifies the order of a service environment for a job queue. This determines the priority order when multiple service environments are associated with the same job queue.

            • order (integer) --

              The order of the service environment. Job queues with a higher priority are evaluated first when associated with the same service environment.

            • serviceEnvironment (string) --

              The name or ARN of the service environment.

        • jobQueueType (string) --

          The type of job queue. For service jobs that run on SageMaker Training, this value is SAGEMAKER_TRAINING. For regular container jobs, this value is EKS, ECS, or ECS_FARGATE depending on the compute environment.

        • tags (dict) --

          The tags that are applied to the job queue. For more information, see Tagging your Batch resources in Batch User Guide.

          • (string) --

            • (string) --

        • jobStateTimeLimitActions (list) --

          The set of actions that Batch perform on jobs that remain at the head of the job queue in the specified state longer than specified times. Batch will perform each action after maxTimeSeconds has passed.

          • (dict) --

            Specifies an action that Batch will take after the job has remained at the head of the queue in the specified state for longer than the specified time.

            • reason (string) --

              The reason to log for the action being taken.

            • state (string) --

              The state of the job needed to trigger the action. The only supported value is RUNNABLE.

            • maxTimeSeconds (integer) --

              The approximate amount of time, in seconds, that must pass with the job in the specified state before the action is taken. The minimum value is 600 (10 minutes) and the maximum value is 86,400 (24 hours).

            • action (string) --

              The action to take when a job is at the head of the job queue in the specified state for the specified period of time. The only supported value is CANCEL, which will cancel the job.

    • nextToken (string) --

      The nextToken value to include in a future DescribeJobQueues request. When the results of a DescribeJobQueues request exceed maxResults, this value can be used to retrieve the next page of results. This value is null when there are no more results to return.

UpdateJobQueue (updated) Link ¶
Changes (request)
{'jobStateTimeLimitActions': {'action': {'TERMINATE'}},
 'serviceEnvironmentOrder': [{'order': 'integer',
                              'serviceEnvironment': 'string'}]}

Updates a job queue.

See also: AWS API Documentation

Request Syntax

client.update_job_queue(
    jobQueue='string',
    state='ENABLED'|'DISABLED',
    schedulingPolicyArn='string',
    priority=123,
    computeEnvironmentOrder=[
        {
            'order': 123,
            'computeEnvironment': 'string'
        },
    ],
    serviceEnvironmentOrder=[
        {
            'order': 123,
            'serviceEnvironment': 'string'
        },
    ],
    jobStateTimeLimitActions=[
        {
            'reason': 'string',
            'state': 'RUNNABLE',
            'maxTimeSeconds': 123,
            'action': 'CANCEL'|'TERMINATE'
        },
    ]
)
type jobQueue:

string

param jobQueue:

[REQUIRED]

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

type state:

string

param state:

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

type schedulingPolicyArn:

string

param schedulingPolicyArn:

Amazon Resource Name (ARN) of the fair-share scheduling policy. Once a job queue is created, the fair-share scheduling policy can be replaced but not removed. The format is aws:Partition:batch:Region:Account:scheduling-policy/Name ``. For example, ``aws:aws:batch:us-west-2:123456789012:scheduling-policy/MySchedulingPolicy.

type priority:

integer

param priority:

The priority of the job queue. Job queues with a higher priority (or a higher integer value for the priority parameter) are evaluated first when associated with the same compute environment. Priority is determined in descending order. For example, a job queue with a priority value of 10 is given scheduling preference over a job queue with a priority value of 1. All of the compute environments must be either EC2 ( EC2 or SPOT) or Fargate ( FARGATE or FARGATE_SPOT). EC2 and Fargate compute environments can't be mixed.

type computeEnvironmentOrder:

list

param 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 runs a given job. Compute environments must be in the VALID state before you can associate them with a job queue. All of the compute environments must be either EC2 ( EC2 or SPOT) or Fargate ( FARGATE or FARGATE_SPOT). EC2 and Fargate compute environments can't be mixed.

  • (dict) --

    The order that compute environments are tried in for job placement within a queue. Compute environments are tried in ascending order. For example, if two compute environments are associated with a job queue, the compute environment with a lower order integer value is tried for job placement first. Compute environments must be in the VALID state before you can associate them with a job queue. All of the compute environments must be either EC2 ( EC2 or SPOT) or Fargate ( FARGATE or FARGATE_SPOT); Amazon EC2 and Fargate compute environments can't be mixed.

    • order (integer) -- [REQUIRED]

      The order of the compute environment. Compute environments are tried in ascending order. For example, if two compute environments are associated with a job queue, the compute environment with a lower order integer value is tried for job placement first.

    • computeEnvironment (string) -- [REQUIRED]

      The Amazon Resource Name (ARN) of the compute environment.

type serviceEnvironmentOrder:

list

param serviceEnvironmentOrder:

The order of the service environment associated with the job queue. Job queues with a higher priority are evaluated first when associated with the same service environment.

  • (dict) --

    Specifies the order of a service environment for a job queue. This determines the priority order when multiple service environments are associated with the same job queue.

    • order (integer) -- [REQUIRED]

      The order of the service environment. Job queues with a higher priority are evaluated first when associated with the same service environment.

    • serviceEnvironment (string) -- [REQUIRED]

      The name or ARN of the service environment.

type jobStateTimeLimitActions:

list

param jobStateTimeLimitActions:

The set of actions that Batch perform on jobs that remain at the head of the job queue in the specified state longer than specified times. Batch will perform each action after maxTimeSeconds has passed. (Note: The minimum value for maxTimeSeconds is 600 (10 minutes) and its maximum value is 86,400 (24 hours).)

  • (dict) --

    Specifies an action that Batch will take after the job has remained at the head of the queue in the specified state for longer than the specified time.

    • reason (string) -- [REQUIRED]

      The reason to log for the action being taken.

    • state (string) -- [REQUIRED]

      The state of the job needed to trigger the action. The only supported value is RUNNABLE.

    • maxTimeSeconds (integer) -- [REQUIRED]

      The approximate amount of time, in seconds, that must pass with the job in the specified state before the action is taken. The minimum value is 600 (10 minutes) and the maximum value is 86,400 (24 hours).

    • action (string) -- [REQUIRED]

      The action to take when a job is at the head of the job queue in the specified state for the specified period of time. The only supported value is CANCEL, which will cancel the job.

rtype:

dict

returns:

Response Syntax

{
    'jobQueueName': 'string',
    'jobQueueArn': 'string'
}

Response Structure

  • (dict) --

    • jobQueueName (string) --

      The name of the job queue.

    • jobQueueArn (string) --

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