chris
01/04/2025, 3:14 AMMarvin
01/04/2025, 3:14 AMTaskRunContext
and a dictionary of input values. The TaskRunContext
provides task run metadata such as task_run_id
, flow_run_id
, and task
. This context is only available during a task run within Prefect, so if you try to run this script locally without Prefect, it will indeed "blow up" as the TaskRunContext
won't be available.
If you want to test your cache key function locally, you could mock the TaskRunContext
and the input dictionary, but it would require some setup to simulate the Prefect environment.
For more information, you can refer to the Prefect documentation on task caching.
Additionally, here's the Prefect top-level API for reference:
- flow
- task
- get_run_logger
- State
- allow_failure
- deploy
This should help you in understanding the context in which these functions operate.