any tips on what to do when an agent gets "stuck?"...
# ask-community
h
any tips on what to do when an agent gets "stuck?" I have one agent that is responsible for kicking off flows every minute, and it often ends up where the agent is querying for flows, and there are submittable runs, but they never start.
oh that's interesting, I have a concurrency limit set to 1 (which prefect seems to think is being occupied, even though i don't think it is?)
a
@Hugo Shi does your flow take longer than one minute to finish? if that’s the case, then it makes sense that due to concurrency limit of 1 some runs are blocked and marked as late. If your end goal is for this task to never finish and be constantly running one flow run after the other, perhaps this state handler will work for you? https://gist.github.com/0dca1181d56e797f38390ad8850c54d7
h
@Anna Geller I want to run my flow every minute, but sometimes it takes longer than a minute (depending on how long it takes to write to snowflake) and when that happens, They flow runs back up. So I stated using concurrency limits to prevent the backup
If I use that state handler - will I end up with 1 flow run? Or will I always get new ones?
a
the example above will start a new run immediately after the previous run ended successfully - perhaps you can add time.sleep(30) to sleep for 30 seconds in between or so if you need some “break” in between runs? 🙂
h
no i don't need a break - I'll give it a shot, thanks!