Is there any way to have one LocalAgent running mu...
# ask-community
t
Is there any way to have one LocalAgent running multiple flows at the same time?
k
or did you register them on Cloud and run them on the local agent?
t
yes
I am combining cloud with localagent on a virtual machine. i was wondering if it would be possible to define several flows, i dynamically registred them but i would also like to dynamically run agent(s) for all of them
k
It should run multiple flows at the same time. What are you seeing?
t
I know it sounds complicated or maybe I've made it too complicated, hahaha. let's say a have a dictionary: d = {"flow_1": Flow, "flow_2": Flow} i looped and registered the flows from this dict, now and then for the agent for name, flow in d.items(): flow.run_agent(token='blbala') of course this works for the first iteration and keeps listening, so I thought of declaring agent = LocalAgent and passing it the list of flows, then run the agent. maybe it is overcomplicated, but i was wondering, thanks
k
I think this is fine. I suggest you look into mapping and the StartFlowRun task. You can map the task to the list of flows, and then use a LocalDaskExecutor for parallelization.
t
excellent htanks
d
Hi @Tomás Emilio Silva Ebensperger, you can run a LocalAgent that will look for all flows with appropriate labels on that VM
flow.run_agent
is really designed just for testing
You definitely don’t need one agent per flow
Just make sure the agent’s Prefect version is greater than or equal to the version of Prefect you use for your Flow
t
dude THANK YOU. the thing is i have the same pipeline (same code) with parameterization for different clients, and the schedule logic is different for each one so i needed to have single flows for each client. but as youd said i dynamically registered everything and just ran the localagent and it is listening to all manual or scheduled executions of flows registered under that project, so it is perfect, i thought for a moment i had to also specified what flows inside the localagent, but it does it by itself, THANKS!!
🎉 2
d
You bet!