AWS Fargate中可能发生Spot中断的任务状态是什么?

huangapple go评论61阅读模式
英文:

In what task state can AWS Fargate spot interruption happen?

问题

我找不到关于AWS在哪个任务状态下会中断Fargate spot任务的文档。

  1. 在 "provisioning"、"pending" 和 "deprovisioning" 状态下是否会发生中断?
  2. 中断是否只会发生在 "running" 状态下?

我之所以问这个问题,是因为我在Fargate spot上运行的代码运行时间少于1分钟(远远低于终止持续时间 - 从警告到任务被停止)。所以在我的情况下,如果中断只在 "running" 状态下发生,我就不需要担心处理中断。

英文:

I couldn't find a documentation on, in which task state does AWS interrupt a Fargate spot task ?

  1. Can interruption happen during "provisioning", "pending" and "deprovisioning" states as well ?
  2. Do interruptions only happen during "running" state ?

I ask this because I have a code running on Fargate spot but runtime is less than 1 minute (way below termination duration - from warning to task being stopped). So in my case if interruption happens during "running" state only, I wouldn't bother about handling interruption.

答案1

得分: 0

虽然我没有找到关于这个的任何文档,但我已经像以下这样解决了这个问题:

# 如果任务在被中断时处于运行/去配置状态,就无需重新提交,因为我们的任务只需要不到2分钟就能完成。AWS会在2分钟之前发出警告,而我们的任务会在任务实际停止之前完成。
if task_state.lower() == "running" or task_state.lower() == "deprovisioning":
    run_task = False

对这个问题的回答将增加一般受众的知识,这就是为什么我会在这里留下这个问题的原因。

英文:

Although I haven't found any documentation on this, I have solved this like following:

# If task is in running/deprovisioning state when it was interrupted, no need to resubmit as our task takes less than 2 minutes to finish. AWS gives a 2 minutes warning and our task will finish before task is actually stopped
if task_state.lower() == "running" or task_state.lower == "deprovisioning":
    run_task = False

An answer to this question will add to knowledge of general audience is why I will leave the question here.

huangapple
  • 本文由 发表于 2023年8月4日 08:50:54
  • 转载请务必保留本文链接:https://go.coder-hub.com/76832342.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定