diff --git a/schemas/settings.yaml b/schemas/settings.yaml index 1009885ff..8e333c352 100644 --- a/schemas/settings.yaml +++ b/schemas/settings.yaml @@ -26,6 +26,10 @@ properties: notes: | This includes raw values such as commodity balance duals, which may be useful for debugging the model or understanding results in more detail. + copy_input_files: + type: boolean + description: Whether to copy input files to the output folder + default: true results_root: type: string description: Results root path to save MUSE2 results diff --git a/src/cli.rs b/src/cli.rs index c32c2da01..c38491ace 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -39,6 +39,10 @@ pub struct RunOpts { /// Whether to write additional information to CSV files #[arg(long)] pub debug_model: bool, + + /// Whether to skip copying input files to the output folder + #[arg(long)] + pub no_copy_input_files: bool, } /// Options for the `graph` command @@ -134,6 +138,9 @@ pub fn handle_run_command(model_path: &Path, opts: &RunOpts) -> Result<()> { if opts.overwrite { settings.overwrite = true; } + if opts.no_copy_input_files { + settings.copy_input_files = false; + } // Get path to output folder let pathbuf: PathBuf; @@ -161,9 +168,10 @@ pub fn handle_run_command(model_path: &Path, opts: &RunOpts) -> Result<()> { .to_str() .context("Invalid chars in model directory name")?; - copy_input_files(&model_path, output_path, model_name) - .context("Failed to copy input files to output directory.")?; - + if settings.copy_input_files { + copy_input_files(&model_path, output_path, model_name) + .context("Failed to copy input files to output directory.")?; + } // Initialise program logger log::init(&settings.log_level, Some(output_path)).context("Failed to initialise logging.")?; diff --git a/src/settings.rs b/src/settings.rs index 7403a1b3b..6697b9416 100644 --- a/src/settings.rs +++ b/src/settings.rs @@ -52,6 +52,8 @@ pub struct Settings { pub results_root: PathBuf, /// Results root path to save MUSE2 graph outputs. Defaults to `muse2_graphs`. pub graph_results_root: PathBuf, + /// Whether to copy input files to the output folder. + pub copy_input_files: bool, } impl Default for Settings { @@ -62,6 +64,7 @@ impl Default for Settings { debug_model: false, results_root: PathBuf::from("muse2_results"), graph_results_root: PathBuf::from("muse2_graphs"), + copy_input_files: true, } } } diff --git a/tests/regenerate_test_data.sh b/tests/regenerate_test_data.sh old mode 100755 new mode 100644 index 97ca78784..e65426642 --- a/tests/regenerate_test_data.sh +++ b/tests/regenerate_test_data.sh @@ -26,6 +26,9 @@ run_example() { env MUSE2_LOG_LEVEL=error MUSE2_USE_DEFAULT_SETTINGS=1 \ cargo -q run example run -o "data/$example" "$example" \ --overwrite $@ + env MUSE2_LOG_LEVEL=error MUSE2_USE_DEFAULT_SETTINGS=1 \ + cargo -q run example run -o "data/${example}_debug" "$example" \ + --overwrite --no-copy-input-files $@ } for example in $examples; do