Repository navigation
Write every file of a standalone run into one output folder - #129
Merged
Merged
Conversation
With [Output] output_dir the profile, the summary, the profile plot, the mantle P-T plot (named with id_mass) and the CLI log go into that folder and nothing into <root>/output or the working directory; without it a library call keeps <root>/output. The key takes an existing folder; other types, an empty value and a missing folder raise ValueError.
post_processing, the profile plot, the mantle P-T plot and the log of python -m zalmoxis write into output_dir when the config names it, an existing folder (the validator refuses other types, an empty value and a missing folder). Without the key a library call keeps <root>/output and the CLI sets that folder. The CLI holds the log lines of the config load in memory until the folder is known. The mantle P-T plot carries id_mass in its file name, as the profiles do.
The buffered log lines of the config load reach <output_dir>/zalmoxis.log also when the load raises; then the folder is <root>/output, which the CLI creates on a fresh checkout so that the config error is not hidden.
An unwritable folder is refused; post_processing checks a given folder it gets from a dict; plots alone create the default folder; a refused config keeps its error when the log cannot be opened and logs that error; the log is overwritten, formatted and at INFO; the real loader of a default.toml with output_dir sends the log there. Names at the edges replace the generated names.
The folder check also refuses a folder without write permission, and post_processing applies it to a given output_dir; without one it creates <root>/output for the data and the plots alike. The CLI logs the error of a refused config, logs to stderr when the folder cannot take the log, and swaps the buffer for the log file without a gap. The docs name the folder rules (relative paths, no ~ expansion, writable) and the DEBUG profile files that stay in <root>/output.
…log fallback warning A folder without search permission is refused like one without write permission; post_processing with data and plots off makes no folder; the CLI warns on stderr when zalmoxis.log cannot be opened. The logging fixtures close only the handlers they added.
… only when a file is written The folder check takes write and search permission, which a new file needs. post_processing makes <root>/output only when it writes data or plots. The CLI warns when zalmoxis.log cannot be opened and the log goes to stderr.
Both the output folder and the DEBUG profile folder keys stay; each keeps its own check, and the command-line run sets both defaults.
…folder Without debug_profile_dir, python -m zalmoxis sets it to output_dir, so a DEBUG run keeps every file of the run in one folder.
The configuration reference and the first-run tutorial cite each paper as Author (year) with a footnote that gives the authors, title, journal, volume, pages, year, DOI and SciX link. The PALEOS liquidus row cites Belonoshko et al. (2005) in Physical Review Letters and Fei et al. (2021) in Nature Communications, the papers that the PALEOS tables use.
…d the EOS caches write The output folder holds the files of python -m zalmoxis. The grid runner writes into the folder of its grid file and still needs a valid output_dir in its base config when that config sets one; the EOS caches stay beside their tables and in data/EOS_PALEOS_API.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
python -m zalmoxisnow writes all its files into one output folder: the profiles, the summary, the plots,zalmoxis.logand, at the DEBUG level, the 2 iteration profile files. The folder is the new[Output]keyoutput_dir(an existing, writable folder), or elseoutput/of the Zalmoxis root, which the run creates on a fresh checkout. Withoutdebug_profile_dir, the command-line run puts the DEBUG dump into the same folder; a library or PROTEUS caller that sets neither key writes no file, as with #128.load_zalmoxis_configandvalidate_configrefuse anoutput_dirthat is not a string or path, is empty, or is not an existing, writable folder.plot_PT_with_phasesadds the mass to its file name (mantle_PT_profile<mass>.pdf), so a batch run no longer overwrites one file per mass.tools/grids/run_grid.pydoes not useoutput_dir; usage.md says where it writes and which files stay outside the output folder (the EOS caches underdata/).The branch merges main after #128 (merge commit d1ff740); the conflicts were in input/default.toml, config.py,
__main__.py, AGENTS.md, configuration.md, usage.md and test_main_cli.py. The main test that mockedlogging.basicConfigfor the log path is replaced by tests on the real log file (path, overwrite, level, format) in tests/test_output_dir.py.No related issue.
Validation of changes
pytest tests/test_output_dir.py tests/test_output.py tests/test_main_cli.py tests/test_debug_profile_output.py tests/test_config_validators_extra.pygives 100 passed. Patch coverage of the changed source lines from these files: 28 of 30 (diff-cover); the 2 other lines are 1 plot call in each of plot_phase_vs_radius.py and plot_profiles.py.tests/test_main_cli.py::TestZalmoxisCli::test_main_passes_its_output_folder_for_the_debug_dumpchecks that the CLI passes its output folder asdebug_profile_dir(unless the config names one), andtests/test_debug_profile_output.py::test_debug_solve_writes_the_dump_into_the_given_folderchecks that a DEBUG solve writes both profile files into that folder.Behaviour to know:
post_processingchecksoutput_direven when data output and plots are both off. With data output or plots on and nooutput_dir, it creates the default folder before the solve.output_dir=Nonein a library dict is refused byvalidate_configbut means the default folder inpost_processing; one rule for both is a follow-up.Lines by category (
pr-breakdown 4a6fbd6 9ed4e7c):Checklist