0
votes

I would like define multiple job queues for the same compute environment in a cloudformation stack for AWS Batch.

I have one job queue called "*InterpreterTrainingJobQueue" and another called

"*ModelPromotionJobQueue"

as defined below, but only the last job queue "*ModelPromotionJobQueues" shows up in the AWS Batch console. Does this mean that an AWS Batch cluster can only have 1 job queue?

The goal is to be able to send different jobs to different queues using the same AWS Batch cluster.

  JobQueue:
    Type: AWS::Batch::JobQueue
    Properties:
      ComputeEnvironmentOrder:
        # Use on-demand instances
        - Order: 1
          ComputeEnvironment: !Ref ComputeEnvironment
      State: ENABLED
      Priority: 1
      JobQueueName: !Join ['-', [!Ref ProjectName, 'InterpreterTrainingJobQueue', !Ref DeployName]]


  JobQueue:
    Type: AWS::Batch::JobQueue
    Properties:
      ComputeEnvironmentOrder:
        # Use on-demand instances
        - Order: 1
          ComputeEnvironment: !Ref ComputeEnvironment
      State: ENABLED
      Priority: 1
      JobQueueName: !Join ['-', [!Ref ProjectName, 'ModelPromotionJobQueue', !Ref DeployName]]

Update with new resource id's for each job queue:

  InterpreterTrainingJobQueue:
    Type: AWS::Batch::JobQueue
    Properties:
      ComputeEnvironmentOrder:
        # Use on-demand instances
        - Order: 1
          ComputeEnvironment: !Ref ComputeEnvironment
      State: ENABLED
      Priority: 1
      JobQueueName: !Join ['-', [!Ref ProjectName, 'InterpreterTrainingJobQueue', !Ref DeployName]]

  ModelPromotionJobQueue:
    Type: AWS::Batch::JobQueue
    Properties:
      ComputeEnvironmentOrder:
        # Use on-demand instances
        - Order: 1
          ComputeEnvironment: !Ref ComputeEnvironment
      State: ENABLED
      Priority: 1
      JobQueueName: !Join ['-', [!Ref ProjectName, 'ModelPromotionJobQueue', !Ref DeployName]]
1

1 Answers

1
votes

Because you are using the same ResourceId for both: JobQueue, CloudFormation overwrites the first resource. Try using a different name, preferably based on what their purpose is. E.g InterpreterTrainingJobQueue and ModelPromotionJobQueue.