# JobStateTimeLimitAction

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

- Source: [`aws-batch/lib/job-queue.ts`](https://github.com/aws/aws-cdk/blob/v2.275.0/packages/aws-cdk-lib/aws-batch/lib/job-queue.ts#L162)
- Type last changed: v2.143.0 · 24 May 2024

## Example

```ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import * as cdk from 'aws-cdk-lib';
import { aws_batch as batch } from 'aws-cdk-lib';
const jobStateTimeLimitAction: batch.JobStateTimeLimitAction = {
  maxTime: cdk.Duration.minutes(30),
  reason: batch.JobStateTimeLimitActionsReason.INSUFFICIENT_INSTANCE_CAPACITY,

  // the properties below are optional
  action: batch.JobStateTimeLimitActionsAction.CANCEL,
  state: batch.JobStateTimeLimitActionsState.RUNNABLE,
};
```

## Properties

- `action`: [JobStateTimeLimitActionsAction](/cdk/api/v2/docs/aws-cdk-lib.aws_batch.JobStateTimeLimitActionsAction.html) — 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.

  **Default:** JobStateTimeLimitActionsAction.CANCEL

- `maxTime`: [Duration](/cdk/api/v2/docs/aws-cdk-lib.Duration.html) (required) — The approximate amount of time, that must pass with the job in the specified state before the action is taken.

  The minimum value is 10 minutes and the maximum value is 24 hours.

- `reason`: [JobStateTimeLimitActionsReason](/cdk/api/v2/docs/aws-cdk-lib.aws_batch.JobStateTimeLimitActionsReason.html) (required) — The reason to log for the action being taken.

- `state`: [JobStateTimeLimitActionsState](/cdk/api/v2/docs/aws-cdk-lib.aws_batch.JobStateTimeLimitActionsState.html) — The state of the job needed to trigger the action.

  **Default:** JobStateTimeLimitActionsState.RUNNABLE
