From 53ef3887c1336b5478971fbd76d3ddf761137b57 Mon Sep 17 00:00:00 2001 From: awstools Date: Fri, 8 Mar 2024 19:12:44 +0000 Subject: [PATCH] feat(client-batch): 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. --- .../src/commands/CreateJobQueueCommand.ts | 8 ++ .../src/commands/DescribeJobQueuesCommand.ts | 8 ++ .../src/commands/UpdateJobQueueCommand.ts | 8 ++ clients/client-batch/src/models/models_0.ts | 111 +++++++++++++++++- .../src/protocols/Aws_restJson1.ts | 11 ++ codegen/sdk-codegen/aws-models/batch.json | 92 ++++++++++++++- 6 files changed, 231 insertions(+), 7 deletions(-) diff --git a/clients/client-batch/src/commands/CreateJobQueueCommand.ts b/clients/client-batch/src/commands/CreateJobQueueCommand.ts index 57a46c8c8c02..441bc9a81951 100644 --- a/clients/client-batch/src/commands/CreateJobQueueCommand.ts +++ b/clients/client-batch/src/commands/CreateJobQueueCommand.ts @@ -55,6 +55,14 @@ export interface CreateJobQueueCommandOutput extends CreateJobQueueResponse, __M * tags: { // TagrisTagsMap * "": "STRING_VALUE", * }, + * jobStateTimeLimitActions: [ // JobStateTimeLimitActions + * { // JobStateTimeLimitAction + * reason: "STRING_VALUE", // required + * state: "RUNNABLE", // required + * maxTimeSeconds: Number("int"), // required + * action: "CANCEL", // required + * }, + * ], * }; * const command = new CreateJobQueueCommand(input); * const response = await client.send(command); diff --git a/clients/client-batch/src/commands/DescribeJobQueuesCommand.ts b/clients/client-batch/src/commands/DescribeJobQueuesCommand.ts index 12e17219fce2..fe8fc645c875 100644 --- a/clients/client-batch/src/commands/DescribeJobQueuesCommand.ts +++ b/clients/client-batch/src/commands/DescribeJobQueuesCommand.ts @@ -63,6 +63,14 @@ export interface DescribeJobQueuesCommandOutput extends DescribeJobQueuesRespons * // tags: { // TagrisTagsMap * // "": "STRING_VALUE", * // }, + * // jobStateTimeLimitActions: [ // JobStateTimeLimitActions + * // { // JobStateTimeLimitAction + * // reason: "STRING_VALUE", // required + * // state: "RUNNABLE", // required + * // maxTimeSeconds: Number("int"), // required + * // action: "CANCEL", // required + * // }, + * // ], * // }, * // ], * // nextToken: "STRING_VALUE", diff --git a/clients/client-batch/src/commands/UpdateJobQueueCommand.ts b/clients/client-batch/src/commands/UpdateJobQueueCommand.ts index fb73088fbd57..61b877473934 100644 --- a/clients/client-batch/src/commands/UpdateJobQueueCommand.ts +++ b/clients/client-batch/src/commands/UpdateJobQueueCommand.ts @@ -46,6 +46,14 @@ export interface UpdateJobQueueCommandOutput extends UpdateJobQueueResponse, __M * computeEnvironment: "STRING_VALUE", // required * }, * ], + * jobStateTimeLimitActions: [ // JobStateTimeLimitActions + * { // JobStateTimeLimitAction + * reason: "STRING_VALUE", // required + * state: "RUNNABLE", // required + * maxTimeSeconds: Number("int"), // required + * action: "CANCEL", // required + * }, + * ], * }; * const command = new UpdateJobQueueCommand(input); * const response = await client.send(command); diff --git a/clients/client-batch/src/models/models_0.ts b/clients/client-batch/src/models/models_0.ts index 9dbaed06950f..2a00a380dbc9 100644 --- a/clients/client-batch/src/models/models_0.ts +++ b/clients/client-batch/src/models/models_0.ts @@ -957,6 +957,67 @@ export interface ComputeEnvironmentOrder { computeEnvironment: string | undefined; } +/** + * @public + * @enum + */ +export const JobStateTimeLimitActionsAction = { + CANCEL: "CANCEL", +} as const; + +/** + * @public + */ +export type JobStateTimeLimitActionsAction = + (typeof JobStateTimeLimitActionsAction)[keyof typeof JobStateTimeLimitActionsAction]; + +/** + * @public + * @enum + */ +export const JobStateTimeLimitActionsState = { + RUNNABLE: "RUNNABLE", +} as const; + +/** + * @public + */ +export type JobStateTimeLimitActionsState = + (typeof JobStateTimeLimitActionsState)[keyof typeof JobStateTimeLimitActionsState]; + +/** + * @public + *

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.

+ */ +export interface JobStateTimeLimitAction { + /** + * @public + *

The reason to log for the action being taken.

+ */ + reason: string | undefined; + + /** + * @public + *

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

+ */ + state: JobStateTimeLimitActionsState | undefined; + + /** + * @public + *

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).

+ */ + maxTimeSeconds: number | undefined; + + /** + * @public + *

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.

+ */ + action: JobStateTimeLimitActionsAction | undefined; +} + /** * @public * @enum @@ -1040,6 +1101,13 @@ export interface CreateJobQueueRequest { * in Batch User Guide.

*/ tags?: Record; + + /** + * @public + *

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.

+ */ + jobStateTimeLimitActions?: JobStateTimeLimitAction[]; } /** @@ -2819,7 +2887,7 @@ export interface TaskContainerProperties { * essential parameter of a container is marked as false, its failure doesn't affect * the rest of the containers in a task. If this parameter is omitted, a container is assumed to be * essential.

- *

All tasks must have at least one essential container. If you have an application that's + *

All jobs must have at least one essential container. If you have an application that's * composed of multiple containers, group containers that are used for a common purpose into * components, and separate the different components into multiple task definitions. For more * information, see Application @@ -4120,6 +4188,13 @@ export interface JobQueueDetail { * Batch User Guide.

*/ tags?: Record; + + /** + * @public + *

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.

+ */ + jobStateTimeLimitActions?: JobStateTimeLimitAction[]; } /** @@ -4473,7 +4548,7 @@ export interface TaskContainerDetails { * essential parameter of a container is marked as false, its failure doesn't affect * the rest of the containers in a task. If this parameter is omitted, a container is assumed to be * essential.

- *

All tasks must have at least one essential container. If you have an application that's + *

All jobs must have at least one essential container. If you have an application that's * composed of multiple containers, group containers that are used for a common purpose into * components, and separate the different components into multiple task definitions. For more * information, see Application @@ -5188,8 +5263,29 @@ export interface JobDetail { /** * @public - *

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

+ *

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

+ *
    + *
  • + *

    + * CAPACITY:INSUFFICIENT_INSTANCE_CAPACITY - All compute environments have insufficient capacity to + * service the job.

    + *
  • + *
  • + *

    + * MISCONFIGURATION:COMPUTE_ENVIRONMENT_MAX_RESOURCE - All compute environments have a + * maxVcpu setting that is smaller than the job requirements.

    + *
  • + *
  • + *

    + * MISCONFIGURATION:JOB_RESOURCE_REQUIREMENT - All compute environments have no connected instances + * that meet the job requirements.

    + *
  • + *
  • + *

    + * MISCONFIGURATION:SERVICE_ROLE_PERMISSIONS - All compute environments have problems with the + * service role permissions.

    + *
  • + *
*/ statusReason?: string; @@ -7059,6 +7155,13 @@ export interface UpdateJobQueueRequest { * */ computeEnvironmentOrder?: ComputeEnvironmentOrder[]; + + /** + * @public + *

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.

+ */ + jobStateTimeLimitActions?: JobStateTimeLimitAction[]; } /** diff --git a/clients/client-batch/src/protocols/Aws_restJson1.ts b/clients/client-batch/src/protocols/Aws_restJson1.ts index 4ca54d28f2ba..d2ee36c96074 100644 --- a/clients/client-batch/src/protocols/Aws_restJson1.ts +++ b/clients/client-batch/src/protocols/Aws_restJson1.ts @@ -130,6 +130,7 @@ import { JobDefinition, JobDependency, JobDetail, + JobStateTimeLimitAction, JobTimeout, KeyValuePair, KeyValuesPair, @@ -230,6 +231,7 @@ export const se_CreateJobQueueCommand = async ( take(input, { computeEnvironmentOrder: (_) => _json(_), jobQueueName: [], + jobStateTimeLimitActions: (_) => _json(_), priority: [], schedulingPolicyArn: [], state: [], @@ -720,6 +722,7 @@ export const se_UpdateJobQueueCommand = async ( take(input, { computeEnvironmentOrder: (_) => _json(_), jobQueue: [], + jobStateTimeLimitActions: (_) => _json(_), priority: [], schedulingPolicyArn: [], state: [], @@ -1404,6 +1407,10 @@ const se_FairsharePolicy = (input: FairsharePolicy, context: __SerdeContext): an // se_JobDependencyList omitted. +// se_JobStateTimeLimitAction omitted. + +// se_JobStateTimeLimitActions omitted. + // se_JobTimeout omitted. // se_KeyValuePair omitted. @@ -1756,6 +1763,10 @@ const de_JobDetailList = (output: any, context: __SerdeContext): JobDetail[] => // de_JobQueueDetailList omitted. +// de_JobStateTimeLimitAction omitted. + +// de_JobStateTimeLimitActions omitted. + // de_JobSummary omitted. // de_JobSummaryList omitted. diff --git a/codegen/sdk-codegen/aws-models/batch.json b/codegen/sdk-codegen/aws-models/batch.json index 6363317c528c..8808ff5582be 100644 --- a/codegen/sdk-codegen/aws-models/batch.json +++ b/codegen/sdk-codegen/aws-models/batch.json @@ -2629,6 +2629,12 @@ "traits": { "smithy.api#documentation": "

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

" } + }, + "jobStateTimeLimitActions": { + "target": "com.amazonaws.batch#JobStateTimeLimitActions", + "traits": { + "smithy.api#documentation": "

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

" + } } }, "traits": { @@ -5025,7 +5031,7 @@ "statusReason": { "target": "com.amazonaws.batch#String", "traits": { - "smithy.api#documentation": "

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

" + "smithy.api#documentation": "

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

\n
    \n
  • \n

    \n CAPACITY:INSUFFICIENT_INSTANCE_CAPACITY - All compute environments have insufficient capacity to\n service the job.

    \n
  • \n
  • \n

    \n MISCONFIGURATION:COMPUTE_ENVIRONMENT_MAX_RESOURCE - All compute environments have a\n maxVcpu setting that is smaller than the job requirements.

    \n
  • \n
  • \n

    \n MISCONFIGURATION:JOB_RESOURCE_REQUIREMENT - All compute environments have no connected instances\n that meet the job requirements.

    \n
  • \n
  • \n

    \n MISCONFIGURATION:SERVICE_ROLE_PERMISSIONS - All compute environments have problems with the\n service role permissions.

    \n
  • \n
" } }, "createdAt": { @@ -5238,6 +5244,12 @@ "traits": { "smithy.api#documentation": "

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

" } + }, + "jobStateTimeLimitActions": { + "target": "com.amazonaws.batch#JobStateTimeLimitActions", + "traits": { + "smithy.api#documentation": "

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

" + } } }, "traits": { @@ -5250,6 +5262,74 @@ "target": "com.amazonaws.batch#JobQueueDetail" } }, + "com.amazonaws.batch#JobStateTimeLimitAction": { + "type": "structure", + "members": { + "reason": { + "target": "com.amazonaws.batch#String", + "traits": { + "smithy.api#clientOptional": {}, + "smithy.api#documentation": "

The reason to log for the action being taken.

", + "smithy.api#required": {} + } + }, + "state": { + "target": "com.amazonaws.batch#JobStateTimeLimitActionsState", + "traits": { + "smithy.api#clientOptional": {}, + "smithy.api#documentation": "

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

", + "smithy.api#required": {} + } + }, + "maxTimeSeconds": { + "target": "com.amazonaws.batch#Integer", + "traits": { + "smithy.api#clientOptional": {}, + "smithy.api#documentation": "

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

", + "smithy.api#required": {} + } + }, + "action": { + "target": "com.amazonaws.batch#JobStateTimeLimitActionsAction", + "traits": { + "smithy.api#clientOptional": {}, + "smithy.api#documentation": "

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

", + "smithy.api#required": {} + } + } + }, + "traits": { + "smithy.api#documentation": "

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

" + } + }, + "com.amazonaws.batch#JobStateTimeLimitActions": { + "type": "list", + "member": { + "target": "com.amazonaws.batch#JobStateTimeLimitAction" + } + }, + "com.amazonaws.batch#JobStateTimeLimitActionsAction": { + "type": "enum", + "members": { + "CANCEL": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "CANCEL" + } + } + } + }, + "com.amazonaws.batch#JobStateTimeLimitActionsState": { + "type": "enum", + "members": { + "RUNNABLE": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "RUNNABLE" + } + } + } + }, "com.amazonaws.batch#JobStatus": { "type": "enum", "members": { @@ -7077,7 +7157,7 @@ "essential": { "target": "com.amazonaws.batch#Boolean", "traits": { - "smithy.api#documentation": "

If the essential parameter of a container is marked as true, and that container\n fails or stops for any reason, all other containers that are part of the task are stopped. If the\n essential parameter of a container is marked as false, its failure doesn't affect\n the rest of the containers in a task. If this parameter is omitted, a container is assumed to be\n essential.

\n

All tasks must have at least one essential container. If you have an application that's\n composed of multiple containers, group containers that are used for a common purpose into\n components, and separate the different components into multiple task definitions. For more\n information, see Application\n Architecture in the Amazon Elastic Container Service Developer Guide.

" + "smithy.api#documentation": "

If the essential parameter of a container is marked as true, and that container\n fails or stops for any reason, all other containers that are part of the task are stopped. If the\n essential parameter of a container is marked as false, its failure doesn't affect\n the rest of the containers in a task. If this parameter is omitted, a container is assumed to be\n essential.

\n

All jobs must have at least one essential container. If you have an application that's\n composed of multiple containers, group containers that are used for a common purpose into\n components, and separate the different components into multiple task definitions. For more\n information, see Application\n Architecture in the Amazon Elastic Container Service Developer Guide.

" } }, "image": { @@ -7237,7 +7317,7 @@ "essential": { "target": "com.amazonaws.batch#Boolean", "traits": { - "smithy.api#documentation": "

If the essential parameter of a container is marked as true, and that container\n fails or stops for any reason, all other containers that are part of the task are stopped. If the\n essential parameter of a container is marked as false, its failure doesn't affect\n the rest of the containers in a task. If this parameter is omitted, a container is assumed to be\n essential.

\n

All tasks must have at least one essential container. If you have an application that's\n composed of multiple containers, group containers that are used for a common purpose into\n components, and separate the different components into multiple task definitions. For more\n information, see Application\n Architecture in the Amazon Elastic Container Service Developer Guide.

" + "smithy.api#documentation": "

If the essential parameter of a container is marked as true, and that container\n fails or stops for any reason, all other containers that are part of the task are stopped. If the\n essential parameter of a container is marked as false, its failure doesn't affect\n the rest of the containers in a task. If this parameter is omitted, a container is assumed to be\n essential.

\n

All jobs must have at least one essential container. If you have an application that's\n composed of multiple containers, group containers that are used for a common purpose into\n components, and separate the different components into multiple task definitions. For more\n information, see Application\n Architecture in the Amazon Elastic Container Service Developer Guide.

" } }, "image": { @@ -7723,6 +7803,12 @@ "traits": { "smithy.api#documentation": "

Details the set of compute environments mapped to a job queue and their order relative to\n each other. This is one of the parameters used by the job scheduler to determine which compute\n environment runs a given job. Compute environments must be in the VALID state\n before you can associate them with a job queue. All of the compute environments must be either\n EC2 (EC2 or SPOT) or Fargate (FARGATE or\n FARGATE_SPOT). EC2 and Fargate compute environments can't be mixed.

\n \n

All compute environments that are associated with a job queue must share the same\n architecture. Batch doesn't support mixing compute environment architecture types in a\n single job queue.

\n
" } + }, + "jobStateTimeLimitActions": { + "target": "com.amazonaws.batch#JobStateTimeLimitActions", + "traits": { + "smithy.api#documentation": "

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

" + } } }, "traits": {