Show / Hide Table of Contents

Class RetryStrategy

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

Inheritance
object
RetryStrategy
Namespace: Amazon.CDK.AWS.Batch
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class RetryStrategy : DeputyBase
Syntax (vb)
Public Class RetryStrategy 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

RetryStrategy(Action, Reason)

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

Properties

Action

The action to take when the job exits with the Reason specified.

On

If the job exits with this Reason it will trigger the specified Action.

Methods

Of(Action, Reason)

Create a new RetryStrategy.

Constructors

RetryStrategy(Action, Reason)

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

public RetryStrategy(Action action, Reason on)
Parameters
action Action
on 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

Action

The action to take when the job exits with the Reason specified.

public virtual Action Action { get; }
Property Value

Action

Remarks

ExampleMetadata: infused

On

If the job exits with this Reason it will trigger the specified Action.

public virtual Reason On { get; }
Property Value

Reason

Remarks

ExampleMetadata: infused

Methods

Of(Action, Reason)

Create a new RetryStrategy.

public static RetryStrategy Of(Action action, Reason on)
Parameters
action Action
on Reason
Returns

RetryStrategy

Remarks

ExampleMetadata: infused

Back to top Generated by DocFX