Running each BATCH job on dedicated instance. How to?

0

Here is an example of a BATCH setup.

  sampleBatch:
    Type: AWS::Batch::ComputeEnvironment
    Properties:
      State: ENABLED
      Type: MANAGED
      ServiceRole: !GetAtt awsBatchServiceRole.Arn
      ComputeResources:
        MaxvCpus: 20
        MinvCpus: 0
        SecurityGroupIds:
          - !Join [ ",", !Ref "securityGroups" ]
        Type: EC2
        ImageId: !Ref batchAmiImage
        InstanceRole: !GetAtt ecsInstanceProfile.Arn
        InstanceTypes:
          - m4.large
        Ec2KeyPair: !Ref ec2KeyPair
        Subnets: !Ref subnets
        Tags:
          Name: "Testing Batch Env"

  sampleBatchJobQueue:
    Type: "AWS::Batch::JobQueue"
    Properties:
      ComputeEnvironmentOrder:
        - Order: 1
          ComputeEnvironment: !Ref sampleBatch
      State: ENABLED
      Priority: 1000

  sampleCnvBatchJobDefinition:
    Type: "AWS::Batch::JobDefinition"
    Properties:
      Type: container
      ContainerProperties:
        JobRoleArn: !Ref ecsTaskRole
        Image: !Sub "${AWS::AccountId}.dkr.ecr.${AWS::Region}.amazonaws.com/${dockerCnvCallerRepository}:latest"
        Vcpus: 2
        Memory: 2000
        MountPoints:
          - ReadOnly: false
            SourceVolume: genomics
            ContainerPath: /genomics
        Volumes:
          - Host:
              SourcePath: /genomics
            Name: genomics

When I submit multiple jobs, they get queued.
What I want to achieve is that Batch start new instance for each job.

I cannot find a combination of settings that will allow me to do this.

Any advice welcome.

gefragt vor 5 Jahren316 Aufrufe
2 Antworten
0

The solution is to wait a little bit in order to let Batch launch more instances = )

beantwortet vor 5 Jahren
0

I accomplished this by defining a job environment with a specific instance type. Then the job definition used that job environment with the specific cpu/memory requirements of that instance. This always ensured each job would run on its own instance.

beantwortet vor 5 Jahren

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen