Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
R
remind
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jerome Hilaire
remind
Commits
e8c0a5a5
Commit
e8c0a5a5
authored
5 years ago
by
David Klein
Browse files
Options
Downloads
Patches
Plain Diff
Start scripts: improve the readibility of the screen output
parent
63997f31
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!50
Adapt scripts for manually restarting subsequent runs to the new structure of start scripts. New input.gdx. Cosmetics
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
scripts/start/submit.R
+4
-4
4 additions, 4 deletions
scripts/start/submit.R
start.R
+14
-7
14 additions, 7 deletions
start.R
with
18 additions
and
11 deletions
scripts/start/submit.R
+
4
−
4
View file @
e8c0a5a5
...
...
@@ -15,7 +15,7 @@
submit
<-
function
(
cfg
)
{
cat
(
"Creating results folder for"
,
cfg
$
title
,
"\n"
)
cat
(
"
Creating results folder for"
,
cfg
$
title
,
"\n"
)
# Generate name of output folder and create the folder
date
<-
format
(
Sys.time
(),
"_%Y-%m-%d_%H.%M.%S"
)
...
...
@@ -27,7 +27,7 @@ submit <- function(cfg) {
}
else
if
(
!
cfg
$
force_replace
)
{
stop
(
paste0
(
"Results folder "
,
cfg
$
results_folder
,
" could not be created because it already exists."
))
}
else
{
cat
(
"Deleting results folder because it alreay exists:"
,
cfg
$
results_folder
,
"\n"
)
cat
(
"
Deleting results folder because it alreay exists:"
,
cfg
$
results_folder
,
"\n"
)
unlink
(
cfg
$
results_folder
,
recursive
=
TRUE
)
dir.create
(
cfg
$
results_folder
,
recursive
=
TRUE
,
showWarnings
=
FALSE
)
}
...
...
@@ -39,7 +39,7 @@ submit <- function(cfg) {
# Do not save the new name of the results folder to the .RData file in REMINDs main folder, because it
# might be needed to restart subsequent runs manually and should not contain the time stamp in this case.
filename
<-
paste0
(
cfg
$
results_folder
,
"/config.Rdata"
)
cat
(
"Writing cfg to file"
,
filename
,
"\n"
)
cat
(
"
Writing cfg to file"
,
filename
,
"\n"
)
save
(
cfg
,
file
=
filename
)
# Copy files required to confiugre and start a run
...
...
@@ -53,7 +53,7 @@ submit <- function(cfg) {
on.exit
(
setwd
(
cfg
$
remind_folder
))
# send prepare_and_run.R to cluster
cat
(
"Executing prepare_and_run.R
with
"
,
cfg
$
title
,
"\n"
)
cat
(
"
Executing prepare_and_run.R
for
"
,
cfg
$
results_folder
,
"\n"
)
if
(
cfg
$
slurmConfig
==
"direct"
)
{
log
<-
format
(
Sys.time
(),
paste0
(
cfg
$
title
,
"-%Y-%H-%M-%S-%OS3.log"
))
system
(
"Rscript prepare_and_run.R"
)
...
...
This diff is collapsed.
Click to expand it.
start.R
+
14
−
7
View file @
e8c0a5a5
...
...
@@ -15,7 +15,7 @@ configure_cfg <- function(icfg, iscen, iscenarios, isettings) {
# Edit run title
icfg
$
title
<-
iscen
cat
(
"
\n
"
,
iscen
,
"\n"
)
cat
(
"
Configuring cfg for
"
,
iscen
,
"\n"
)
# Edit main file of model
if
(
"model"
%in%
names
(
iscenarios
)){
...
...
@@ -106,7 +106,7 @@ if ('--testOneRegi' %in% argv) {
}
if
(
!
is.na
(
config.file
))
{
cat
(
paste
(
"
r
eading config file"
,
config.file
,
"\n"
))
cat
(
paste
(
"
\nR
eading config file"
,
config.file
,
"\n"
))
# Read-in the switches table, use first column as row names
settings
<-
read.csv2
(
config.file
,
stringsAsFactors
=
FALSE
,
row.names
=
1
,
comment.char
=
"#"
,
na.strings
=
""
)
...
...
@@ -142,6 +142,8 @@ for (scen in rownames(scenarios)) {
cfg
$
force_replace
<-
TRUE
}
cat
(
"\n"
,
scen
,
"\n"
)
# configure cfg based on settings from csv if provided
if
(
!
is.na
(
config.file
))
{
cfg
<-
configure_cfg
(
cfg
,
scen
,
scenarios
,
settings
)
...
...
@@ -149,14 +151,19 @@ for (scen in rownames(scenarios)) {
start_now
<-
(
substr
(
scenarios
[
scen
,
"path_gdx_ref"
],
nchar
(
scenarios
[
scen
,
"path_gdx_ref"
])
-3
,
nchar
(
scenarios
[
scen
,
"path_gdx_ref"
]))
==
".gdx"
|
is.na
(
scenarios
[
scen
,
"path_gdx_ref"
]))
}
# save the cfg data for later start of subsequent runs (after preceding run finished)
filename
<-
paste0
(
scen
,
".RData"
)
cat
(
"Writing cfg to file"
,
filename
,
"\n"
)
cat
(
"
Writing cfg to file"
,
filename
,
"\n"
)
save
(
cfg
,
file
=
filename
)
if
(
start_now
){
# Create results folder and start run
submit
(
cfg
)
}
# Create results folder and start run
submit
(
cfg
)
}
else
{
cat
(
" Waiting for"
,
scenarios
[
scen
,
'path_gdx_ref'
]
,
"\n"
)
}
if
(
!
identical
(
cfg
$
subsequentruns
,
character
(
0
)))
cat
(
" Subsequent runs:"
,
cfg
$
subsequentruns
,
"\n"
)
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment