为什么AWS Batch Jobs卡在RUNNABLE中?

arm*_*arm 21 amazon-web-services aws-batch aws-ecs

我在需求实例上使用0-256 m3.medium的计算环境.我的Job定义需要1个CPU和3 GB的Ram,m3.medium有.

AWS Batch Jobs陷入状态的可能原因是RUNNABLE什么?

AWS说:

A job that resides in the queue, has no outstanding dependencies, and is therefore ready to be scheduled to a host. Jobs in this state are started as soon as sufficient resources are available in one of the compute environments that are mapped to the job’s queue. However, jobs can remain in this state indefinitely when sufficient resources are unavailable.

但这不能回答我的问题

nac*_*oab 22

还有其他原因导致Job无法在RUNNABLE中陷入困境:

  • 与计算环境关联的角色的权限不足
  • Compute Environment实例无法访问Internet.您需要将NATInternet网关关联到Compute Environment子网.
    • 确保在计算环境的子网上选中"启用自动分配公共IPv4地址"设置.(@thisisbrians在评论中指出)
  • 你的形象有问题.您需要使用ECS优化的AMI或确保ECS容器代理正常工作.有关aws docs的更多信息
  • 您正尝试启动您的帐户限制为0个实例的实例(左侧菜单中的EC2控制台>限制).(阅读更多关于gergely-danyi的评论)
  • 并且如提到的资源不足

此外,请务必阅读AWS Batch故障排除

  • 在我的特定情况下,我必须检查计算环境子网上的"启用自动分配公共IPv4地址"设置以使我的作业运行. (5认同)
  • 对我而言,Batch尝试启动一个实例,该实例在EC2限制设置中限制为0个实例。检查以下内容:https://forums.aws.amazon.com/thread.jspa?threadID=263152我在计算资源中指定了“ c5”实例类型,即使c5.large的限制为5,批次还是决定启动一个限制为0的更大类型(而不是分解多个c5.large)。我将计算资源缩小到`c5.large`,从而解决了该问题。或者,您可以请求限制调整。 (2认同)
  • 在我的 aws 中,我可以看到新的 ec2 实例已创建,但是,批处理作业仍然处于可运行状态,然后实例继续运行,但是没有执行任何作业。 (2认同)

Pau*_*Pau 5

至少应使用下一个策略和可信关系来定义角色。如果没有,它们将因为没有足够的特权启动而陷入“可运行”状态:

 AWSBatchServiceRole

  • 附加政策: AWSBatchServiceRole
  • 信任关系: batch.amazonaws.com

    {
      "Version": "2012-10-17",
      "Statement": [
        {
          "Effect": "Allow",
          "Principal": {
             "Service": "batch.amazonaws.com"
           },
          "Action": "sts:AssumeRole"
        }
      ]
    }
    
    Run Code Online (Sandbox Code Playgroud)

ecsInstanceRole

  • 附加政策: AmazonEC2ContainerServiceforEC2Role
  • 信任关系: ec2.amazonaws.com

    {
      "Version": "2012-10-17",
      "Statement": [
        {
          "Effect": "Allow",
          "Principal": {
             "Service": "ec2.amazonaws.com"
           },
          "Action": "sts:AssumeRole"
        }
      ]
    }
    
    Run Code Online (Sandbox Code Playgroud)