Yaron Levi
06/18/2024, 8:36 AMdef on_failure(flow, flow_run, state):
# Would like somehow to get the tags from the deployment:
tags = flow.deployment.tags
print(tags)
@flow(name="test_flow", log_prints=True, on_failure=[on_failure])
def test_flow():
print('hello')
raise Exception('error')
test_flow()
Bianca Hoch
06/18/2024, 11:49 PMfrom prefect import flow
from prefect.logging.loggers import flow_run_logger
def on_failure(flow, flow_run, state):
flow_run_logger(flow_run, flow).info(f"Here are the tags for the flow {flow_run.tags}")
@flow(name="test_flow", log_prints=True, on_failure=[on_failure])
def test_flow():
print('hello')
raise Exception('error')
if __name__ == '__main__':
test_flow.serve(name="test_flow", tags=["my-nice-test-tag"])