foreachazure-data-factoryparameter-passingazure-notebooks

ADF for each child item results in duplication of parameters


I have a ADF pipeline in which I use the get metadata activity to get all the files that were modified today followed by a foreach activity that runs a notebook activity for each modified file. The foreach is defined as: @activity('Get modified files').output.childItems

In the for each activity I have a set variable activity where I define in which subfolder I can find the modified file. That variable is then passed to a pipeline which calls a synapse notebook.

Everything works as expected until I call the synapse notebook, that's when the parameters are being duplicated and the notebook will run multiple times for the same parameter instead of for each child item.

Subfolders variables that show 2 different variable values:

Pipeline that is triggered twice for the same value:

Does anyone know what causes the duplication of the parameter that is passed to the notebook?


Solution

  • Azure Data Facotory foreach iterations run in parallel, so they might override the variables of other iterations. This is by design to improve performance.

    Your options are:

    1. Running foreach sequentially by checking that box in the settings tab

    foreach setting

    1. Use the same values you put into the variables directly whenever you meant to use the variables. i.e. when calling the child pipeline. child pipeline