Hi. This sounds like a noob question. How do I cha...
# prefect-server
s
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
Copy code
home_dir = "/mnt/disks/prefect_data/.prefect"
to
.prefect/config.toml
, but results are still saved on my main disk
a
@Stéphan Taljaard which result class do you use, just LocalResult?
s
Yup, only LocalResult
a
You can specify dir as follows:
Copy code
from prefect import Flow, task
from prefect.engine.results import LocalResult

@task(result=LocalResult(dir='~/Desktop/HelloWorld/results'))
def my_task():
    return 3
s
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
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:
Copy code
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):
Copy code
prefect server config --volume-path /Users/stephan/some/path
k
You can set the env variable too here
s
I'm trying this out. I'll give feedback.