@aws-cdk_aws-batch-alpha.RetryStrategy

class RetryStrategy ๐Ÿ”น

LanguageType name
.NETAmazon.CDK.AWS.Batch.Alpha.RetryStrategy
Gogithub.com/aws/aws-cdk-go/awscdkbatchalpha/v2#RetryStrategy
Javasoftware.amazon.awscdk.services.batch.alpha.RetryStrategy
Pythonaws_cdk.aws_batch_alpha.RetryStrategy
TypeScript (source)@aws-cdk/aws-batch-alpha ยป RetryStrategy

Define how Jobs using this JobDefinition respond to different exit conditions.

Example

import * as cdk from 'aws-cdk-lib';

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

  • action Action
  • on Reason

Properties

NameTypeDescription
action๐Ÿ”นActionThe action to take when the job exits with the Reason specified.
on๐Ÿ”นReasonIf 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

NameDescription
static of(action, on)๐Ÿ”นCreate a new RetryStrategy.

static of(action, on)๐Ÿ”น

public static of(action: Action, on: Reason): RetryStrategy

Parameters

  • action Action
  • on Reason

Returns

  • RetryStrategy

Create a new RetryStrategy.