class RetryStrategy
Language | Type name |
---|---|
![]() | Amazon.CDK.AWS.Batch.RetryStrategy |
![]() | github.com/aws/aws-cdk-go/awscdk/v2/awsbatch#RetryStrategy |
![]() | software.amazon.awscdk.services.batch.RetryStrategy |
![]() | aws_cdk.aws_batch.RetryStrategy |
![]() | aws-cdk-lib » aws_batch » RetryStrategy |
Define how Jobs using this JobDefinition respond to different exit conditions.
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 RetryStrategy(action: Action, on: Reason)
Parameters
Properties
Name | Type | Description |
---|---|---|
action | Action | The action to take when the job exits with the Reason specified. |
on | Reason | If the job exits with this Reason it will trigger the specified Action. |
action
Type:
Action
The action to take when the job exits with the Reason specified.
on
Type:
Reason
If the job exits with this Reason it will trigger the specified Action.
Methods
Name | Description |
---|---|
static of(action, on) | Create a new RetryStrategy. |
static of(action, on)
public static of(action: Action, on: Reason): RetryStrategy
Parameters
Returns
Create a new RetryStrategy.