Jasono
10/19/2020, 4:08 PMContext object has no attribute 'today'
error when I try to get prefect.context.today
in the Flow block. According to the documentation, today
is one of those variables always available during task runs. What am I missing?Chris White
Jasono
10/19/2020, 4:31 PMwith Flow("prem_trend") as flow:
task = RenameFlowRunTask()
task(flow_run_id=prefect.context.flow_run_id), flow_run_name=f'run_{helpers.pstime()}')
flow_run_id
and replace the run name for it.Context object has no attribute flow_run_id
.Chris White
flow_run_name=f'run_{helpers.pstime()}'
This code is called once and the string is hardened when you first build this flow, it will not change each time you run the flow. If you want something dynamic, you should place this logic within your tasks or create new tasks that run this at runtime.
To be very precise in your example, I would do:
class MyRenameTask(RenameFlowRunTask):
def run(self):
return super.run(flow_run_id=prefect.context.flow_run_id), flow_run_name=f'run_{helpers.pstime()}')
Jasono
10/19/2020, 4:52 PMsuper
has no attribute run
Chris White
return super().run(flow_run_id=prefect.context.flow_run_id), flow_run_name=f'run_{helpers.pstime()}')
Jasono
10/19/2020, 5:04 PM