在 Java 中启动 AWS 批处理作业时,如何覆盖 vcpu 和内存要求?

问题描述

我有一个 AWS Batch 设置,其中我有使用 Vcpu=2 和 MEMORY=8192 的作业定义。然后,我使用 Java 中的 AWS SDK 来安排作业,并按如下方式覆盖资源要求:

val resourceRequirements = Seq(
  new ResourceRequirement().withType(ResourceType.Vcpu).withValue("16"),new ResourceRequirement().withType(ResourceType.MEMORY).withValue("32000")
)

val overrides = new ContainerOverrides()
  .withCommand(...)
  .withResourceRequirements(resourceRequirements: _*)

val request = new SubmitJobRequest()
  .withJobName(...)
  .withJobQueue(...)
  .withJobDeFinition(...)
  .withContainerOverrides(overrides)

阅读 SDK 文档字符串后,似乎 ResourceRequirement 可用于 EC2 和 Fargate 启动类型。我只能让它与 Fargate 一起工作。对于普通的 EC2 类型,我的资源需求似乎被忽略了,并且使用了认的资源需求,即使用 2vcpu 和 8192MB 内存启动作业。

ContainerOverrides 中有设置 vcpu 和内存的方法,但它们已被弃用,没有明确说明要做什么。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)