Rafael
09/09/2021, 12:29 PMimport prefect
from prefect import task, Flow, Parameter
from prefect.engine.results import LocalResult
result = LocalResult(dir="./prefect-results", )
@task
def hello_task(named_params):
logger = prefect.context.get("logger")
<http://logger.info|logger.info>(named_params)
return 'asd'
with Flow("hello-flow", result=result) as flow:
named_params = Parameter("named_params",)
hello_task(named_params)
flow.run(named_params='param')
I was expecting to find a file in the the ./prefect-results
folder.. the folder is there but it is empty.. I also tried
import prefect
from prefect import task, Flow, Parameter
from prefect.engine.results import LocalResult
@task(checkpoint=True, result=LocalResult(dir="./prefect-results"))
def hello_task(named_params):
logger = prefect.context.get("logger")
<http://logger.info|logger.info>(named_params)
return 'asd'
with Flow("hello-flow", ) as flow:
named_params = Parameter("named_params",)
hello_task(named_params)
flow.run(named_params='param')
also empty..
Am I doing something wrong, or I misunderstood how this feature work?Abhishek
09/09/2021, 12:50 PMexport PREFECT__FLOWS__CHECKPOINTING=true
?
as mentioned here: https://docs.prefect.io/core/advanced_tutorials/using-results.html#setting-up-to-handle-resultsRafael
09/09/2021, 1:05 PMcheckpoint=True,
parameter I need to have this?Mariia Kerimova
09/09/2021, 1:19 PMFor Core-only users, you must:
Opt-in to checkpointing globally by setting the prefect.config.flows.checkpointing to "True"
which is equivalent to export PREFECT__FLOWS__CHECKPOINTING=true
,
but if you run your flow with backend (Prefect Server or Prefect Cloud, and you use flow.register
instead of flow.run
Checkpointing will automatically be turned on
Rafael
09/09/2021, 1:22 PM