Skip to content

Commit 53ef388

Browse files
author
awstools
committed
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.
1 parent d54999d commit 53ef388

File tree

6 files changed

+231
-7
lines changed

6 files changed

+231
-7
lines changed

clients/client-batch/src/commands/CreateJobQueueCommand.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,14 @@ export interface CreateJobQueueCommandOutput extends CreateJobQueueResponse, __M
5555
* tags: { // TagrisTagsMap
5656
* "<keys>": "STRING_VALUE",
5757
* },
58+
* jobStateTimeLimitActions: [ // JobStateTimeLimitActions
59+
* { // JobStateTimeLimitAction
60+
* reason: "STRING_VALUE", // required
61+
* state: "RUNNABLE", // required
62+
* maxTimeSeconds: Number("int"), // required
63+
* action: "CANCEL", // required
64+
* },
65+
* ],
5866
* };
5967
* const command = new CreateJobQueueCommand(input);
6068
* const response = await client.send(command);

clients/client-batch/src/commands/DescribeJobQueuesCommand.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,14 @@ export interface DescribeJobQueuesCommandOutput extends DescribeJobQueuesRespons
6363
* // tags: { // TagrisTagsMap
6464
* // "<keys>": "STRING_VALUE",
6565
* // },
66+
* // jobStateTimeLimitActions: [ // JobStateTimeLimitActions
67+
* // { // JobStateTimeLimitAction
68+
* // reason: "STRING_VALUE", // required
69+
* // state: "RUNNABLE", // required
70+
* // maxTimeSeconds: Number("int"), // required
71+
* // action: "CANCEL", // required
72+
* // },
73+
* // ],
6674
* // },
6775
* // ],
6876
* // nextToken: "STRING_VALUE",

clients/client-batch/src/commands/UpdateJobQueueCommand.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,14 @@ export interface UpdateJobQueueCommandOutput extends UpdateJobQueueResponse, __M
4646
* computeEnvironment: "STRING_VALUE", // required
4747
* },
4848
* ],
49+
* jobStateTimeLimitActions: [ // JobStateTimeLimitActions
50+
* { // JobStateTimeLimitAction
51+
* reason: "STRING_VALUE", // required
52+
* state: "RUNNABLE", // required
53+
* maxTimeSeconds: Number("int"), // required
54+
* action: "CANCEL", // required
55+
* },
56+
* ],
4957
* };
5058
* const command = new UpdateJobQueueCommand(input);
5159
* const response = await client.send(command);

clients/client-batch/src/models/models_0.ts

Lines changed: 107 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -957,6 +957,67 @@ export interface ComputeEnvironmentOrder {
957957
computeEnvironment: string | undefined;
958958
}
959959

960+
/**
961+
* @public
962+
* @enum
963+
*/
964+
export const JobStateTimeLimitActionsAction = {
965+
CANCEL: "CANCEL",
966+
} as const;
967+
968+
/**
969+
* @public
970+
*/
971+
export type JobStateTimeLimitActionsAction =
972+
(typeof JobStateTimeLimitActionsAction)[keyof typeof JobStateTimeLimitActionsAction];
973+
974+
/**
975+
* @public
976+
* @enum
977+
*/
978+
export const JobStateTimeLimitActionsState = {
979+
RUNNABLE: "RUNNABLE",
980+
} as const;
981+
982+
/**
983+
* @public
984+
*/
985+
export type JobStateTimeLimitActionsState =
986+
(typeof JobStateTimeLimitActionsState)[keyof typeof JobStateTimeLimitActionsState];
987+
988+
/**
989+
* @public
990+
* <p>Specifies an action that Batch will take after the job has remained at the head of the queue in the specified
991+
* state for longer than the specified time.</p>
992+
*/
993+
export interface JobStateTimeLimitAction {
994+
/**
995+
* @public
996+
* <p>The reason to log for the action being taken.</p>
997+
*/
998+
reason: string | undefined;
999+
1000+
/**
1001+
* @public
1002+
* <p>The state of the job needed to trigger the action. The only supported value is "<code>RUNNABLE</code>".</p>
1003+
*/
1004+
state: JobStateTimeLimitActionsState | undefined;
1005+
1006+
/**
1007+
* @public
1008+
* <p>The approximate amount of time, in seconds, that must pass with the job in the specified state before the action
1009+
* is taken. The minimum value is 600 (10 minutes) and the maximum value is 86,400 (24 hours).</p>
1010+
*/
1011+
maxTimeSeconds: number | undefined;
1012+
1013+
/**
1014+
* @public
1015+
* <p>The action to take when a job is at the head of the job queue in the specified state for the specified period of
1016+
* time. The only supported value is "<code>CANCEL</code>", which will cancel the job.</p>
1017+
*/
1018+
action: JobStateTimeLimitActionsAction | undefined;
1019+
}
1020+
9601021
/**
9611022
* @public
9621023
* @enum
@@ -1040,6 +1101,13 @@ export interface CreateJobQueueRequest {
10401101
* in <i>Batch User Guide</i>.</p>
10411102
*/
10421103
tags?: Record<string, string>;
1104+
1105+
/**
1106+
* @public
1107+
* <p>The set of actions that Batch performs on jobs that remain at the head of the job queue in the specified state
1108+
* longer than specified times. Batch will perform each action after <code>maxTimeSeconds</code> has passed.</p>
1109+
*/
1110+
jobStateTimeLimitActions?: JobStateTimeLimitAction[];
10431111
}
10441112

