如何在Azure Synapse管道中构建OR行为?

huangapple go评论145阅读模式
英文:

How to build OR-behavior into Azure Synapse pipelines?

问题

我在Synapse中有一个管道,从多个REST端点重新加载数据。它的外观如下:如何在Azure Synapse管道中构建OR行为?

我想要实现的是,'CheckAccessTokenValidity'活动检查我的API令牌是否仍然有效。如果是的话,一切正常,继续执行ForEachDivision活动。如果不是,刷新令牌,然后继续执行ForEachDivision活动。

我以为我已经在提供的截图中实现了这个逻辑。然而,情况并非如此。我的管道现在因为ForEachDivision明显期望在运行之前所有三个先前的活动都成功完成(这在设计上是不可能的)而陷入了僵局。

如何在Azure Synapse中实现上述描述的逻辑?

英文:

I have a pipeline in Synapse that reloads data from a number of REST-endpoints. It looks as follows: 如何在Azure Synapse管道中构建OR行为?

What I want to achieve is that the 'CheckAccessTokenValidity' activity checks whether my API-token is still valid. If yes, all is fine, proceed to ForEachDivision activity. If no, refresh tokens, Proceed to ForEachDivision activity.

I thought I had implemented this logic in the screenshot provided. However, this is not the case. My pipeline is now deadlocked because the ForEachDivision apparently expects all three preceding activities to be succesful before running (Which is impossible by design).

How do I implement the logic described above in Azure Synapse?

答案1

得分: 1

  1. 创建一个名为'var1'的变量,默认将其设置为'False'。
  2. 在'CheckAccessTokenValidity'之后,添加一个设置变量活动'set variable1',指向'var1'并将其值设置为'True'。
  3. 在SetRefreshToken之后,再添加另一个设置变量活动'set variable2',指向相同的'var1',并将其值设置为'True',这样步骤2或3中的任何一个都可以将变量的值设置为'True'。
  4. 从此管道中删除所有从ForEach块开始的活动,将这些活动剪切并粘贴到另一个新管道'pipeline2'中。
  5. 在'set variable2'活动之后,附加一个If活动,具有'success'和'Skipped'的条件路径。如果步骤2成功,'set variable2'将被跳过,并将调用下一个活动,即'Step6'。如果步骤2失败,并且调用了步骤3,它将调用'set variable2',在其成功后,将完成Step6。
  6. 在此If活动中,编写条件以检查var1的值。如果var1 == 'True',则执行'pipeline2'。
英文:

You can modify your pipeline and accommodate following changes:

  1. Create a variable 'var1' , by default set it to 'False'
  2. After 'CheckAccessTokenValidity' , add set variable activity 'set variable1' pointing to 'var1' and set its value as 'True'
  3. After SetRefreshToken , add another set variable activity 'set variable2' pointing to same 'var1' and set its value as 'True' , so that either of the step 2 or 3 can turn the value of variable to 'True'.
  4. Remove all activities starting ForEach block from this pipeline and cut paste those activities and keep in another new pipeline 'pipeline2'
  5. After 'set variable2' activity, attach an If activity with 'success' and 'Skipped' conditional path . If step 2 gets successful, 'set variable2' would be skipped and it will call the next activity that is 'Step6' . If step 2 fails, and step 3 is called, it will call 'set variable2' and after its success, Step6 will be completed.
  6. In this if activity, write the condition to check the value of var1 . If var1=='True' , then execute the 'pipeline2'

huangapple
  • 本文由 发表于 2023年1月9日 16:22:05
  • 转载请务必保留本文链接:https://go.coder-hub.com/75054673.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定