gpt4 book ai didi

java - 检查 AWS 作业的状态

转载 作者:行者123 更新时间:2023-12-04 08:23:32 27 4
gpt4 key购买 nike

当我将文件上传到 s3 存储桶时,会触发一个事件并启动 AWS 批处理作业。有什么方法可以在我的 java 代码中检查 AWS 批处理作业的状态。当 AWS 批处理作业的状态为 SUCCEEDED 时,我必须执行一些操作。

最佳答案

您可以选择使用 ListJobs/DescribeJobs API 来轮询状态。

ListJobsResult listJobs(ListJobsRequest listJobsRequest) Returns alist of AWS Batch jobs.

You must specify only one of the following items:

  • A job queue ID to return a list of jobs in that job queue
  • A multi-node parallel job ID to return a list of that job's nodes
  • An array job ID to return a list of that job's children

You can filter the results by job status with the jobStatus parameter.If you don't specify a status, only RUNNING jobs are returned.


或者,如果您更喜欢事件驱动的架构,则可以监听在作业从一种状态转换到另一种状态时发出的 CloudWatch 事件。
ListJobsRequest

关于java - 检查 AWS 作业的状态,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65385931/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com