可以在 AWS 批处理的 cloudformation 堆栈中为同一计算环境定义多个作业队列吗?

can one define multiple job queues for the same compute environment in a cloudformation stack for AWS batch?

我想在 AWS Batch 的 cloudformation 堆栈中为同一计算环境定义多个作业队列。

我有一个名为“*InterpreterTrainingJobQueue”的作业队列,另一个名为

"*ModelPromotionJobQueue"

如下定义,但只有最后一个作业队列“*ModelPromotionJobQueues”显示在 AWS Batch 控制台中。这是否意味着 AWS Batch 集群只能有 1 个作业队列?

目标是能够使用同一个 AWS Batch 集群将不同的作业发送到不同的队列。

  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]]

为每个作业队列更新新的资源 ID:

  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]]

因为您对两者使用相同的 ResourceId:JobQueue,CloudFormation 会覆盖第一个资源。尝试使用不同的名称,最好根据它们的用途。例如 InterpreterTrainingJobQueueModelPromotionJobQueue.