Nic
10/28/2022, 9:21 AMdef cache_within_flow_run(context, parameters):
return f"{context.flow_run_id}-{task_input_hash(context, parameters)}"
How would i pass the flow_run_id into the task this function and further into the task decorator?
@task(cache_key_fn=cache_within_flow_run)
def cached_task():
print('running an expensive operation')
return 42
Mason Menges
10/28/2022, 9:29 PMNic
11/01/2022, 8:48 AMAttributeError: 'TaskRunContext' object has no attribute 'flow_run_id'
def cache_within_flow_run(context, parameters):
cont_dict = context.task_run.dict()
return f"{cont_dict['flow_run_id']}-{task_input_hash(context, parameters)}"