Hen rik
11/11/2023, 2:22 PMHen rik
11/12/2023, 11:22 AM@flow(name="Event", log_prints=True, flow_run_name="{flow_name}")
def event(flow_name: str) -> int:
via api
def rename_flow_run(flow_name: str):
"""Renames the current flow"""
logger = get_run_logger()
# flow_name = str(prefect.context.get_run_context().flow_run.dict()['name'])
try:
flow_id = str(prefect.context.get_run_context().flow_run.dict()['id'])
requests.patch(f'<http://localhost:80/api/flow_runs/{flow_id}>',
headers={'Content-Type': 'application/json'},
data=json.dumps({'name': flow_name}), allow_redirects=False, timeout=30)
except (Exception,) as exc:
error_message = f'{exc.__class__.__name__}: {exc}'
logger.error("Unable to rename flow run [%s]", error_message)
same for tasks