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