Interface CustomReason

All Superinterfaces:
software.amazon.jsii.JsiiSerializable
All Known Implementing Classes:
CustomReason.Jsii$Proxy

@Generated(value="jsii-pacmak/1.103.1 (build bef2dea)", date="2024-09-18T22:16:52.524Z") @Stability(Stable) public interface CustomReason extends software.amazon.jsii.JsiiSerializable
The corresponding Action will only be taken if all of the conditions specified here are met.

Example:

 EcsJobDefinition jobDefn = EcsJobDefinition.Builder.create(this, "JobDefn")
         .container(EcsEc2ContainerDefinition.Builder.create(this, "containerDefn")
                 .image(ContainerImage.fromRegistry("public.ecr.aws/amazonlinux/amazonlinux:latest"))
                 .memory(Size.mebibytes(2048))
                 .cpu(256)
                 .build())
         .retryAttempts(5)
         .retryStrategies(List.of(RetryStrategy.of(Action.EXIT, Reason.CANNOT_PULL_CONTAINER)))
         .build();
 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(CustomReason.builder()
         .onExitCode("40*")
         .onReason("some reason")
         .build())));
 
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static final class 
    A builder for CustomReason
    static final class 
    An implementation for CustomReason
  • Method Summary

    Modifier and Type
    Method
    Description
     
    default String
    A glob string that will match on the job exit code.
    default String
    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.
    default String
    A glob string that will match on the statusReason returned by the exiting job.

    Methods inherited from interface software.amazon.jsii.JsiiSerializable

    $jsii$toJson
  • Method Details

    • getOnExitCode

      @Stability(Stable) @Nullable default String getOnExitCode()
      A glob string that will match on the job exit code.

      For example, '40*' will match 400, 404, 40123456789012

      Default: - will not match on the exit code

    • getOnReason

      @Stability(Stable) @Nullable default String getOnReason()
      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.

      Default: - will not match on the reason

    • getOnStatusReason

      @Stability(Stable) @Nullable default String getOnStatusReason()
      A glob string that will match on the statusReason returned by the exiting job.

      For example, 'Host EC2*' indicates that the spot instance has been reclaimed.

      Default: - will not match on the status reason

    • builder

      @Stability(Stable) static CustomReason.Builder builder()
      Returns:
      a CustomReason.Builder of CustomReason