Class RetryStrategy
Define how Jobs using this JobDefinition respond to different exit conditions.
Inheritance
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) | |
RetryStrategy(ByRefValue) | Used by jsii to construct an instance of this class from a Javascript-owned object reference |
RetryStrategy(DeputyBase.DeputyProps) | Used by jsii to construct an instance of this class from DeputyProps |
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)
RetryStrategy(ByRefValue)
Used by jsii to construct an instance of this class from a Javascript-owned object reference
protected RetryStrategy(ByRefValue reference)
Parameters
- reference Amazon.JSII.Runtime.Deputy.ByRefValue
The Javascript-owned object reference
RetryStrategy(DeputyBase.DeputyProps)
Used by jsii to construct an instance of this class from DeputyProps
protected RetryStrategy(DeputyBase.DeputyProps props)
Parameters
- props Amazon.JSII.Runtime.Deputy.DeputyBase.DeputyProps
The deputy props
Properties
Action
The action to take when the job exits with the Reason specified.
public virtual Action Action { get; }
Property Value
On
If the job exits with this Reason it will trigger the specified Action.
public virtual Reason On { get; }
Property Value
Methods
Of(Action, Reason)
Create a new RetryStrategy.
public static RetryStrategy Of(Action action, Reason on)
Parameters
Returns