Amazon Batch Events - Amazon Batch
Amazon Web Services 文档中描述的 Amazon Web Services 服务或功能可能因区域而异。要查看适用于中国区域的差异,请参阅中国的 Amazon Web Services 服务入门

本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。

Amazon Batch Events

Amazon Batch 将任务状态更改事件发送到 EventBridge。Amazon Batch 跟踪任务的状态。如果之前提交的作业的状态发生更改,将调用事件。例如,如果在RUNNING状态移到FAILED状态。这些事件归类为作业状态更改事件。

注意

Amazon Batch将来可能会增加其他事件类型、源和详细信息。如果您以编程方式对事件 JSON 数据反序列化,请确保应用程序已准备好处理未知属性,以避免在添加这些附加属性时出现问题。

作业状态更改事件

只要现有 (以前提交的) 作业状态发生更改,就会创建事件。有关 Amazon Batch 任务状态的更多信息,请参阅作业状态

注意

对于初始作业提交不会创建事件。

例 作业状态更改事件

Job 状态更改事件以下面的形式传送 (detail部分类似于JobDetailDescribeJobs API operation in the Amazon BatchAPI 参考)。有关 的更多信息EventBridge参数,请参阅事件和事件模式中的亚马逊EventBridge用户指南.

{ "version": "0", "id": "c8f9c4b5-76e5-d76a-f980-7011e206042b", "detail-type": "Batch Job State Change", "source": "aws.batch", "account": "123456789012", "time": "2022-01-11T23:36:40Z", "region": "us-east-1", "resources": [ "arn:aws:batch:us-east-1:123456789012:job/4c7599ae-0a82-49aa-ba5a-4727fcce14a8" ], "detail": { "jobArn": "arn:aws:batch:us-east-1:123456789012:job/4c7599ae-0a82-49aa-ba5a-4727fcce14a8", "jobName": "event-test", "jobId": "4c7599ae-0a82-49aa-ba5a-4727fcce14a8", "jobQueue": "arn:aws:batch:us-east-1:123456789012:job-queue/PexjEHappyPathCanary2JobQueue", "status": "RUNNABLE", "attempts": [], "createdAt": 1641944200058, "retryStrategy": { "attempts": 2, "evaluateOnExit": [] }, "dependsOn": [], "jobDefinition": "arn:aws:batch:us-east-1:123456789012:job-definition/first-run-job-definition:1", "parameters": {}, "container": { "image": "137112412989.dkr.ecr.us-east-1.amazonaws.com/amazonlinux:latest", "command": [ "sleep", "600" ], "volumes": [], "environment": [], "mountPoints": [], "ulimits": [], "networkInterfaces": [], "resourceRequirements": [ { "value": "2", "type": "VCPU" }, { "value": "256", "type": "MEMORY" } ], "secrets": [] }, "tags": { "resourceArn": "arn:aws:batch:us-east-1:123456789012:job/4c7599ae-0a82-49aa-ba5a-4727fcce14a8" }, "propagateTags": false, "platformCapabilities": [] } }