Fabrice Toussaint
05/04/2021, 1:08 PMcache_for
parameter to 30 minutes, does this mean that every 30 minutes this task is rerun and cached again?
My downstream task fails because this upstream task contains a token (for 1 hour), so it seems as if this this is not happening in my case.Mariia Kerimova
05/04/2021, 1:21 PMcache_validators
or only cache_for
parameter?Fabrice Toussaint
05/04/2021, 1:37 PMKevin Kho
cache_for
task will not automatically re-run.Fabrice Toussaint
05/04/2021, 2:07 PMFabrice Toussaint
05/04/2021, 2:08 PMKevin Kho
Fabrice Toussaint
05/04/2021, 2:12 PMFabrice Toussaint
05/04/2021, 2:16 PM@task(cache_for=dt.timedelta(minutes=15), result=GCSResult(bucket="XXX", location=r"/{today}/{flow_run_id}/{task_run_id}.prefect_result"))
Fabrice Toussaint
05/04/2021, 2:16 PMKevin Kho
cache-key
instead?
@task(cache_for=datetime.timedelta(hours=1), cache_key="my-key")
Fabrice Toussaint
05/04/2021, 2:27 PMKevin Kho
Fabrice Toussaint
05/04/2021, 2:30 PMFabrice Toussaint
05/04/2021, 2:30 PMKevin Kho
Fabrice Toussaint
05/05/2021, 7:15 AMFabrice Toussaint
05/05/2021, 7:16 AMFabrice Toussaint
05/05/2021, 7:16 AMFabrice Toussaint
05/05/2021, 7:17 AMTypeError: 'NoneType' object is not iterable
Fabrice Toussaint
05/05/2021, 7:17 AMFabrice Toussaint
05/05/2021, 7:17 AM@task(cache_for=dt.timedelta(minutes=15), cache_key='shipment_analysis')
Kevin Kho
Fabrice Toussaint
05/06/2021, 7:32 AMKevin Kho
from prefect import Flow, task, Parameter
import prefect
import datetime
from prefect.engine.results import LocalResult
@task(cache_for=datetime.timedelta(minutes=5),
result=LocalResult(location="test/{flow_run_id}/{task_run_id}.prefect_result"),
cache_key="my-key")
def cache_task(x):
logger = prefect.context.get("logger")
<http://logger.info|logger.info>(x)
return x
@task
def next_task(x):
logger = prefect.context.get("logger")
<http://logger.info|logger.info>(f"This is the next task {x}")
return x
with Flow("cache-flow1") as flow:
x = Parameter("x", "12345")
c = cache_task(x)
next_task(c)
flow.register('tutorial')
Kevin Kho
Kevin Kho
Kevin Kho
Kevin Kho