Skip to content

Commit

Permalink
feat(client-batch): This release adds JobStateTimeLimitActions settin…
Browse files Browse the repository at this point in the history
…g 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.
  • Loading branch information
awstools committed Mar 8, 2024
1 parent d54999d commit 53ef388
Show file tree
Hide file tree
Showing 6 changed files with 231 additions and 7 deletions.
8 changes: 8 additions & 0 deletions clients/client-batch/src/commands/CreateJobQueueCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,14 @@ export interface CreateJobQueueCommandOutput extends CreateJobQueueResponse, __M
* tags: { // TagrisTagsMap
* "<keys>": "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);
Expand Down
8 changes: 8 additions & 0 deletions clients/client-batch/src/commands/DescribeJobQueuesCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,14 @@ export interface DescribeJobQueuesCommandOutput extends DescribeJobQueuesRespons
* // tags: { // TagrisTagsMap
* // "<keys>": "STRING_VALUE",
* // },
* // jobStateTimeLimitActions: [ // JobStateTimeLimitActions
* // { // JobStateTimeLimitAction
* // reason: "STRING_VALUE", // required
* // state: "RUNNABLE", // required
* // maxTimeSeconds: Number("int"), // required
* // action: "CANCEL", // required
* // },
* // ],
* // },
* // ],
* // nextToken: "STRING_VALUE",
Expand Down
8 changes: 8 additions & 0 deletions clients/client-batch/src/commands/UpdateJobQueueCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
111 changes: 107 additions & 4 deletions clients/client-batch/src/models/models_0.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
* <p>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.</p>
*/
export interface JobStateTimeLimitAction {
/**
* @public
* <p>The reason to log for the action being taken.</p>
*/
reason: string | undefined;

/**
* @public
* <p>The state of the job needed to trigger the action. The only supported value is "<code>RUNNABLE</code>".</p>
*/
state: JobStateTimeLimitActionsState | undefined;

/**
* @public
* <p>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).</p>
*/
maxTimeSeconds: number | undefined;

/**
* @public
* <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
* time. The only supported value is "<code>CANCEL</code>", which will cancel the job.</p>
*/
action: JobStateTimeLimitActionsAction | undefined;
}

/**
* @public
* @enum
Expand Down Expand Up @@ -1040,6 +1101,13 @@ export interface CreateJobQueueRequest {
* in <i>Batch User Guide</i>.</p>
*/
tags?: Record<string, string>;

/**
* @public
* <p>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 <code>maxTimeSeconds</code> has passed.</p>
*/
jobStateTimeLimitActions?: JobStateTimeLimitAction[];
}

/**
Expand Down Expand Up @@ -2819,7 +2887,7 @@ export interface TaskContainerProperties {
* <code>essential</code> 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.</p>
* <p>All tasks must have at least one essential container. If you have an application that's
* <p>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 <a href="https://docs.aws.amazon.com/AmazonECS/latest/developerguide/application_architecture.html">Application
Expand Down Expand Up @@ -4120,6 +4188,13 @@ export interface JobQueueDetail {
* <i>Batch User Guide</i>.</p>
*/
tags?: Record<string, string>;

/**
* @public
* <p>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 <code>maxTimeSeconds</code> has passed.</p>
*/
jobStateTimeLimitActions?: JobStateTimeLimitAction[];
}

/**
Expand Down Expand Up @@ -4473,7 +4548,7 @@ export interface TaskContainerDetails {
* <code>essential</code> 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.</p>
* <p>All tasks must have at least one essential container. If you have an application that's
* <p>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 <a href="https://docs.aws.amazon.com/AmazonECS/latest/developerguide/application_architecture.html">Application
Expand Down Expand Up @@ -5188,8 +5263,29 @@ export interface JobDetail {

/**
* @public
* <p>A short, human-readable string to provide more details for the current status of the
* job.</p>
* <p>A short, human-readable string to provide more details for the current status of the job.</p>
* <ul>
* <li>
* <p>
* <code>CAPACITY:INSUFFICIENT_INSTANCE_CAPACITY</code> - All compute environments have insufficient capacity to
* service the job.</p>
* </li>
* <li>
* <p>
* <code>MISCONFIGURATION:COMPUTE_ENVIRONMENT_MAX_RESOURCE</code> - All compute environments have a
* <code>maxVcpu</code> setting that is smaller than the job requirements.</p>
* </li>
* <li>
* <p>
* <code>MISCONFIGURATION:JOB_RESOURCE_REQUIREMENT</code> - All compute environments have no connected instances
* that meet the job requirements.</p>
* </li>
* <li>
* <p>
* <code>MISCONFIGURATION:SERVICE_ROLE_PERMISSIONS</code> - All compute environments have problems with the
* service role permissions.</p>
* </li>
* </ul>
*/
statusReason?: string;

Expand Down Expand Up @@ -7059,6 +7155,13 @@ export interface UpdateJobQueueRequest {
* </note>
*/
computeEnvironmentOrder?: ComputeEnvironmentOrder[];

/**
* @public
* <p>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 <code>maxTimeSeconds</code> has passed.</p>
*/
jobStateTimeLimitActions?: JobStateTimeLimitAction[];
}

/**
Expand Down
11 changes: 11 additions & 0 deletions clients/client-batch/src/protocols/Aws_restJson1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ import {
JobDefinition,
JobDependency,
JobDetail,
JobStateTimeLimitAction,
JobTimeout,
KeyValuePair,
KeyValuesPair,
Expand Down Expand Up @@ -230,6 +231,7 @@ export const se_CreateJobQueueCommand = async (
take(input, {
computeEnvironmentOrder: (_) => _json(_),
jobQueueName: [],
jobStateTimeLimitActions: (_) => _json(_),
priority: [],
schedulingPolicyArn: [],
state: [],
Expand Down Expand Up @@ -720,6 +722,7 @@ export const se_UpdateJobQueueCommand = async (
take(input, {
computeEnvironmentOrder: (_) => _json(_),
jobQueue: [],
jobStateTimeLimitActions: (_) => _json(_),
priority: [],
schedulingPolicyArn: [],
state: [],
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down
Loading

0 comments on commit 53ef388

Please sign in to comment.