https://prefect.io logo
d

Daniel Komisar

02/21/2022, 10:40 PM
Hello everyone, is it possible to add/remove labels from agents through the API with
update_agent_config
? Thanks!
a

Anna Geller

02/21/2022, 11:03 PM
If you want to change labels for a specific run, you can specify that on your run_config in the
create_flow_run
mutation. But if you want to change those run_config labels permanently, you would need to reregister the flow since run config is part of the metadata that gets stored in the API backend
d

Daniel Komisar

02/21/2022, 11:14 PM
Sorry if I wasn’t clear. I’m referring to changing what labels an agent has, not changing anything about the flows.
What I’m really trying to do is prevent an agent from running specific flows. Maybe there is an easier way, for example is it possible to set the concurrency limit to 0 for a specific flow?
k

Kevin Kho

02/22/2022, 3:20 AM
I believe that API mutation is not related to Agent labels, but Agent Automations so I think the answer here is no. A concurrency limit of 0 for a Flow would mean that the Flow is forever queued and never runs. Is that what you want? I think in this case you might have to restart the agent with additional/less labels.
a

Anna Geller

02/22/2022, 9:49 AM
As long as you set the labels properly on each flow's run configuration, you can ensure which agent will pick it up - that's the most straightforward approach. And changing labels requires registration to send new flow metadata to the backend. Also always setting unique labels when starting any agent can prevent that. Can you explain the problem a bit more? How many agents do you have?
5 Views