https://prefect.io logo
Title
s

Stéphan Taljaard

11/23/2021, 8:36 AM
Hi. This sounds like a noob question. How do I change the default folder for results? (I don't mind, or actually want to, move the whole config folder) I've tried adding
home_dir = "/mnt/disks/prefect_data/.prefect"
to
.prefect/config.toml
, but results are still saved on my main disk
a

Anna Geller

11/23/2021, 9:34 AM
@Stéphan Taljaard which result class do you use, just LocalResult?
s

Stéphan Taljaard

11/23/2021, 9:34 AM
Yup, only LocalResult
a

Anna Geller

11/23/2021, 9:35 AM
You can specify dir as follows:
from prefect import Flow, task
from prefect.engine.results import LocalResult

@task(result=LocalResult(dir='~/Desktop/HelloWorld/results'))
def my_task():
    return 3
s

Stéphan Taljaard

11/23/2021, 9:36 AM
1. Can't I specify it globally so as to not have to manually edit every single task (I have quite a few)? 2. I also want to move the postgres db files off to another disk (I want both the results and the db files on my
prefect_data
disk)
a

Anna Geller

11/23/2021, 9:48 AM
You could pass a callable to the location to avoid setting the dir every time, here is an example: https://gist.github.com/anna-geller/f4a0f745bc0af468c2068694ae76f6da But when it comes to setting a default home_dir, your approach was correct:
prefect.config.home_dir
# '/Users/anna/.prefect'
Regarding #2 you can set the database volume when starting the Server as follows - all configuration you can set on Server docker-compose file is available here (the intention is, you set everything through CLI rather than modifying the docker-compose file directly):
prefect server config --volume-path /Users/stephan/some/path
k

Kevin Kho

11/23/2021, 2:34 PM
You can set the env variable too here
s

Stéphan Taljaard

11/24/2021, 5:12 AM
I'm trying this out. I'll give feedback.