# JobStateTimeLimitActionsReason

The reason to log for the action being taken.

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

## Example

TypeScript:

```ts
new batch.JobQueue(this, 'JobQueue', {
    jobStateTimeLimitActions: [
      {
        action: batch.JobStateTimeLimitActionsAction.CANCEL,
        maxTime: cdk.Duration.minutes(10),
        reason: batch.JobStateTimeLimitActionsReason.INSUFFICIENT_INSTANCE_CAPACITY,
        state: batch.JobStateTimeLimitActionsState.RUNNABLE,
      },
    ]
});
```

Python:

```python
batch.JobQueue(self, "JobQueue",
    job_state_time_limit_actions=[batch.JobStateTimeLimitAction(
        action=batch.JobStateTimeLimitActionsAction.CANCEL,
        max_time=cdk.Duration.minutes(10),
        reason=batch.JobStateTimeLimitActionsReason.INSUFFICIENT_INSTANCE_CAPACITY,
        state=batch.JobStateTimeLimitActionsState.RUNNABLE
    )
    ]
)
```

Java:

```java
JobQueue.Builder.create(this, "JobQueue")
        .jobStateTimeLimitActions(List.of(JobStateTimeLimitAction.builder()
                .action(JobStateTimeLimitActionsAction.CANCEL)
                .maxTime(Duration.minutes(10))
                .reason(JobStateTimeLimitActionsReason.INSUFFICIENT_INSTANCE_CAPACITY)
                .state(JobStateTimeLimitActionsState.RUNNABLE)
                .build()))
        .build();
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.Lib
new JobQueue(this, "JobQueue", new JobQueueProps {
    JobStateTimeLimitActions = new [] { new JobStateTimeLimitAction {
        Action = JobStateTimeLimitActionsAction.CANCEL,
        MaxTime = Duration.Minutes(10),
        Reason = JobStateTimeLimitActionsReason.INSUFFICIENT_INSTANCE_CAPACITY,
        State = JobStateTimeLimitActionsState.RUNNABLE
    } }
});
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
batch.NewJobQueue(this, jsii.String("JobQueue"), &JobQueueProps{
	JobStateTimeLimitActions: []JobStateTimeLimitAction{
		&JobStateTimeLimitAction{
			Action: batch.JobStateTimeLimitActionsAction_CANCEL,
			MaxTime: cdk.Duration_Minutes(jsii.Number(10)),
			Reason: batch.JobStateTimeLimitActionsReason_INSUFFICIENT_INSTANCE_CAPACITY,
			State: batch.JobStateTimeLimitActionsState_RUNNABLE,
		},
	},
})
```

## Members

| Member | Description |
| --- | --- |
| `INSUFFICIENT_INSTANCE_CAPACITY` | All connected compute environments have insufficient capacity errors. |
| `COMPUTE_ENVIRONMENT_MAX_RESOURCE` | All compute environments have a maxvCpus parameter that is smaller than the job requirements. |
| `JOB_RESOURCE_REQUIREMENT` | None of the compute environments have instances that meet the job requirements. |

## Referenced by

- [`JobStateTimeLimitAction`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_batch.JobStateTimeLimitAction.html).reason
