Interface ICustomReason
The corresponding Action will only be taken if all of the conditions specified here are met.
Namespace: Amazon.CDK.AWS.Batch
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public interface ICustomReason
Syntax (vb)
Public Interface ICustomReason
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
Properties
| OnExitCode | A glob string that will match on the job exit code. |
| OnReason | A glob string that will match on the reason returned by the exiting job For example, |
| OnStatusReason | A glob string that will match on the statusReason returned by the exiting job. |
Properties
OnExitCode
A glob string that will match on the job exit code.
string? OnExitCode { get; }
Property Value
Remarks
For example, '40*' will match 400, 404, 40123456789012
Default: - will not match on the exit code
OnReason
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.
string? OnReason { get; }
Property Value
Remarks
Default: - will not match on the reason
OnStatusReason
A glob string that will match on the statusReason returned by the exiting job.
string? OnStatusReason { get; }
Property Value
Remarks
For example, 'Host EC2*' indicates that the spot instance has been reclaimed.
Default: - will not match on the status reason