10451113
/**
@@ -2819,7 +2887,7 @@ export interface TaskContainerProperties {
28192887
* <code>essential</code> parameter of a container is marked as false, its failure doesn't affect
28202888
* the rest of the containers in a task. If this parameter is omitted, a container is assumed to be
28212889
* essential.</p>
2822-
* <p>All tasks must have at least one essential container. If you have an application that's
2890+
* <p>All jobs must have at least one essential container. If you have an application that's
28232891
* composed of multiple containers, group containers that are used for a common purpose into
28242892
* components, and separate the different components into multiple task definitions. For more
28252893
* information, see <a href="https://docs.aws.amazon.com/AmazonECS/latest/developerguide/application_architecture.html">Application
@@ -4120,6 +4188,13 @@ export interface JobQueueDetail {
41204188
* <i>Batch User Guide</i>.</p>
41214189
*/
41224190
tags?: Record<string, string>;
4191+
4192+
/**
4193+
* @public
4194+
* <p>The set of actions that Batch perform on jobs that remain at the head of the job queue in the specified state
4195+
* longer than specified times. Batch will perform each action after <code>maxTimeSeconds</code> has passed.</p>
4196+
*/
4197+
jobStateTimeLimitActions?: JobStateTimeLimitAction[];
41234198
}
41244199

41254200
/**
@@ -4473,7 +4548,7 @@ export interface TaskContainerDetails {
44734548
* <code>essential</code> parameter of a container is marked as false, its failure doesn't affect
44744549
* the rest of the containers in a task. If this parameter is omitted, a container is assumed to be
44754550
* essential.</p>
4476-
* <p>All tasks must have at least one essential container. If you have an application that's
4551+
* <p>All jobs must have at least one essential container. If you have an application that's
44774552
* composed of multiple containers, group containers that are used for a common purpose into
44784553
* components, and separate the different components into multiple task definitions. For more
44794554
* information, see <a href="https://docs.aws.amazon.com/AmazonECS/latest/developerguide/application_architecture.html">Application
@@ -5188,8 +5263,29 @@ export interface JobDetail {
51885263

51895264
/**
51905265
* @public
5191-
* <p>A short, human-readable string to provide more details for the current status of the
5192-
* job.</p>
5266+
* <p>A short, human-readable string to provide more details for the current status of the job.</p>
5267+
* <ul>
5268+
* <li>
5269+
* <p>
5270+
* <code>CAPACITY:INSUFFICIENT_INSTANCE_CAPACITY</code> - All compute environments have insufficient capacity to
5271+
* service the job.</p>
5272+
* </li>
5273+
* <li>
5274+
* <p>
5275+
* <code>MISCONFIGURATION:COMPUTE_ENVIRONMENT_MAX_RESOURCE</code> - All compute environments have a
5276+
* <code>maxVcpu</code> setting that is smaller than the job requirements.</p>
5277+
* </li>
5278+
* <li>
5279+
* <p>
5280+
* <code>MISCONFIGURATION:JOB_RESOURCE_REQUIREMENT</code> - All compute environments have no connected instances
5281+
* that meet the job requirements.</p>
5282+
* </li>
5283+
* <li>
5284+
* <p>
5285+
* <code>MISCONFIGURATION:SERVICE_ROLE_PERMISSIONS</code> - All compute environments have problems with the
5286+
* service role permissions.</p>
5287+
* </li>
5288+
* </ul>
51935289
*/
51945290
statusReason?: string;
51955291

@@ -7059,6 +7155,13 @@ export interface UpdateJobQueueRequest {
70597155
* </note>
70607156
*/
70617157
computeEnvironmentOrder?: ComputeEnvironmentOrder[];
7158+
7159+
/**
7160+
* @public
7161+
* <p>The set of actions that Batch perform on jobs that remain at the head of the job queue in the specified state
7162+
* longer than specified times. Batch will perform each action after <code>maxTimeSeconds</code> has passed.</p>
7163+
*/
7164+
jobStateTimeLimitActions?: JobStateTimeLimitAction[];
70627165
}
70637166

70647167
/**

clients/client-batch/src/protocols/Aws_restJson1.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ import {
130130
JobDefinition,
131131
JobDependency,
132132
JobDetail,
133+
JobStateTimeLimitAction,
133134
JobTimeout,
134135
KeyValuePair,
135136
KeyValuesPair,
@@ -230,6 +231,7 @@ export const se_CreateJobQueueCommand = async (
230231
take(input, {
231232
computeEnvironmentOrder: (_) => _json(_),
232233
jobQueueName: [],
234+
jobStateTimeLimitActions: (_) => _json(_),
233235
priority: [],
234236
schedulingPolicyArn: [],
235237
state: [],
@@ -720,6 +722,7 @@ export const se_UpdateJobQueueCommand = async (
720722
take(input, {
721723
computeEnvironmentOrder: (_) => _json(_),
722724
jobQueue: [],
725+
jobStateTimeLimitActions: (_) => _json(_),
723726
priority: [],
724727
schedulingPolicyArn: [],
725728
state: [],
@@ -1404,6 +1407,10 @@ const se_FairsharePolicy = (input: FairsharePolicy, context: __SerdeContext): an
14041407

14051408
// se_JobDependencyList omitted.
14061409

1410+
// se_JobStateTimeLimitAction omitted.
1411+
1412+
// se_JobStateTimeLimitActions omitted.
1413+
14071414
// se_JobTimeout omitted.
14081415

14091416
// se_KeyValuePair omitted.
@@ -1756,6 +1763,10 @@ const de_JobDetailList = (output: any, context: __SerdeContext): JobDetail[] =>
17561763

17571764
// de_JobQueueDetailList omitted.
17581765

1766+
// de_JobStateTimeLimitAction omitted.
1767+
1768+
// de_JobStateTimeLimitActions omitted.
1769+
17591770
// de_JobSummary omitted.
17601771

17611772
// de_JobSummaryList omitted.

0 commit comments

Comments
 (0)