4

I have an Azure data factory v2 pipeline containing an until activity.

Inside the until is a copy activity - if this fails, the error is logged, exactly as in this post, and I want the loop to continue.

Azure Data Factory Pipeline 'On Failure'

Although the inner copy activity’s error is handled, the until activity is deemed to have failed because an inner activity has failed.

ADF Screenshots

Is there any way to configure the until activity to continue when an inner activity fails?

Jason Welch
  • 896
  • 5
  • 9

1 Answers1

7

Solution

Put the error-handling steps in their own pipeline and run them from an ExecutePipeline activity. You'll need to pass-in all the parameters required from the outer pipeline.

You can then use the completion (blue) dependency from the ExecutePipeline (rather than success (green)) so the outer pipeline continues to run despite the inner error.

Note that if you want the outer to know what happened in the inner then there is currently no way to pass data out of the ExecutePipeline to its parent (https://feedback.azure.com/forums/270578-data-factory/suggestions/38690032-add-ability-to-customize-output-fields-from-execut).

To solve this, use an sp activity inside the ExecutePipeline to write data to a SQL table, identified with the pipeline run id. This can be referenced inside the pipeline with @pipeline().RunId.

Then outside the pipeline you can do a lookup in the SQL table, using the run ID to get the right row.

HEALTH WARNING:

For some weird reason, the output of ExecutePipeline is returned not as a JSON object but as a string. So if you try to select a property of output like this @activity('ExecutePipelineActivityName').output.something then you get this error:

Property selection is not supported on values of type 'String'

So, to get the ExecutePipeine's run ID from outside you need: @json(activity('ExecutePipelineActivityName').output).pipelineRunId

I couldn't find this documented in Microsoft's documentation anywhere, hence posting gory details here.

Jason Welch
  • 896
  • 5
  • 9
  • 9
    There's too many little gotchyas in ADF/Synapse Pipelines due to poor/inconsistent design and I know this comment adds no value but it needs to be said. It's painful. – Mark Z. Apr 29 '21 at 04:46