@aws-cdk_aws-batch-alpha.Reason

class Reason ๐Ÿ”น

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

Common job exit reasons.

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 Reason()

Properties

NameTypeDescription
static CANNOT_PULL_CONTAINER๐Ÿ”นReasonWill only match if the Docker container could not be pulled.
static NON_ZERO_EXIT_CODE๐Ÿ”นReasonWill match any non-zero exit code.
static SPOT_INSTANCE_RECLAIMED๐Ÿ”นReasonWill 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

NameDescription
static custom(customReasonProps)๐Ÿ”นA custom Reason that can match on multiple conditions.

static custom(customReasonProps)๐Ÿ”น

public static custom(customReasonProps: CustomReason): Reason

Parameters

  • customReasonProps CustomReason

Returns

  • Reason

A custom Reason that can match on multiple conditions.

Note that all specified conditions must be met for this reason to match.