Class RetryStrategy

java.lang.Object
software.amazon.jsii.JsiiObject
software.amazon.awscdk.services.batch.RetryStrategy
All Implemented Interfaces:
software.amazon.jsii.JsiiSerializable

@Generated(value="jsii-pacmak/1.104.0 (build e79254c)", date="2024-11-15T10:24:55.488Z") @Stability(Stable) public class RetryStrategy extends software.amazon.jsii.JsiiObject
Define how Jobs using this JobDefinition respond to different exit conditions.

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/interfaces inherited from class software.amazon.jsii.JsiiObject

    software.amazon.jsii.JsiiObject.InitializationMode
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
     
     
    protected
    RetryStrategy(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
     
    protected
    RetryStrategy(software.amazon.jsii.JsiiObjectRef objRef)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    The action to take when the job exits with the Reason specified.
    If the job exits with this Reason it will trigger the specified Action.
    of(Action action, Reason on)
    Create a new RetryStrategy.

    Methods inherited from class software.amazon.jsii.JsiiObject

    jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSet

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface software.amazon.jsii.JsiiSerializable

    $jsii$toJson
  • Constructor Details

    • RetryStrategy

      protected RetryStrategy(software.amazon.jsii.JsiiObjectRef objRef)
    • RetryStrategy

      protected RetryStrategy(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
    • RetryStrategy

      @Stability(Stable) public RetryStrategy(@NotNull Action action, @NotNull Reason on)
      Parameters:
      action - This parameter is required.
      on - This parameter is required.
  • Method Details

    • of

      @Stability(Stable) @NotNull public static RetryStrategy of(@NotNull Action action, @NotNull Reason on)
      Create a new RetryStrategy.

      Parameters:
      action - This parameter is required.
      on - This parameter is required.
    • getAction

      @Stability(Stable) @NotNull public Action getAction()
      The action to take when the job exits with the Reason specified.
    • getOn

      @Stability(Stable) @NotNull public Reason getOn()
      If the job exits with this Reason it will trigger the specified Action.