Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions schemas/settings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 11 additions & 3 deletions src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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.")?;

Expand Down
3 changes: 3 additions & 0 deletions src/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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,
}
}
}
Expand Down
3 changes: 3 additions & 0 deletions tests/regenerate_test_data.sh
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading