简体   繁体   English

Azure 数据工厂 V2 逻辑或

[英]Azure Data Factory V2 logical OR

Is it possible to create a logical OR for Azure Data Factory V2 pipeline activities?是否可以为 Azure 数据工厂 V2 管道活动创建逻辑或? For example, we have two copy activities and on fails of any of its the Data Factory should call an API.例如,我们有两个复制活动,如果其中任何一个活动失败,数据工厂都应该调用 API。

在此处输入图像描述

Yes, we can.我们可以。

You could add a If Condition to create the logical pipeline.您可以添加If 条件来创建逻辑管道。 If the two copy active output status contains 'failed', then call the API.如果两个副本活动 output 状态包含“失败”,则调用 API。

As we know, each copy active has the output has the bellow details:正如我们所知,每个激活的副本都有 output 具有以下详细信息:

"executionDetails": [
        {
            "source": {
                "type": "AzureSqlDatabase",
                "region": "East US"
            },
            "sink": {
                "type": "AzureSqlDatabase",
                "region": "East US"
            },
            "status": "Succeeded",
            "start": "2020-07-08T05:37:33.9079553Z",
            "duration": 4,
            "usedDataIntegrationUnits": 4,
            "usedParallelCopies": 1,
            "profile": {
                "queue": {
                    "status": "Completed",
                    "duration": 2
                },
                "transfer": {
                    "status": "Completed",
                    "duration": 1,
                    "details": {
                        "readingFromSource": {
                            "type": "AzureSqlDatabase",
                            "workingDuration": 0,
                            "timeToFirstByte": 0
                        },
                        "writingToSink": {
                            "type": "AzureSqlDatabase",
                            "workingDuration": 0
                        }
                    }
                }
            },

We can set the executionDetails:{"status": "Succeeded"} to the if-condition active:我们可以将executionDetails:{"status": "Succeeded"}设置为 if 条件激活: 在此处输入图像描述

Expression: No matter which actives failed, all the API:表达式:无论哪个活动失败,所有 API:

@or(equals(activity('Copy data1').output.executionDetails.status,'Failed'),equals(activity('Copy data2').output.executionDetails.status,'Failed') )

If condition true, add the true active to call the API:如果条件为真,则添加真正的活动来调用 API: 在此处输入图像描述

If all the copy actives are "succeeded"(condition false) and we don't want to do anything, we don't need to add the false active.如果所有复制活动都“成功”(条件为假)并且我们不想做任何事情,我们不需要添加假活动。

Hope this helps.希望这可以帮助。

Not that I know about.不是我知道的。 When an activity has multiple conditions, they are treated as an AND condition, meaning that both copy activities have to fail to execute the web activity.当一个活动有多个条件时,它们被视为 AND 条件,这意味着两个复制活动都必须无法执行 web 活动。

One common pattern to do this is create a pipeline that encapsulates the logic to report errors, and call it from each activity's failurem, capturing error output to a pipeline parameter.执行此操作的一种常见模式是创建一个封装逻辑以报告错误的管道,并从每个活动的失败中调用它,将错误 output 捕获到管道参数。

Hope this helped!希望这有帮助!

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

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