Orchestration allows conditional logic and enables users to take different paths based upon outcomes of a previous activity. Building upon the concepts of conditional paths, ADF and Synapse Pipelines allows users to build versatile and resilient work flows that can handle unexpected errors that work smoothly in auto-pilot mode.
This is an ongoing series that gradually levels up and helps you build even more complicated logic to handle more scenarios. We will walk through examples for some common use cases, and help you to build functional and useful work flows.
Please review the first installment in the series: Pipeline Logic 1: Error Handling and Best Effort Step.
In more advanced use cases, it is sometimes required to express the notion of OR: if any of the previous activity succeeded/failed, we should invoke a follow up activity. There are many variations of the requirement, and we will cover some common patterns in this category.
We will achieve this by combining conditional paths and the conditional if activity. With this implementation, an evaluation will be made after all dependency activities have completed (either succeeded or failed) and the pipeline will decide if the follow up activity should be invoked or not.
It is often the case that you would have a shared error handling/logging step in your workflow. This will be invoked if any of previous activities failed. You can build your pipeline like this:
(equals(activity('ActivityFailed').Status, 'Failed'), equals(activity('ActivitySucceeded').Status, 'Failed'))
Note: You'll need concatenated or if you have more than two dependency activities, for instance:(or(equals(activity('ActivityFailed').Status, 'Failed'), equals(activity('ActivitySucceeded1').Status, 'Failed')),equals(activity('ActivitySucceeded1').Status, 'Failed'))
(equals(activity('ActivityFailed').Status, 'Succeeded'), equals(activity('ActivitySucceeded').Status, 'Succeeded'))
This pattern combines the best of the two: conditional and + error handling. The pipeline proceeds to next steps if all proceeding activities succeed, or else it runs a shared error logging step. You can build your pipeline like this:
@and(equals(activity('ActivityFailed').Status, 'Succeeded'), equals(activity('ActivitySucceeded').Status, 'Succeeded'))
We hope that you have found this blog to be helpful! If you have any questions or feedback, please post them in the comments below.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.