I have a pipeline (PL_Main) containing a set of Execute pipeline activities in sequence, as the below image depicts:
Now, I was trying to create an activity (executed after PL_Main completion) that allowed me to understand if any of the ‘childs’ Execute Pipeline activities (PL_1, PL_2, PL3.1, PL_3.2) failed.
However, according my understanding thee pipelines output contains only the RunId and PipelineName. Is there a way that I can find what were the pipelines in my execution chain that failed (or at least the 1st one failling) and store their RunId in as a parameter for my next activity (New Activity) ?
Thanks in advance to everybody!
2
Answers
Assuming you need to pass the pipelinerunid of the failed activity within Main pipeline, you need to deign the pipeline in below way :
JSON:
}
Reference blog : https://datasharkx.wordpress.com/2021/08/19/error-logging-and-the-art-of-avoiding-redundant-activities-in-azure-data-factory/
Note: the fail activities capture the pipelinerunid
Finaly to capture the ID:
You can try this approach also, to get the failed pipeline run id.
For this name the Execute pipeline activities name same as child pipeline names.
First get the Failed Execute pipeline activity name (Pipeline name) in the main pipeline using the error message.
Error message:
Use set variable to get this.
Get the pipeline name from the error message.
use the below expression for that.
You can see that we got the pipeline name in the variable
Now get all the pipeline runs from the Pipeline Runs – Query By Factory command.
Use this in web activity.
This will give you all pipeline runs details with names and run ids Json which you can see in the above documentation.
Now compare our pipeline name from variable in this JSON and get that particular run id which is our required failed pipeline run id. Use ForEach activity or filter for that.
Reference:
Check this SO thread for reference by KarthikBhyresh-MT