fmi-faim / ipa-project-template

Copier template for image processing & analysis projects.
https://fmi-faim.github.io/ipa-project-template/
MIT License
3 stars 2 forks source link

Check available space in pixi cache_dir before proceeding #20

Open imagejan opened 1 week ago

imagejan commented 1 week ago

To prevent usage of the project code without initializing (i.e. running init.sh at the beginning of your session), we could introduce a task that checks for a minimum available space in the cache_dir folder of the pixi configuration, and warns the user if they're running with a "wrong" cache directory.

For example, this bash snippet gives the current free space on the file system where cache_dir is located:

pixi info --json | grep -o '"cache_dir": "[^"]*' | grep -o '[^"]*$' | tr -d '\n' | xargs -0 -I {} df -P {} | tail -1 | awk '{print $4}'

We could use this - or a (platform-independent) Python equivalent from a minimal environment in pixi - to fail early if there's not enough space available. What do you think, @tibuch?

tibuch commented 1 week ago

Sounds like a good safeguard. I guess the task must exit(1) and fail, otherwise it will continue.