英文:
Azure Data Factory Retrieve the status of ForEach Activity
问题
在Azure数据工厂中,是否可以检索ForEach活动的状态(成功、失败等),该活动迭代了许多项。我们希望在ForEach的OnComplete中存储ForEach的状态,然后调用存储过程。当我们尝试访问活动输出时,ForEach活动是不可用的。
英文:
In Azure Data Factory is it possible to retrieve the status (Succeeded, Failed etc) of a ForEach activity (that iterated over numerous items). We would like to store the status of ForEach in the OnComplete of ForEach in a stored procedure call. When we try to access activity outputs ForEach activity is not available.
答案1
得分: 1
Sure, here is the translated content:
>Azure Data Factory 获取 ForEach Activity 的状态。
ForEach activity 只是一个循环,它只迭代项目。它不提供任何输出,因此我们无法在外部获得 ForEach Activity 的活动输出。
满足您需求的唯一方法是如下设置 On success
和 on failure
的不同变量:
>我们正在尝试获取 ForEach Activity(总体)的状态。
正如我们所知,如果内部活动在单次运行中失败,ForEach Activity 也会失败,因此我们可以基于此创建以下逻辑。
-
创建追加变量活动,并使用表达式
@activity('Copy data1').output.executionDetails[0].status
从复制活动获取每次运行的状态。
-
然后,在 ForEach Activity 之外创建一个设置变量,并使用表达式
@if(contains(variables('activitystatus'),'Failed'),'Failed','Succeed')
设置值为 Failed,如果activitystatus
数组中存在 Failed,否则设置为 Succeed。
英文:
>Azure Data Factory Retrieve the status of ForEach Activity.
Foreach activity is just a loop it only iterates the items. It does not give any output because of it we can't get foreach activity in activity output outside of it.
The only work around to your requirement is to set different set variables for On success
and on failure
of foreach activity as below:
>We are trying to get the status of the foreach activity (overall).
As we know ForEach activity fails when the inner activity fails for a single time so based on that we can create logic below.
-
create append variable activity and get the status from the copy activity for each run with expression
@activity('Copy data1').output.executionDetails[0].status
-
After this create a set variable outside of the foreach activity and set the value Failed if Failed is present in
activitystatus
array otherwise Succeed with expression@if(contains(variables('activitystatus'),'Failed'),'Failed','Succeed')
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论