Jeff Quinn
10/03/2022, 5:13 PMfrom prefect import flow, task
from prefect.tasks import task_input_hash
Z = {
1: 1
}
@task(cache_key_fn=task_input_hash)
def task1():
return Z[1]
@flow
def flow1():
return task1()
If the values in some mutable data structure change, the cache isnt expired..Mason Menges
10/03/2022, 5:59 PMJeff Quinn
10/03/2022, 6:00 PMZ = 2
def calc():
return 1
def calc2():
return 2
@task(cache_key_fn=task_input_hash)
def task4():
return calc()
@flow
def flow4():
return task4()
changing between calc() and calc2() on line 9 here doesnt invalidate cache (!)with_options
i can avoid a cache hit, but the new result itself wont be cached, and the old cached value will remain in dbMason Menges
10/03/2022, 6:05 PMJeff Quinn
10/03/2022, 6:08 PMMason Menges
10/03/2022, 6:08 PMJeff Quinn
10/03/2022, 6:16 PM