Skip to content

Commit 2e37b94

Browse files
Merge pull request #233410 from chez-charlie/release-branch-1
Try Catch block for ADF
2 parents 49ad490 + 2a2bdfd commit 2e37b94

File tree

2 files changed

+13
-18
lines changed

2 files changed

+13
-18
lines changed
-11 KB
Loading

articles/data-factory/tutorial-pipeline-failure-error-handling.md

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Azure Data Factory and Synapse Pipeline orchestration allows conditional logic a
2727

2828
:::image type="content" source="media/tutorial-pipeline-failure-error-handling/pipeline-error-1-four-branches.png" alt-text="Screenshot showing the four branches out of an activity.":::
2929

30-
You may add multiple branches following an activity, with one exception: _Upon Completion_ path can't co-exist with either _Upon Success_ or _Upon Failure_ path. For each pipeline run, at most one path will be activated, based on the execution outcome of the activity.
30+
You may add multiple branches following an activity, with one exception: _Upon Completion_ path can't coexist with either _Upon Success_ or _Upon Failure_ path. For each pipeline run, at most one path is activated, based on the execution outcome of the activity.
3131

3232
## Error Handling
3333

@@ -61,7 +61,7 @@ Approach | Defines | When activity succeeds, overall pipeline shows | When activ
6161

6262
### How pipeline failure are determined
6363

64-
Different error handling mechanisms will lead to different status for the pipeline: while some pipelines fail, others succeed. We determine pipeline success and failures as follows:
64+
Different error handling mechanisms lead to different status for the pipeline: while some pipelines fail, others succeed. We determine pipeline success and failures as follows:
6565

6666
* Evaluate outcome for all leaves activities. If a leaf activity was skipped, we evaluate its parent activity instead
6767
* Pipeline result is success if and only if all nodes evaluated succeed
@@ -115,15 +115,15 @@ Here, the follow-up wait activity will only execute when both web activities wer
115115

116116
:::image type="content" source="media/tutorial-pipeline-failure-error-handling/conditional-and-1.png" alt-text="Screenshot showcasing pipeline proceeds only if both web activities succeed.":::
117117

118-
And here, the follow-up wait activity will execute when _ActivitySucceeded_ passes and _ActivityFailed_ completed. Note, with "Upon Success" path _ActivitySucceeded_ has to succeed, whereas _ActivityFailed_ on the "Upon Completion" path runs with best effort, that is, may fail.
118+
And here, the follow-up wait activity executes when _ActivitySucceeded_ passes and _ActivityFailed_ completed. Note, with "Upon Success" path _ActivitySucceeded_ has to succeed, whereas _ActivityFailed_ on the "Upon Completion" path runs with best effort, that is, may fail.
119119

120120

121121
:::image type="content" source="media/tutorial-pipeline-failure-error-handling/conditional-and-2.png" alt-text="Screenshot showcasing pipeline proceeds when first web activity succeeds and second web activity completes.":::
122122

123123
### Or
124124
Second common scenarios are conditional "or": run an activity if any of the dependencies succeeds or fails. Here we need to use "Upon Completion" paths, [If Condition activity](control-flow-if-condition-activity.md) and [expression language](control-flow-expression-language-functions.md).
125125

126-
Before we dive deep into code, we need to understand one more thing. After an activity ran and completed, you may reference its status with _@activity('ActivityName').Status_. It will be either _"Succeeded"_ or _"Failed"_. We'll use this property to build conditional or logic.
126+
Before we dive deep into code, we need to understand one more thing. After an activity ran and completed, you may reference its status with _@activity('ActivityName').Status_. It's either "Succeeded"_ or _"Failed"_. We use this property to build conditional or logic.
127127

128128
#### Shared error handling logging step
129129
In some cases, you may want to invoke a shared error handling or logging step, if any of the previous activities failed. You can build your pipeline like this:
@@ -134,7 +134,7 @@ In some cases, you may want to invoke a shared error handling or logging step, i
134134
```json
135135
@or(equals(activity('ActivityFailed').Status, 'Failed'), equals(activity('ActivitySucceeded').Status, 'Failed'))
136136
```
137-
* Note: you'll need concatenated or if you've more than two dependency activities, for instance,
137+
* Note: you need concatenated or if you've more than two dependency activities, for instance,
138138
```json
139139
@or(or(equals(activity('ActivityFailed').Status, 'Failed'), equals(activity('ActivitySucceeded1').Status, 'Failed')),equals(activity('ActivitySucceeded1').Status, 'Failed'))
140140
```
@@ -150,7 +150,7 @@ When all your activities are best effort, you may want to proceed to next step i
150150
```json
151151
@or(equals(activity('ActivityFailed').Status, 'Succeeded'), equals(activity('ActivitySucceeded').Status, 'Succeeded'))
152152
```
153-
* Note: the graph will look exactly like the previous scenario. The only difference is the expression language used
153+
* Note: the graph looks exactly like the previous scenario. The only difference is the expression language used
154154

155155
:::image type="content" source="media/tutorial-pipeline-failure-error-handling/conditional-or-2.png" alt-text="Screenshot showcasing pipeline proceeds to next step if any of the activities pass.":::
156156

@@ -168,18 +168,13 @@ The pattern is a combination of two: conditional and + error handling. The pipel
168168
:::image type="content" source="media/tutorial-pipeline-failure-error-handling/conditional-complex-1.png" alt-text="Screenshot showcasing pipeline proceeds to next step if any of the activities pass, or else runs error handling code.":::
169169

170170

171-
#### Try-Catch-Proceed
172-
The pattern is equivalent to try catch block in coding. It states that if either the activity or the error handling code succeeds, the pipeline should proceed. It's rather complicated and should only be reserved for the most mission critical steps.
173-
* add the mission critical work step
174-
* add an error handling activity to the _"Upon Failure"_ path of the main activity
175-
* add an if condition to contain next steps, in True branch
176-
* connect _"Upon Completion"_ path of the main activity to the condition activity
177-
* connect both _"Upon Success"_ and _"Upon Skip"_ paths of the error handling activity to the condition activity
178-
* logical expression for condition activity reads
179-
```json
180-
@or(equals(activity('ActivityFailed').Status, 'Succeeded'), equals(activity('ErrorHandling').Status, 'Succeeded'))
181-
```
182-
* Note the order of expressions: the main activity part has to come first, before the error handling activity part
171+
### Try-Catch-Proceed
172+
The pattern is equivalent to try catch block in coding. It states that if either the activity or the error handling code succeeds, the pipeline should proceed. We've simplified and streamlined the implementation for our customers. Try catch block doesn't need an if block.
173+
174+
* Add first activity
175+
* Add error handling to the UponFailure path
176+
* Add second activity, but don't connect to the first activity
177+
* Connect both UponFailure and UponSkip paths from the error handling activity to the second activity
183178

184179
:::image type="content" source="media/tutorial-pipeline-failure-error-handling/conditional-complex-2.png" alt-text="Screenshot showcasing pipeline with try catch block.":::
185180

0 commit comments

Comments
 (0)