Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

in start_bundle_coupled fail on missing files/dirs #1382

Merged
merged 1 commit into from
Sep 1, 2023
Merged
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
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ test-coupled: ## Test if the coupling with MAgPIE works. Takes significantly

test-coupled-slurm: ## test-coupled, but on slurm
$(info Coupling tests take around 75 minutes to run. Sent to slurm, find log in test-coupled.log)
@sbatch --qos=priority --wrap="make test-coupled" --job-name=test-coupled --mail-type=END --output=test-coupled.log
@sbatch --qos=priority --wrap="make test-coupled" --job-name=test-coupled --mail-type=END --output=test-coupled.log --comment="test-coupled.log"

test-full: ## Run all tests, including coupling tests and a default
## REMIND scenario. Takes significantly longer than 10 minutes to run.
Expand Down
3 changes: 3 additions & 0 deletions output.R
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,9 @@ if (! exists("outputdir")) {
dirnames <- if (length(dir_folder) == 1) basename(dirs) else dirs
names(dirnames) <- stringr::str_extract(dirnames, "rem-[0-9]+$")
names(dirnames)[is.na(names(dirnames))] <- ""
if (length(dirnames) == 0) {
stop("No directories found containing gdx", if (needingMif) " and mif", " files. Aborting.")
}
selectedDirs <- chooseFromList(dirnames, type = "runs to be used for output generation",
userinfo = paste0(if ("policyCosts" %in% output) "The reference run will be selected separately! " else NULL,
if (needingMif) "Do you miss a run? Check if .mif exists and rerun reporting. " else NULL),
Expand Down
25 changes: 15 additions & 10 deletions start_bundle_coupled.R
Original file line number Diff line number Diff line change
Expand Up @@ -155,16 +155,6 @@ if (length(argv) > 0) {
message("")
}

message("path_remind: ", if (dir.exists(path_remind)) green else red, path_remind, NC)
message("path_magpie: ", if (dir.exists(path_magpie)) green else red, path_magpie, NC)
message("path_settings_coupled: ", if (file.exists(path_settings_coupled)) green else red, path_settings_coupled, NC)
message("path_settings_remind: ", if (file.exists(path_settings_remind)) green else red, path_settings_remind, NC)
message("path_remind_oldruns: ", if (dir.exists(path_remind_oldruns)) green else red, path_remind_oldruns, NC)
message("path_magpie_oldruns: ", if (dir.exists(path_magpie_oldruns)) green else red, path_magpie_oldruns, NC)
message("prefix_runname: ", prefix_runname)
message("n600_iterations: ", n600_iterations)
message("run_compareScenarios: ", run_compareScenarios)

if (! file.exists("output")) dir.create("output")

ensureRequirementsInstalled(rerunPrompt = "start_bundle_coupled.R")
Expand All @@ -178,6 +168,21 @@ deletedFolders <- 0

stamp <- format(Sys.time(), "_%Y-%m-%d_%H.%M.%S")

message("path_remind: ", if (dir.exists(path_remind)) green else red, path_remind, NC)
message("path_magpie: ", if (dir.exists(path_magpie)) green else red, path_magpie, NC)
message("path_settings_coupled: ", if (file.exists(path_settings_coupled)) green else red, path_settings_coupled, NC)
message("path_settings_remind: ", if (file.exists(path_settings_remind)) green else red, path_settings_remind, NC)
message("path_remind_oldruns: ", if (dir.exists(path_remind_oldruns)) green else red, path_remind_oldruns, NC)
message("path_magpie_oldruns: ", if (dir.exists(path_magpie_oldruns)) green else red, path_magpie_oldruns, NC)
message("prefix_runname: ", prefix_runname)
message("n600_iterations: ", n600_iterations)
message("run_compareScenarios: ", run_compareScenarios)

if (any(! file.exists(c(path_settings_coupled, path_settings_remind))) ||
any(! dir.exists(c(path_remind, path_magpie, path_remind_oldruns, path_magpie_oldruns)))) {
stop("Missing files or directories, see in red above.")
}

orichters marked this conversation as resolved.
Show resolved Hide resolved
if ("--gamscompile" %in% flags && ! file.exists("input/source_files.log")) {
message("\n### Input data missing, need to compile REMIND first (2 min.)\n")
system("Rscript start.R config/tests/scenario_config_compile.csv")
Expand Down
Loading