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.116.0 (build 0eddcff)",
date="2025-10-29T11:15:33.437Z")
@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());
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationModeNested classes/interfaces inherited from interface software.constructs.IConstruct
software.constructs.IConstruct.Jsii$DefaultNested classes/interfaces inherited from interface software.amazon.awscdk.services.batch.IJobDefinition
IJobDefinition.Jsii$Default, IJobDefinition.Jsii$ProxyNested classes/interfaces inherited from interface software.amazon.awscdk.IResource
IResource.Jsii$Default -
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedMultiNodeJobDefinition(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protectedMultiNodeJobDefinition(software.amazon.jsii.JsiiObjectRef objRef) MultiNodeJobDefinition(software.constructs.Construct scope, String id) MultiNodeJobDefinition(software.constructs.Construct scope, String id, MultiNodeJobDefinitionProps props) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddContainer(MultiNodeContainer container) Add a container to this multinode job.voidaddRetryStrategy(RetryStrategy strategy) Add a RetryStrategy to this JobDefinition.static IJobDefinitionfromJobDefinitionArn(software.constructs.Construct scope, String id, String jobDefinitionArn) refer to an existing JobDefinition by its arn.The containers that this multinode job will run.If the propinstanceTypeis leftundefined, then this will hold a fake instance type, for backwards compatibility reasons.The ARN of this job definition.The name of this job definition.The index of the main node in this job.The default parameters passed to the container These parameters can be referenced in thecommandthat you give to the container.Whether to propagate tags from the JobDefinition to the ECS task that Batch spawns.The number of times to retry a job.Defines the retry behavior for this job.The priority of this Job.The timeout time for jobs that are submitted with this job definition.Methods inherited from class software.amazon.awscdk.Resource
applyRemovalPolicy, generatePhysicalName, getEnv, getPhysicalName, getResourceArnAttribute, getResourceNameAttribute, getStack, isOwnedResource, isResourceMethods inherited from class software.constructs.Construct
getNode, isConstruct, toStringMethods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSetMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface software.constructs.IConstruct
getNodeMethods inherited from interface software.amazon.awscdk.IResource
applyRemovalPolicy, getEnv, getStackMethods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Field Details
-
PROPERTY_INJECTION_ID
Uniquely identifies this class.
-
-
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
Add a container to this multinode job.- Parameters:
container- This parameter is required.
-
addRetryStrategy
Add a RetryStrategy to this JobDefinition.- Specified by:
addRetryStrategyin interfaceIJobDefinition- Parameters:
strategy- This parameter is required.
-
getContainers
The containers that this multinode job will run. -
getInstanceType
If the propinstanceTypeis leftundefined, then this will hold a fake instance type, for backwards compatibility reasons. -
getJobDefinitionArn
The ARN of this job definition.- Specified by:
getJobDefinitionArnin interfaceIJobDefinition
-
getJobDefinitionName
The name of this job definition.- Specified by:
getJobDefinitionNamein interfaceIJobDefinition
-
getRetryStrategies
Defines the retry behavior for this job.- Specified by:
getRetryStrategiesin interfaceIJobDefinition
-
getMainNode
The index of the main node in this job.The main node is responsible for orchestration.
-
getParameters
The default parameters passed to the container These parameters can be referenced in thecommandthat you give to the container.- Specified by:
getParametersin interfaceIJobDefinition- See Also:
-
getPropagateTags
Whether to propagate tags from the JobDefinition to the ECS task that Batch spawns. -
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:
getRetryAttemptsin interfaceIJobDefinition
-
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:
getSchedulingPriorityin interfaceIJobDefinition
-
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:
getTimeoutin interfaceIJobDefinition
-