简体   繁体   English

根据胶水作业运行 ID 获取工作流名称

[英]Get workflow name based on glue job run id

I have created a glue job (let's say job1) that will be used in multiple glue workflows using new triggers.我已经创建了一个胶水作业(假设是 job1),它将使用新触发器用于多个胶水工作流程。 I am trying to send an email notification in case the job1 fails.我正在尝试发送 email 通知以防 job1 失败。 I am triggering aws lambda function based on failed cloudwatch event (from job1).我正在根据失败的 cloudwatch 事件(来自 job1)触发 aws lambda function。

Below is the sample event response (event object in python):下面是示例事件响应(python 中的事件 object):

{
    "account": "12345678",
    "detail": {
        "jobName": "job1",
        "jobRunId": "jr_12355686960",
        "message": "Exception: Expecting value: line 1 column 1 (char 0)",
        "severity": "ERROR",
        "state": "FAILED"
    },
    "detail-type": "Glue Job State Change",
    "id": "fef2d09adasdasdasdasdas-d3-05f3a07adf70",
    "region": "us-east-1",
    "resources": [],
    "source": "aws.glue",
    "time": "2021-09-28T08:51:39Z",
    "version": "0"
}

The above event response is sent as an email through lambda function. Since the job1 is reused in multiple workflows, I would also like to include failed workflow name in the email. It seems there is no API to get workflow name based on the above details (for example, using job run id or job name).以上事件响应通过 lambda function 发送为 email。由于 job1 在多个工作流中重复使用,我还想在 email 中包含失败的工作流名称。似乎没有 API 可以根据上述详细信息获取工作流名称(例如,使用作业运行 ID 或作业名称)。 If there is any other approach (other than lambda function), you are welcome to comment.如果还有其他方法(lambda函数除外)欢迎大家评论。

The SDK get_job() command (boto3: get_job() ) returns several attributes in the response, such as Name, Description and others. SDK get_job() 命令 (boto3: get_job() ) 在响应中返回几个属性,例如名称、描述等。 That may have what you want.那可能有你想要的。 Otherwise, another of the get_x or describe_x commands will probably contain the information you want.否则,另一个 get_x 或 describe_x 命令可能会包含您想要的信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM