@aws-cdk_aws-batch-alpha.CustomReason

interface CustomReason ๐Ÿ”น

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

The corresponding Action will only be taken if all of the conditions specified here are met.

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',
  })),
);

Properties

NameTypeDescription
onExitCode?๐Ÿ”นstringA glob string that will match on the job exit code.
onReason?๐Ÿ”นstringA glob string that will match on the reason returned by the exiting job For example, 'CannotPullContainerError*' indicates that container needed to start the job could not be pulled.
onStatusReason?๐Ÿ”นstringA glob string that will match on the statusReason returned by the exiting job.

onExitCode?๐Ÿ”น

Type: string (optional, default: will not match on the exit code)

A glob string that will match on the job exit code.

For example, '40*' will match 400, 404, 40123456789012


onReason?๐Ÿ”น

Type: string (optional, default: will not match on the reason)

A glob string that will match on the reason returned by the exiting job For example, 'CannotPullContainerError*' indicates that container needed to start the job could not be pulled.


onStatusReason?๐Ÿ”น

Type: string (optional, default: will not match on the status reason)

A glob string that will match on the statusReason returned by the exiting job.

For example, 'Host EC2*' indicates that the spot instance has been reclaimed.