Show / Hide Table of Contents

Class Reason

Common job exit reasons.

Inheritance
object
Reason
Namespace: Amazon.CDK.AWS.Batch
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class Reason : DeputyBase
Syntax (vb)
Public Class Reason Inherits DeputyBase
Remarks

ExampleMetadata: infused

Examples
var jobDefn = new EcsJobDefinition(this, "JobDefn", new EcsJobDefinitionProps {
                Container = new EcsEc2ContainerDefinition(this, "containerDefn", new EcsEc2ContainerDefinitionProps {
                    Image = ContainerImage.FromRegistry("public.ecr.aws/amazonlinux/amazonlinux:latest"),
                    Memory = Size.Mebibytes(2048),
                    Cpu = 256
                }),
                RetryAttempts = 5,
                RetryStrategies = new [] { RetryStrategy.Of(Action.EXIT, Reason.CANNOT_PULL_CONTAINER) }
            });
            jobDefn.AddRetryStrategy(RetryStrategy.Of(Action.EXIT, Reason.SPOT_INSTANCE_RECLAIMED));
            jobDefn.AddRetryStrategy(RetryStrategy.Of(Action.EXIT, Reason.CANNOT_PULL_CONTAINER));
            jobDefn.AddRetryStrategy(RetryStrategy.Of(Action.EXIT, Reason.Custom(new CustomReason {
                OnExitCode = "40*",
                OnReason = "some reason"
            })));

Synopsis

Constructors

Reason()

Common job exit reasons.

Properties

CANNOT_PULL_CONTAINER

Will only match if the Docker container could not be pulled.

NON_ZERO_EXIT_CODE

Will match any non-zero exit code.

SPOT_INSTANCE_RECLAIMED

Will only match if the Spot instance executing the job was reclaimed.

Methods

Custom(ICustomReason)

A custom Reason that can match on multiple conditions.

Constructors

Reason()

Common job exit reasons.

public Reason()
Remarks

ExampleMetadata: infused

Examples
var jobDefn = new EcsJobDefinition(this, "JobDefn", new EcsJobDefinitionProps {
                Container = new EcsEc2ContainerDefinition(this, "containerDefn", new EcsEc2ContainerDefinitionProps {
                    Image = ContainerImage.FromRegistry("public.ecr.aws/amazonlinux/amazonlinux:latest"),
                    Memory = Size.Mebibytes(2048),
                    Cpu = 256
                }),
                RetryAttempts = 5,
                RetryStrategies = new [] { RetryStrategy.Of(Action.EXIT, Reason.CANNOT_PULL_CONTAINER) }
            });
            jobDefn.AddRetryStrategy(RetryStrategy.Of(Action.EXIT, Reason.SPOT_INSTANCE_RECLAIMED));
            jobDefn.AddRetryStrategy(RetryStrategy.Of(Action.EXIT, Reason.CANNOT_PULL_CONTAINER));
            jobDefn.AddRetryStrategy(RetryStrategy.Of(Action.EXIT, Reason.Custom(new CustomReason {
                OnExitCode = "40*",
                OnReason = "some reason"
            })));

Properties

CANNOT_PULL_CONTAINER

Will only match if the Docker container could not be pulled.

public static Reason CANNOT_PULL_CONTAINER { get; }
Property Value

Reason

Remarks

ExampleMetadata: infused

NON_ZERO_EXIT_CODE

Will match any non-zero exit code.

public static Reason NON_ZERO_EXIT_CODE { get; }
Property Value

Reason

Remarks

ExampleMetadata: infused

SPOT_INSTANCE_RECLAIMED

Will only match if the Spot instance executing the job was reclaimed.

public static Reason SPOT_INSTANCE_RECLAIMED { get; }
Property Value

Reason

Remarks

ExampleMetadata: infused

Methods

Custom(ICustomReason)

A custom Reason that can match on multiple conditions.

public static Reason Custom(ICustomReason customReasonProps)
Parameters
customReasonProps ICustomReason
Returns

Reason

Remarks

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

Back to top Generated by DocFX