当内部活动出错时,直到循环不会中断 [英] Until loop does not break when an inner activity errors

查看:61
本文介绍了当内部活动出错时,直到循环不会中断的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个简单的until循环,通过Web活动调用rest api以获取DWH的状态。  IF块检查状态,如果不在线,则调用等待块5分钟。 如果状态为Online,则until循环设置为break,或者在指定的分钟数后超时
。 


如果Web调用失败(即身份验证问题,其余的api),然后该活动失败,但由于某种原因它没有打破直到循环。 


我找到解决这个问题的唯一方法就是下面的丑陋表达式直到循环:


@or(等于(活动('REST_GetDwhStatus')。输出?.properties?.status,'在线'),更大(合并(活动)('REST_GetDwhStatus ')。error?.errorCode,0),0)

解决方案

嗨Mark,


实现这一目标的一种方法是保持管道参数(比如说"重复")与Until循环一起使用。像这样的东西。您可以在Web活动执行完成后根据成功或失败设置此参数的值。


" @equals('false',
pipeline()。parameters.repeat)"


请看一下这个详细示例:


https://docs.microsoft.com/en-us/azure/data-factory/control-flow-until-activity#pipeline-with-until-activity -adfv2quickstartpipelinejson


I have a simple until loop that calls a rest api via the Web activity for status of a DWH.  An IF block checks the status and if not online, it calls a wait block for 5 minutes.  The until loop is set to break if the status is Online or time out after a specified number of minutes. 

If the web call fails (i.e. an authentication problem for the rest api), then that activity fails but it does not break the until loop for some reason. 

The only way I have found to solve this is the following ugly expression on the until loop:

@or(equals(activity('REST_GetDwhStatus').output?.properties?.status,'Online'),greater(coalesce(activity('REST_GetDwhStatus').error?.errorCode,0),0))

解决方案

Hi Mark,

One way to achieve this would be to keep a pipeline parameter (say "repeat") to use with the Until loop. Something like this. You can set the value of this parameter after your web activity execution completes - based on success or failure.

"@equals('false', pipeline().parameters.repeat)"

Please have a look at this example for details :

https://docs.microsoft.com/en-us/azure/data-factory/control-flow-until-activity#pipeline-with-until-activity-adfv2quickstartpipelinejson


这篇关于当内部活动出错时,直到循环不会中断的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