Hi folks, I am trying to figure out if there is a ...
# ask-community
m
Hi folks, I am trying to figure out if there is a simpler way than what I have in mind to ensure that only one flow run for a particular flow can run at a specific point in time
More specifically, if we want a specific flow to have one and only one flow run “Running” at a certain point in time, we need to make use of prefect flow concurrency labels in the following manner: 1. Create a flow concurrency label if it doesn’t exist. 2. Make sure the label is used when calling
flow.register()
3. Check the agent labels to see if this label already exists 4. If the label doesn’t exist, edit the agent deployment to add the label . This approach currently requires editing and re-deploying the agent each time a new flow is registered - which seems like a bit of an overkill
I guess it would be nice if there is a “global configuration” one can set in prefect cloud to make it the default for every flow in case what I mentioned is the only approach to achieve this
k
Hey @Marwan Sarieddine, Oof, it does seem like a bunch of steps when you lay them out haha, but I do believe this is the best way to set these limits. When you suggest a “global configuration”, are you referring to a label to put on all newly registered flows?
m
Hi @Kyle Moon-Wright -thanks for your response and for confirming that this is the current recommended approach. I suppose I was thinking of a solution that is not “label-oriented” - i.e. some flow/project/team level setting that sets this constraint once for all flows
k
Sure thing - labels are certainly the means to set limits currently and there are many ways to set them (Storage,
run_configs
, CLI, etc.), however I’m unaware of any other means to set concurrency limits. That being said, there is an issue for setting a Concurrency Limit on non-labeled flows which I think will be helpful in this situation, so this is definitely on our radar (for flows with a
None
label, basically).
a
Hi @Kyle Moon-Wright do you have a link to that issue?
k
Hey Alex - I believe this is internal-only currently, but feel free to open one to emphasize Community user support!
a
Ah, okay. Thanks!