MultiNodeContainer

class aws_cdk.aws_batch.MultiNodeContainer(*, container, end_node, start_node)

Bases: object

Runs the container on nodes [startNode, endNode].

Parameters:
  • container (IEcsContainerDefinition) – The container that this node range will run.

  • end_node (Union[int, float]) – The index of the last node to run this container. The container is run on all nodes in the range [startNode, endNode] (inclusive)

  • start_node (Union[int, float]) – The index of the first node to run this container. The container is run on all nodes in the range [startNode, endNode] (inclusive)

ExampleMetadata:

infused

Example:

multi_node_job = batch.MultiNodeJobDefinition(self, "JobDefinition",
    instance_type=ec2.InstanceType.of(ec2.InstanceClass.R4, ec2.InstanceSize.LARGE),  # optional, omit to let Batch choose the type for you
    containers=[batch.MultiNodeContainer(
        container=batch.EcsEc2ContainerDefinition(self, "mainMPIContainer",
            image=ecs.ContainerImage.from_registry("yourregsitry.com/yourMPIImage:latest"),
            cpu=256,
            memory=cdk.Size.mebibytes(2048)
        ),
        start_node=0,
        end_node=5
    )]
)
# convenience method
multi_node_job.add_container(
    start_node=6,
    end_node=10,
    container=batch.EcsEc2ContainerDefinition(self, "multiContainer",
        image=ecs.ContainerImage.from_registry("amazon/amazon-ecs-sample"),
        cpu=256,
        memory=cdk.Size.mebibytes(2048)
    )
)

Attributes

container

The container that this node range will run.

end_node

The index of the last node to run this container.

The container is run on all nodes in the range [startNode, endNode] (inclusive)

start_node

The index of the first node to run this container.

The container is run on all nodes in the range [startNode, endNode] (inclusive)