aws 批处理作业卡在可运行状态,对作业定义的内存要求很高

aws batch job stuck in runnable with high memory requirement for jobdefinition

我有一个批处理作业,它在内存要求 <15GB 时成功运行,但在需要更多内存时卡在可运行状态。

Batch troubleshooting 说这可能是因为资源不足:

Jobs Stuck in RUNNABLE Status

Insufficient resources

If your job definitions specify more CPU or memory resources than your compute resources can allocate, then your jobs will never be placed. For example, if your job specifies 4 GiB of memory, and your compute resources have less than that, then the job cannot be placed on those compute resources. In this case, you must reduce the specified memory in your job definition or add larger compute resources to your environment.

但是,ComputeResorces InstanceTypes 设置为 optimal 并且批处理显示为 select 不同的实例类型(例如 r4.large)基于更改到内存要求。所以我不明白为什么批处理无法 select 具有足够内存的适当资源。

可能发生的一件事是您的 AWS 帐户可能会达到 EC2 实例限制。这将阻止批处理能够启动足够大以适合您的工作的实例。

作业最终移出 Runnable 并成功完成(运行 使用 64GB 的最大作业)。因此,看起来可以使用 InstanceType of optimal.

正确设置计算资源

您应该做的是 shell 进入您的 EC2 实例并 运行 docker stats 当它处于 运行 状态时。这将显示实际容器 memory/cpu 利用率。

例如,我发现一个 docker 进程 运行 在我的计算机上以 900mb 占用了 ECS 中的 4gb(wtf?)。

此外,如果您的 AWS Batch 计算环境设置为 managed by AWS,那么它将自动扩展实例以满足您的需求,直到您达到 maximum vcpu 等硬限制。主机不应该 运行 内存不足,因为容器本身有预分配的内存。容器将 运行 在主机内存不足之前内存不足。