@aws-cdk_aws-batch-alpha.MultiNodeJobDefinition

class MultiNodeJobDefinition (construct) ๐Ÿ”น

LanguageType name
.NETAmazon.CDK.AWS.Batch.Alpha.MultiNodeJobDefinition
Gogithub.com/aws/aws-cdk-go/awscdkbatchalpha/v2#MultiNodeJobDefinition
Javasoftware.amazon.awscdk.services.batch.alpha.MultiNodeJobDefinition
Pythonaws_cdk.aws_batch_alpha.MultiNodeJobDefinition
TypeScript (source)@aws-cdk/aws-batch-alpha ยป MultiNodeJobDefinition

Implements IConstruct, IDependable, IResource, IJobDefinition

A JobDefinition that uses Ecs orchestration to run multiple containers.

Example

import * as cdk from 'aws-cdk-lib';
const multiNodeJob = new batch.MultiNodeJobDefinition(this, 'JobDefinition', {
  instanceType: ec2.InstanceType.of(ec2.InstanceClass.R4, ec2.InstanceSize.LARGE),
  containers: [{
    container: new batch.EcsEc2ContainerDefinition(this, 'mainMPIContainer', {
      image: ecs.ContainerImage.fromRegistry('yourregsitry.com/yourMPIImage:latest'),
      cpu: 256,
      memory: cdk.Size.mebibytes(2048),
    }),
    startNode: 0,
    endNode: 5,
  }],
});
// convenience method
multiNodeJob.addContainer({
  startNode: 6,
  endNode: 10,
  container: new batch.EcsEc2ContainerDefinition(this, 'multiContainer', {
    image: ecs.ContainerImage.fromRegistry('amazon/amazon-ecs-sample'),
    cpu: 256,
    memory: cdk.Size.mebibytes(2048),
  }),
});

Initializer

new MultiNodeJobDefinition(scope: Construct, id: string, props: MultiNodeJobDefinitionProps)

Parameters

  • scope Construct
  • id string
  • props MultiNodeJobDefinitionProps

Construct Props

NameTypeDescription
instanceType๐Ÿ”นInstanceTypeThe instance type that this job definition will run.
containers?๐Ÿ”นMultiNodeContainer[]The containers that this multinode job will run.
jobDefinitionName?๐Ÿ”นstringThe name of this job definition.
mainNode?๐Ÿ”นnumberThe index of the main node in this job.
parameters?๐Ÿ”น{ [string]: any }The default parameters passed to the container These parameters can be referenced in the command that you give to the container.
propagateTags?๐Ÿ”นbooleanWhether to propogate tags from the JobDefinition to the ECS task that Batch spawns.
retryAttempts?๐Ÿ”นnumberThe number of times to retry a job.
retryStrategies?๐Ÿ”นRetryStrategy[]Defines the retry behavior for this job.
schedulingPriority?๐Ÿ”นnumberThe priority of this Job.
timeout?๐Ÿ”นDurationThe timeout time for jobs that are submitted with this job definition.

instanceType๐Ÿ”น

Type: InstanceType

The instance type that this job definition will run.


containers?๐Ÿ”น

Type: MultiNodeContainer[] (optional, default: none)

The containers that this multinode job will run.

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


jobDefinitionName?๐Ÿ”น

Type: string (optional, default: generated by CloudFormation)

The name of this job definition.


mainNode?๐Ÿ”น

Type: number (optional, default: 0)

The index of the main node in this job.

The main node is responsible for orchestration.


parameters?๐Ÿ”น

Type: { [string]: any } (optional, default: none)

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

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


propagateTags?๐Ÿ”น

Type: boolean (optional, default: false)

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


retryAttempts?๐Ÿ”น

Type: number (optional, default: 1)

The number of times to retry a job.

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


retryStrategies?๐Ÿ”น

Type: RetryStrategy[] (optional, default: no RetryStrategy)

Defines the retry behavior for this job.


schedulingPriority?๐Ÿ”น

