Add `--tmp-dir` option for archive creation
Adds a new --tmp-dir command line option to verdi archive create that allows users to specify a custom directory for temporary files during archive creation.
Changes:
- New
--tmp-dirCLI option with validation (must exist and be writable) - Enhanced error handling for disk space issue
- Falls back to output file directory when not specified -> ! This is different from the previous behavior, where the file was always in
/tmp!
Use cases:
- File system has limited disk space
- Use faster storage (e.g., SSD) for temporary operations
- Need to control where temporary files are created for system administration reasons
Example:
verdi archive create --tmp-dir /fast/storage/tmp export.aiida
Codecov Report
:x: Patch coverage is 1.72414% with 57 lines in your changes missing coverage. Please review.
:white_check_mark: Project coverage is 29.19%. Comparing base (166d06c) to head (99eebb9).
:warning: Report is 4 commits behind head on main.
| Files with missing lines | Patch % | Lines |
|---|---|---|
| src/aiida/tools/archive/create.py | 0.00% | 57 Missing :warning: |
:exclamation: There is a different number of reports uploaded between BASE (166d06c) and HEAD (99eebb9). Click for more details.
HEAD has 1 upload less than BASE
Flag BASE (166d06c) HEAD (99eebb9) 2 1
Additional details and impacted files
@@ Coverage Diff @@
## main #6946 +/- ##
===========================================
- Coverage 79.59% 29.19% -50.39%
===========================================
Files 566 566
Lines 43540 43510 -30
===========================================
- Hits 34651 12699 -21952
- Misses 8889 30811 +21922
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
:rocket: New features to boost your workflow:
- :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
Dogfooding:
Note: I've discovered a different issue while dogfooding, see https://github.com/aiidateam/aiida-core/issues/6982
- Non-existing temporary directory ✅
> verdi archive create --tmp-dir /nonexistent -G workchain/PBEsol/bader/lumi bader.aiida
Usage: verdi archive create [OPTIONS] [--] OUTPUT_FILE
Try 'verdi archive create --help' for help.
Error: Invalid value for '--tmp-dir': Directory '/nonexistent' does not exist.
- No temporary directory specified ✅
> verdi archive create -G workchain/PBEsol/scf/gauss -- test.aiida
- Temporary directory specified ✅
> verdi archive create -G workchain/PBEsol/scf/gauss --tmp-dir ~/tmp -- test.aiida
- Temporary directory not specified, but different parent folder for archive ✅
> verdi archive create -G workchain/PBEsol/scf/gauss -- ~/tmp/test.aiida
I checked, and the temporary directories are indeed created in the desired locations. 👌
Falls back to output file directory when not specified -> ! This is different from the previous behavior, where the file was always in /tmp ! Thanks @GeigerJ2! Very happy to have this feature, and that the default path is now not in /tmp. I think having the parent of the filename makes a lot more sense.
Just for my curiosity, what were the problems of using /tmp?
Just for my curiosity, what were the problems of using
/tmp?
Running out of disk space on the machine running AiiDA due to creation of the temporary archive file.
@GeigerJ2 let me know when you want me to review this one again. Unless I am re-requested a review, I typically ignore open PRs that are changing.
@GeigerJ2 let me know when you want me to review this one again. Unless I am re-requested a review, I typically ignore open PRs that are changing.
Hi @mbercx, thank you for checking on this again. I'd like to finalize the decision if we even keep the --tmp-dir option, then add the necessary changes. Will start the discussion on slack again.