MultiNodeJobDefinitionProps

class aws_cdk.aws_batch.MultiNodeJobDefinitionProps(*, job_definition_name=None, parameters=None, retry_attempts=None, retry_strategies=None, scheduling_priority=None, timeout=None, containers=None, instance_type=None, main_node=None, propagate_tags=None)

Bases: JobDefinitionProps

Props to configure a MultiNodeJobDefinition.

Parameters:
  • job_definition_name (Optional[str]) – The name of this job definition. Default: - generated by CloudFormation

  • parameters (Optional[Mapping[str, Any]]) – The default parameters passed to the container These parameters can be referenced in the command that you give to the container. Default: none

  • retry_attempts (Union[int, float, None]) – The number of times to retry a job. The job is retried on failure the same number of attempts as the value. Default: 1

  • retry_strategies (Optional[Sequence[RetryStrategy]]) – Defines the retry behavior for this job. Default: - no RetryStrategy

  • scheduling_priority (Union[int, float, None]) – 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. Default: none

  • timeout (Optional[Duration]) – 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. Default: - no timeout

  • containers (Optional[Sequence[Union[MultiNodeContainer, Dict[str, Any]]]]) – The containers that this multinode job will run. Default: none

  • instance_type (Optional[InstanceType]) – The instance type that this job definition will run. Default: - optimal instance, selected by Batch

  • main_node (Union[int, float, None]) – The index of the main node in this job. The main node is responsible for orchestration. Default: 0

  • propagate_tags (Optional[bool]) – Whether to propogate tags from the JobDefinition to the ECS task that Batch spawns. Default: false

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

containers

The containers that this multinode job will run.

Default:

none

See:

https://aws.amazon.com/blogs/compute/building-a-tightly-coupled-molecular-dynamics-workflow-with-multi-node-parallel-jobs-in-aws-batch/

instance_type

The instance type that this job definition will run.

Default:
  • optimal instance, selected by Batch

job_definition_name

The name of this job definition.

Default:
  • generated by CloudFormation

main_node

The index of the main node in this job.

The main node is responsible for orchestration.

Default:

0

parameters

The default parameters passed to the container These parameters can be referenced in the command that you give to the container.

Default:

none

See:

https://docs.aws.amazon.com/batch/latest/userguide/job_definition_parameters.html#parameters

propagate_tags

Whether to propogate tags from the JobDefinition to the ECS task that Batch spawns.

Default:

false

retry_attempts

The number of times to retry a job.

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

Default:

1

retry_strategies

Defines the retry behavior for this job.

Default:
  • no RetryStrategy

scheduling_priority

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.

Default:

none

timeout

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.

Default:
  • no timeout