Hey all, I feel like im missing something really s...
# ask-community
e
Hey all, I feel like im missing something really simple
Copy code
@task(result=LocalResult(location="initial_data.prefect"))
def root_task():
    return [1, 2, 3]


@task(result=LocalResult(location="{date:%A}/{task_name}.prefect"))
def downstream_task(x):
    return [i * 10 for i in x]


def rating_model_backtest_workflow(opts: dict):
    with Flow("local-results") as flow:
        downstream_task(root_task)

    flow.run()
I’m running this from the docs, I am expecting files to show up at
./initial_data.prefect
and the other location, but nothing appears, am I missing something obvious?
👀 1
OH i think i got it with 2 changes: • export PREFECT__FLOWS__CHECKPOINTING=true • file is at
~/prefect/results/./test_root.prefect
which was rather surprising
k
Glad you got this figured out. If you get a chance, could you move the log to the thread just to clear a bit more space in the main channel?
e
sure:
logs:
Copy code
[2021-08-26 10:33:36-0500] INFO - prefect.FlowRunner | Beginning Flow run for 'local-results'
[2021-08-26 10:33:36-0500] INFO - prefect.TaskRunner | Task 'root_task': Starting task run...
[2021-08-26 10:33:36-0500] INFO - prefect.TaskRunner | Task 'root_task': Finished task run for task with final state: 'Success'
[2021-08-26 10:33:36-0500] INFO - prefect.TaskRunner | Task 'downstream_task': Starting task run...
[2021-08-26 10:33:36-0500] INFO - prefect.TaskRunner | Task 'downstream_task': Finished task run for task with final state: 'Success'
[2021-08-26 10:33:36-0500] INFO - prefect.FlowRunner | Flow run SUCCESS: all reference tasks succeeded
k
Thanks!
e
is there a way to set this configuration directly in the workflow code without relying on environment var setup?
k
If you end up running with Prefect Cloud or Prefect Server, the checkpointing env var will always be true. You can also explicitly state it on the task level
@task(checkpointing=True)
e
ah perfect, thanks