Stéphan Taljaard
01/11/2023, 9:18 AMAleksandr Liadov
01/19/2023, 5:07 PMprefect.context.get_run_context().flow_run.dict()["id"]
Stéphan Taljaard
01/19/2023, 5:17 PM@task
async def set_flow_run_tags(tags: list[str]):
task_run_context = prefect.context.get_run_context()
flow_run_id = task_run_context.task_run.flow_run_id
async with prefect.client.orion.get_client() as client:
response = await client.update_flow_run(flow_run_id=flow_run_id, tags=tags)
@flow
def main():
set_flow_run_tags(["tags", "at", "runtime"])
You trust it should also work similarly if you want to do it inside the flow itself (i.e. not as a task)Aleksandr Liadov
01/20/2023, 8:43 AMStéphan Taljaard
01/20/2023, 8:47 AM