Sean Talia
01/12/2021, 5:33 PMwith Flow("test-flow") as flow:
if "label1" in flow.labels:
function1()
elif "label2" in flow.labels:
function2()Spencer
01/12/2021, 5:35 PMswitchJim Crist-Harif
01/12/2021, 5:38 PMprefect.config.cloud.agent.labels . You'd need to access this inside a task and use something like a case block to handle branching. https://docs.prefect.io/core/idioms/conditional.htmlSean Talia
01/12/2021, 5:45 PMJim Crist-Harif
01/12/2021, 5:48 PMprefect.config.agent.labels . This should be a list of string labels. You can do whatever logic you want with it inside tasks, or pass the labels between tasks as needed (the initial access of the field just needs to be done within a task so that it happens at runtime).
@task
def get_labels():
return prefect.config.agent.labelsSean Talia
01/12/2021, 5:48 PMJim Crist-Harif
01/12/2021, 5:48 PMSean Talia
01/12/2021, 5:51 PM