Apache Beam - How to control/limit the concurrency process of ParDo ?

2 years ago by hahattpro to c/ask_experienced_devs

The problem is I am using beam.ParDo to call api, to enrich my data.

pipeline | "read_csv" >> beam.io.ReadFromCsv("...") 
                | "get_info_api" >> beam.ParDo(GetApiDoFN()) 
                | "write_output" >>  beam.io.WriteToBigQuery(...)

The problem is that api have limit. I need a way to control so it do not overload api or get 429 error.

I would like to set api call should not exceed 4 call / second.

How should I do it ?

ask_experienced_devs
ask_experienced_devs

@programming.dev

login for more options
1517
63
9

Icon base by Delapouite under CC BY 3.0 with modifications to add a gradient

go to feed...