Maybe I'm missing something obvious. Can't seem to...
# ask-community
a
Maybe I'm missing something obvious. Can't seem to persist my task/flow result. The folder
./test_prefect
is created but nothing is outputted. Here's my very simple code:
Copy code
## test_prefect.py
result = LocalResult(dir="./test_prefect")

@task(target="func_task_target.txt", checkpoint=True, result = result)
def test(val):
    return val

with Flow("simple_test",result=result) as test_flow:
    result = test(99)
    

test_flow.run()
I did set
PREFECT__FLOWS__CHECKPOINTING=true
before doing
python test_prefect.py
k
Hey @An Hoang, I think
LocalResult
takes in an absolute path. Could you try that?
a
@Kevin Kho I tried it and still didn't work. From the tutorial it seems like it also accepts relative path? https://docs.prefect.io/core/tutorial/07-next-steps.html#storing-task-results
k
One sec I’ll try this
Your code is working for me. What Prefect version are you on?
a
I'm on
0.15.1
. When I do
result.write()
it works, I thought it might have been a permission thing cause i'm ssh-ing into a server. Also did
prefect run
. No idea why it doesn't work
k
I upgraded to test and it still works. Are you running this in the same directory as the file? Just checking if the reltive paths are what you expect.
a
@Kevin Kho so I have more info: •
python test_prefect.py
with
test_flow.run()
in
test_prefect.py
creates the folder but not the file •
prefect run -p test_prefect.py -n "simple_test"
creates the folder but not the file. • both
prefect run -n simple_test --execute
(cloud backend) and
prefect run -n simple_test
(cloud backend with agent registered) creates the file!
k
I tried the
prefect run -p test_prefect.py -n "simple_test"
and
prefect run -p test_prefect.py
with the copy of the code you posted and both created a file for me on 0.15.1 🤔
What is your OS?
a
Copy code
LSB Version:	core-9.20170808ubuntu1-noarch:printing-9.20170808ubuntu1-noarch:security-9.20170808ubuntu1-noarch
Distributor ID:	Ubuntu
Description:	Ubuntu 18.04.5 LTS
Release:	18.04
Codename:	bionic
k
I think there shouldn’t be a problem on Ubuntu