https://prefect.io logo
#prefect-community
Title
# prefect-community
p

Patrick Tan

05/31/2022, 8:36 PM
Hi, I have 2 ECS containers, each with local agent connect to prefect cloud. When I invoke multiple flow run in parallel, the run distribution among agents are not balance. Eg, I start 10 flow runs in parallel, one agent pickup 9 run and the other agent pickup 1 run. How can we control this?
a

Anna Geller

05/31/2022, 9:06 PM
there is no load balancing between agents - this page explains it more given you spin this up for ECS, no need for more than 1 agent, it will scale as needed using Fargate serverless plane
p

Patrick Tan

06/01/2022, 1:19 PM
Let me tell you my scenario, I schedule to run job daily. When job run, it checks for number of files in landing zone and process all of them. I am using create_flow_run.map in prefect 1.0. This function starts all the flow run concurrently. If there are a lot of files that need to be processed, the container (1 agent) runs out of resources trying to process all files at the same time. I don’t think ECS (EC2 or Fargate) can autoscale vertically to handle increase number of flow run. Another way is to process files sequentially, one at a time. Can I do this with prefect 1.0? ie, only start next flow run when current flow run ends util all flow runs complete. Please advise
a

Anna Geller

06/01/2022, 1:49 PM
ECS Fargate can scale as much as your budget does since it's serverless - you can literally scale to ridiculous amounts of compute, you only need to be careful to watch your spend there
given your use case, mapping seems like the right approach to map over the files to process
to process your mapped flow runs sequentially, i.e. limit the concurrency, check this https://docs.prefect.io/orchestration/flow-runs/concurrency-limits.html#concurrency-limits
👍 1
3 Views