Thread
#prefect-community
    Tim Enders

    Tim Enders

    1 year ago
    How do I get access to the labels on a Flow? Are they in the Context object?
    I was expecting an empty
    labels
    item but I don't see one
    For context, I assign labels on deploy, but don't have them locally. In case labels just isn't there 100% of the time.
    Kevin Kho

    Kevin Kho

    1 year ago
    Hey @Tim Enders, I don’t think you can do this. You need to hit the GraphQL API to get the labels.
    What do you do with the labels once you have them?
    Tim Enders

    Tim Enders

    1 year ago
    I am evaluating them in a state_handler. We define our git branch there and I can tell what is
    master
    or not
    It looks like I can get the agent labels, which has the git branch as well
    Kevin Kho

    Kevin Kho

    1 year ago
    I see. I’m just throwing ideas out here, but maybe you can set the branch on the KV Store as well and pull it from there upon deployment?
    Tim Enders

    Tim Enders

    1 year ago
    Nah, I already have it available on deploy as an environment variable. But I don't have the envvar locally. The agent has empty labels locally so I SHOULD be able to use that and evaluate as a None for a local test