https://prefect.io logo
l

Leon Kozlowski

11/19/2021, 6:03 PM
Hi all - I am wondering what the best way is to determine what agent a flow is running on while its in progress
a

Anna Geller

11/19/2021, 6:07 PM
the easiest way would be to do find that out through labels, e.g. if you have the label “dev” assigned to a specific agent, and the same label is assigned to a flow’s run configuration
l

Leon Kozlowski

11/19/2021, 6:13 PM
would that be say a subclassed Task’s context?
a

Anna Geller

11/19/2021, 6:16 PM
it’s an attribute of a run configuration. You can see it in the UI under flow. From code, you could inspect it this way:
Copy code
from prefect.run_configs import LocalRun
run_config=LocalRun(labels=["dev"])

# inspecting:
run_config.labels
{'dev'}
k

Kevin Kho

11/19/2021, 6:32 PM
You can go to the
Agents
tab in the dashboard and it will give you the view
l

Leon Kozlowski

11/19/2021, 7:23 PM
I had terrible wording in my question, I mean in the context of inside a task
k

Kevin Kho

11/19/2021, 7:25 PM
It might have to be a graphql query. It won’t be in context
This is how the UI does it
l

Leon Kozlowski

11/19/2021, 7:31 PM
Got it - thank you
k

Kevin Kho

11/19/2021, 7:34 PM
Actually this might not help because you need to know the agent ids head of time to check
l

Leon Kozlowski

11/19/2021, 7:44 PM
I think I can solve the issue I’m facing with configmap values for my agent - its basically agent specific configuration values
k

Kevin Kho

11/19/2021, 7:48 PM
That sounds good
7 Views