Class MultiNodeJobDefinition

java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
software.amazon.awscdk.Resource
software.amazon.awscdk.services.batch.MultiNodeJobDefinition
All Implemented Interfaces:
IResource, IJobDefinition, software.amazon.jsii.JsiiSerializable, software.constructs.IConstruct, software.constructs.IDependable

@Generated(value="jsii-pacmak/1.98.0 (build 00b106d)", date="2024-05-08T21:35:03.451Z") @Stability(Stable) public class MultiNodeJobDefinition extends Resource implements IJobDefinition
A JobDefinition that uses Ecs orchestration to run multiple containers.

Example:

 MultiNodeJobDefinition multiNodeJob = MultiNodeJobDefinition.Builder.create(this, "JobDefinition")
         .instanceType(InstanceType.of(InstanceClass.R4, InstanceSize.LARGE)) // optional, omit to let Batch choose the type for you
         .containers(List.of(MultiNodeContainer.builder()
                 .container(EcsEc2ContainerDefinition.Builder.create(this, "mainMPIContainer")
                         .image(ContainerImage.fromRegistry("yourregsitry.com/yourMPIImage:latest"))
                         .cpu(256)
                         .memory(Size.mebibytes(2048))
                         .build())
                 .startNode(0)
                 .endNode(5)
                 .build()))
         .build();
 // convenience method
 multiNodeJob.addContainer(MultiNodeContainer.builder()
         .startNode(6)
         .endNode(10)
         .container(EcsEc2ContainerDefinition.Builder.create(this, "multiContainer")
                 .image(ContainerImage.fromRegistry("amazon/amazon-ecs-sample"))
                 .cpu(256)
                 .memory(Size.mebibytes(2048))
                 .build())
         .build());
 
  • Constructor Details

    • MultiNodeJobDefinition

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

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

      @Stability(Stable) public MultiNodeJobDefinition(@NotNull software.constructs.Construct scope, @NotNull String id, @Nullable MultiNodeJobDefinitionProps props)
      Parameters:
      scope - This parameter is required.
      id - This parameter is required.
      props -
    • MultiNodeJobDefinition

      @Stability(Stable) public MultiNodeJobDefinition(@NotNull software.constructs.Construct scope, @NotNull String id)
      Parameters:
      scope - This parameter is required.
      id - This parameter is required.
  • Method Details

    • fromJobDefinitionArn

      @Stability(Stable) @NotNull public static IJobDefinition fromJobDefinitionArn(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull String jobDefinitionArn)
      refer to an existing JobDefinition by its arn.

      Parameters:
      scope - This parameter is required.
      id - This parameter is required.
      jobDefinitionArn - This parameter is required.
    • addContainer

      @Stability(Stable) public void addContainer(@NotNull MultiNodeContainer container)
      Add a container to this multinode job.

      Parameters:
      container - This parameter is required.
    • addRetryStrategy

      @Stability(Stable) public void addRetryStrategy(@NotNull RetryStrategy strategy)
      Add a RetryStrategy to this JobDefinition.

      Specified by:
      addRetryStrategy in interface IJobDefinition
      Parameters:
      strategy - This parameter is required.
    • getContainers

      @Stability(Stable) @NotNull public List<MultiNodeContainer> getContainers()
      The containers that this multinode job will run.
    • getInstanceType

      @Stability(Stable) @NotNull public InstanceType getInstanceType()
      If the prop instanceType is left undefined, then this will hold a fake instance type, for backwards compatibility reasons.
    • getJobDefinitionArn

      @Stability(Stable) @NotNull public String getJobDefinitionArn()
      The ARN of this job definition.
      Specified by:
      getJobDefinitionArn in interface IJobDefinition
    • getJobDefinitionName

      @Stability(Stable) @NotNull public String getJobDefinitionName()
      The name of this job definition.
      Specified by:
      getJobDefinitionName in interface IJobDefinition
    • getRetryStrategies

      @Stability(Stable) @NotNull public List<RetryStrategy> getRetryStrategies()
      Defines the retry behavior for this job.
      Specified by:
      getRetryStrategies in interface IJobDefinition
    • getMainNode

      @Stability(Stable) @Nullable public Number getMainNode()
      The index of the main node in this job.

      The main node is responsible for orchestration.

    • getParameters

      @Stability(Stable) @Nullable public Map<String,Object> getParameters()
      The default parameters passed to the container These parameters can be referenced in the command that you give to the container.
      Specified by:
      getParameters in interface IJobDefinition
      See Also:
    • getPropagateTags

      @Stability(Stable) @Nullable public Boolean getPropagateTags()
      Whether to propogate tags from the JobDefinition to the ECS task that Batch spawns.
    • getRetryAttempts

      @Stability(Stable) @Nullable public Number getRetryAttempts()
      The number of times to retry a job.

      The job is retried on failure the same number of attempts as the value.

      Specified by:
      getRetryAttempts in interface IJobDefinition
    • getSchedulingPriority

      @Stability(Stable) @Nullable public Number getSchedulingPriority()
      The priority of this Job.

      Only used in Fairshare Scheduling to decide which job to run first when there are multiple jobs with the same share identifier.

      Specified by:
      getSchedulingPriority in interface IJobDefinition
    • getTimeout

      @Stability(Stable) @Nullable public Duration getTimeout()
      The timeout time for jobs that are submitted with this job definition.

      After the amount of time you specify passes, Batch terminates your jobs if they aren't finished.

      Specified by:
      getTimeout in interface IJobDefinition