2024/03/08 - AWS Batch - 3 updated api methods
Changes This release adds JobStateTimeLimitActions setting to the Job Queue API. It allows you to configure an action Batch can take for a blocking job in front of the queue after the defined period of time. The new parameter applies for ECS, EKS, and FARGATE Job Queues.
{'jobStateTimeLimitActions': [{'action': 'CANCEL', 'maxTimeSeconds': 'integer', 'reason': 'string', 'state': 'RUNNABLE'}]}
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' }, ], tags={ 'string': 'string' }, jobStateTimeLimitActions=[ { 'reason': 'string', 'state': 'RUNNABLE', 'maxTimeSeconds': 123, 'action': 'CANCEL' }, ] )
string
[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 (_).
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 can't be added to the queue, but jobs already in the queue can finish.
string
The Amazon Resource Name (ARN) of the fair share scheduling policy. If this parameter is specified, the job queue uses a fair share scheduling policy. If this parameter isn't specified, the job queue uses a first in, first out (FIFO) scheduling policy. After a job queue is created, you can replace but can't remove the fair share scheduling policy. The format is aws:Partition:batch:Region:Account:scheduling-policy/Name ``. An example is ``aws:aws:batch:us-west-2:123456789012:scheduling-policy/MySchedulingPolicy.
integer
[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.
list
[REQUIRED]
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.
dict
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) --
list
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.
(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.
dict
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.
{'jobQueues': {'jobStateTimeLimitActions': [{'action': 'CANCEL', 'maxTimeSeconds': 'integer', 'reason': 'string', 'state': 'RUNNABLE'}]}}
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' )
list
A list of up to 100 queue names or full queue Amazon Resource Name (ARN) entries.
(string) --
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 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.
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.
dict
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' }, ], 'tags': { 'string': 'string' }, 'jobStateTimeLimitActions': [ { 'reason': 'string', 'state': 'RUNNABLE', 'maxTimeSeconds': 123, 'action': 'CANCEL' }, ] }, ], '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 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 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.
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.
{'jobStateTimeLimitActions': [{'action': 'CANCEL', 'maxTimeSeconds': 'integer', 'reason': 'string', 'state': 'RUNNABLE'}]}
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' }, ], jobStateTimeLimitActions=[ { 'reason': 'string', 'state': 'RUNNABLE', 'maxTimeSeconds': 123, 'action': 'CANCEL' }, ] )
string
[REQUIRED]
The name or the Amazon Resource Name (ARN) of the job queue.
string
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.
string
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.
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. 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.
list
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.
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) -- [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.
dict
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.