cancel
Showing results for 
Search instead for 
Did you mean: 

Execute each child pipeline multiple times

pranjbhatt
New Contributor III

Hi, 

I have a parent pipeline that is receiving an array of client_code.  I have mapped and routed it to two child pipelines and would like to execute the each of the child pipeline for each of the code. 

Let's say for 3 incoming client_codes. I want to execute each out of two child pipeline 3 times (so six parallel executions). Following is screenshot of parent pipeline.

 

pranjbhatt_0-1729526631008.png

 

1 ACCEPTED SOLUTION

SpiroTaleski
Valued Contributor

@pranjbhatt 

If thats the case then, in a Mapper Snap(befor the JSON Splitter), parse the String to JSON using JSON.parse function. 

View solution in original post

6 REPLIES 6

SpiroTaleski
Valued Contributor

Hey @pranjbhatt

You will need to split the incoming array of client codes using JSON Splitter Snap and then you will have the elements of the array as a separate documents. 

Hi, 

I am calling the client_code as JSON Object  {"clients" : [{ "client_code": "OHSU"}, {"client_code":"scj"}]}
in pipeline parameter before mapping, but it converts into a string before passing to JSON Splitter Snap. 

This throws error. 

SpiroTaleski
Valued Contributor

@pranjbhatt 

Why you are passing the object as a pipeline parameter? 

You should split the clients array, and then pass the array elements as inputs to the child pipelines. 

Hi @SpiroTaleski 
I am receiving client details and their tokens in pipeline parameters via airflow. They are in JSON object now, as follows- 

 

{
    "clients": [
        {
            "client_code": "OHSU",
            "client_token": "xxxxxx"
        },
        {
            "client_code": "scj",
            "client_token": "xxxxxx"
        }
    ]
}

 

 But, JSON Splitter snap still throws error, as pipeline parameters defaults it to String. Is there a way to parse above JSON before sending to child pipelines?