class Reason
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.Batch.Reason |
Go | github.com/aws/aws-cdk-go/awscdk/v2/awsbatch#Reason |
Java | software.amazon.awscdk.services.batch.Reason |
Python | aws_cdk.aws_batch.Reason |
TypeScript (source) | aws-cdk-lib » aws_batch » Reason |
Common job exit reasons.
Example
const jobDefn = new batch.EcsJobDefinition(this, 'JobDefn', {
container: new batch.EcsEc2ContainerDefinition(this, 'containerDefn', {
image: ecs.ContainerImage.fromRegistry('public.ecr.aws/amazonlinux/amazonlinux:latest'),
memory: cdk.Size.mebibytes(2048),
cpu: 256,
}),
retryAttempts: 5,
retryStrategies: [
batch.RetryStrategy.of(batch.Action.EXIT, batch.Reason.CANNOT_PULL_CONTAINER),
],
});
jobDefn.addRetryStrategy(
batch.RetryStrategy.of(batch.Action.EXIT, batch.Reason.SPOT_INSTANCE_RECLAIMED),
);
jobDefn.addRetryStrategy(
batch.RetryStrategy.of(batch.Action.EXIT, batch.Reason.CANNOT_PULL_CONTAINER),
);
jobDefn.addRetryStrategy(
batch.RetryStrategy.of(batch.Action.EXIT, batch.Reason.custom({
onExitCode: '40*',
onReason: 'some reason',
})),
);
Initializer
new Reason()
Properties
Name | Type | Description |
---|---|---|
static CANNOT_PULL_CONTAINER | Reason | Will only match if the Docker container could not be pulled. |
static NON_ZERO_EXIT_CODE | Reason | Will match any non-zero exit code. |
static SPOT_INSTANCE_RECLAIMED | Reason | Will only match if the Spot instance executing the job was reclaimed. |
static CANNOT_PULL_CONTAINER
Type:
Reason
Will only match if the Docker container could not be pulled.
static NON_ZERO_EXIT_CODE
Type:
Reason
Will match any non-zero exit code.
static SPOT_INSTANCE_RECLAIMED
Type:
Reason
Will only match if the Spot instance executing the job was reclaimed.
Methods
Name | Description |
---|---|
static custom(customReasonProps) | A custom Reason that can match on multiple conditions. |
static custom(customReasonProps)
public static custom(customReasonProps: CustomReason): Reason
Parameters
- customReasonProps
Custom
Reason
Returns
A custom Reason that can match on multiple conditions.
Note that all specified conditions must be met for this reason to match.