当我将文件上传到 s3 存储桶时,会触发一个事件并启动 AWS 批处理作业。有没有办法在我的java代码中检查AWS批处理作业的状态。当AWS批处理作业的状态为SUCCEEDED时,我必须执行一些操作。
最佳答案
您可以选择使用 ListJobs/DescribeJobs API 来轮询状态。
ListJobsResult listJobs(ListJobsRequest listJobsRequest) Returns a list 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 事件。
关于java - 检查AWS作业的状态,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65385931/