Type: number (optional, default: 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.


timeout?๐Ÿ”น

Type: Duration (optional, default: no 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.

Properties

NameTypeDescription
containers๐Ÿ”นMultiNodeContainer[]The containers that this multinode job will run.
env๐Ÿ”นResourceEnvironmentThe environment this resource belongs to.
instanceType๐Ÿ”นInstanceTypeThe instance type that this job definition will run.
jobDefinitionArn๐Ÿ”นstringThe ARN of this job definition.
jobDefinitionName๐Ÿ”นstringThe name of this job definition.
node๐Ÿ”นNodeThe tree node.
retryStrategies๐Ÿ”นRetryStrategy[]Defines the retry behavior for this job.
stack๐Ÿ”นStackThe stack in which this resource is defined.
mainNode?๐Ÿ”นnumberThe index of the main node in this job.
parameters?๐Ÿ”น{ [string]: any }The default parameters passed to the container These parameters can be referenced in the command that you give to the container.
propagateTags?๐Ÿ”นbooleanWhether to propogate tags from the JobDefinition to the ECS task that Batch spawns.
retryAttempts?๐Ÿ”นnumberThe number of times to retry a job.
schedulingPriority?๐Ÿ”นnumberThe priority of this Job.
timeout?๐Ÿ”นDurationThe timeout time for jobs that are submitted with this job definition.

containers๐Ÿ”น

Type: MultiNodeContainer[]

The containers that this multinode job will run.


env๐Ÿ”น

Type: ResourceEnvironment

The environment this resource belongs to.

For resources that are created and managed by the CDK (generally, those created by creating new class instances like Role, Bucket, etc.), this is always the same as the environment of the stack they belong to; however, for imported resources (those obtained from static methods like fromRoleArn, fromBucketName, etc.), that might be different than the stack they were imported into.


instanceType๐Ÿ”น

Type: InstanceType

The instance type that this job definition will run.


jobDefinitionArn๐Ÿ”น

Type: string

The ARN of this job definition.


jobDefinitionName๐Ÿ”น

Type: string

The name of this job definition.


node๐Ÿ”น

Type: Node

The tree node.


retryStrategies๐Ÿ”น

Type: RetryStrategy[]

Defines the retry behavior for this job.


stack๐Ÿ”น

Type: Stack

The stack in which this resource is defined.


mainNode?๐Ÿ”น

Type: number (optional)

The index of the main node in this job.

The main node is responsible for orchestration.


parameters?๐Ÿ”น

Type: { [string]: any } (optional)

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


propagateTags?๐Ÿ”น

Type: boolean (optional)

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


retryAttempts?๐Ÿ”น

Type: number (optional)

The number of times to retry a job.

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


schedulingPriority?๐Ÿ”น

Type: number (optional)

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.


timeout?๐Ÿ”น

Type: Duration (optional)

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.

Methods

NameDescription
addContainer(container)๐Ÿ”นAdd a container to this multinode job.
addRetryStrategy(strategy)๐Ÿ”นAdd a RetryStrategy to this JobDefinition.
applyRemovalPolicy(policy)๐Ÿ”นApply the given removal policy to this resource.
toString()๐Ÿ”นReturns a string representation of this construct.
static fromJobDefinitionArn(scope, id, jobDefinitionArn)๐Ÿ”นrefer to an existing JobDefinition by its arn.

addContainer(container)๐Ÿ”น

public addContainer(container: MultiNodeContainer): void

Parameters

  • container MultiNodeContainer

Add a container to this multinode job.


addRetryStrategy(strategy)๐Ÿ”น

public addRetryStrategy(strategy: RetryStrategy): void

Parameters

  • strategy RetryStrategy

Add a RetryStrategy to this JobDefinition.


applyRemovalPolicy(policy)๐Ÿ”น

public applyRemovalPolicy(policy: RemovalPolicy): void

Parameters

  • policy RemovalPolicy

Apply the given removal policy to this resource.

The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you've removed it from the CDK application or because you've made a change that requires the resource to be replaced.

The resource can be deleted (RemovalPolicy.DESTROY), or left in your AWS account for data recovery and cleanup later (RemovalPolicy.RETAIN).


toString()๐Ÿ”น

public toString(): string

Returns

  • string

Returns a string representation of this construct.


static fromJobDefinitionArn(scope, id, jobDefinitionArn)๐Ÿ”น

public static fromJobDefinitionArn(scope: Construct, id: string, jobDefinitionArn: string): IJobDefinition

Parameters

  • scope Construct
  • id string
  • jobDefinitionArn string

Returns

  • IJobDefinition

refer to an existing JobDefinition by its arn.