Calvin Pritchard
03/17/2021, 6:43 PMtest.py
from prefect import task, Flow
from prefect.engine.results import LocalResult
OUTPUT_DIR = './outputs'
@task(target='x.txt', checkpoint=True, result=LocalResult(dir=OUTPUT_DIR))
def saver():
return 10
with Flow('example') as flow:
saved = saver()
flow.run()
when I run python test.py
I expect a file tree like
tree
.
├── outputs
│ └── x.txt
└── test.py
but when I run python test.py
I don't see an x.txt
file
.
├── outputs
└── test.py
I am using prefect==0.14.12
What do I need to do to get prefect
to save (and persist) file results?Jim Crist-Harif
03/17/2021, 6:47 PMflow.run()
you'll need to enable checkpointing at the config level as well. You can do this through either environment variables or by modifying your ~/.prefect/config.toml
file:
# Through environment variables
export PREFECT__FLOWS__CHECKPOINTING=true
# ~/.prefect/config.toml
[flows]
checkpointing = true
Jim Crist-Harif
03/17/2021, 6:48 PMCalvin Pritchard
03/17/2021, 6:49 PM