feat: Copy/archive input XML files into the output directory#4030
feat: Copy/archive input XML files into the output directory#4030kdrienCG wants to merge 31 commits into
Conversation
Rename the archive output directory "archive_inputFiles" instead of "inputFiles". This prevents the archived XML files to unintentionally overwrite the standard "inputFiles" in GEOS/ when running with `-o .` where '.' is GEOS/ location
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
ProblemManager::generateDocumentation() used to create the XSD schema has undesired side-effects on the Problem. To mitigate this, the archiving has been moved after the basicSetup() in the main.cpp, and creates an isolated ProblemManager (like the tests) that will not propagate the side-effects, and make us able to copy the XSD schema to the archive.
Apparently, writing < and > between an existing XML tag in a code comment, like <Included> causes the doxygen test to fail.
|
@bd713 moving this to the review queue |
Prefer local copy first
bd713
left a comment
There was a problem hiding this comment.
Thanks, @kdrienCG.
Could you also update the GEOS documentation accordingly?
Typically QuickStart.rst for the new CLI flag, and maybe worth a brief description under Advanced XML Features.
| void copySchemaToArchive( string const & archiveDir ) | ||
| { | ||
| std::filesystem::path const candidates[] = { | ||
| GEOS_SCHEMA_SOURCE_PATH |
There was a problem hiding this comment.
Comma needed to actually construct the 2 candidates.
Otherwise schema archiving always fails in my tests.
| GEOS_SCHEMA_SOURCE_PATH | |
| GEOS_SCHEMA_SOURCE_PATH, |
| return inputFileName; | ||
| } | ||
|
|
||
| void collectIncluded( string const & filePath, |
There was a problem hiding this comment.
Are these 2 functions still needed for the current flattening strategy?
If not, I would suggest removing them for now.
| real64 printMemoryUsage = -1.0; | ||
|
|
||
| /// Set the archiving level | ||
| integer archiveInputDeck = 1; |
There was a problem hiding this comment.
This feature will be incredibly useful in our production environment. That said, I would personally keep the existing GEOS default behavior (no archiving) unchanged for regular usage, CI, etc.
Same for example as CSV output, which isn't on by default.
(Previously #4003)
This PR proposes to archive the XML input deck to the output directory, so that every set of results is accompanied by the exact input that produced it.
When GEOS is run with the new archive command line option (
-a LEVEL), all XML input files (and every files that are included via the<Included>XML tag) are flattened into a single file in a timestamped directory.Following suggestions from @rrsettgast and @bd713, the XML input files are "flattened" into a single XML file.
The following command line argument is added to specifiy the level of archiving wanted:
Given a run like:
The following is created:
Previous proposition
This PR proposes to automatically archive the XML input deck to the output directory, so that every set of results is accompanied by the exact input that produced it.
When GEOS is run with an output directory specified (
-o <dir>), all XML input files (and every files that are included via the<Included>XML tag) are copied into the output directory with a timestamp.Given a run like:
The following is created:
When included files are "behind" the input tree of the main XML, the following structure is proposed:
Files outside the input tree (reached via
../) are prefixed with__for every../fromfoo.xml.