Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Persefone.jl
Manage
Activity
Members
Plan
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Package Registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Repository analytics
Insights
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Persefone
Persefone.jl
Commits
e3245182
Commit
e3245182
authored
2 years ago
by
xo30xoqa
Browse files
Options
Downloads
Patches
Plain Diff
Added a clean-repo check to the output.
parent
3aecf3f0
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/core/output.jl
+7
-3
7 additions, 3 deletions
src/core/output.jl
with
7 additions
and
3 deletions
src/core/output.jl
+
7
−
3
View file @
e3245182
...
@@ -46,13 +46,17 @@ function setupdatadir(model::AgentBasedModel)
...
@@ -46,13 +46,17 @@ function setupdatadir(model::AgentBasedModel)
# Export a copy of the current parameter settings to the output folder.
# Export a copy of the current parameter settings to the output folder.
# This can be used to replicate this exact run in future, and also
# This can be used to replicate this exact run in future, and also
# records the current time and git commit.
# records the current time and git commit.
#TODO check if there have been changes to the repository since the last
currentcommit
=
read
(
`git rev-parse HEAD`
,
String
)[
1
:
8
]
# commit, as this may impact replicability
open
(
joinpath
(
@param
(
core
.
outdir
),
basename
(
@param
(
core
.
configfile
))),
"w"
)
do
f
open
(
joinpath
(
@param
(
core
.
outdir
),
basename
(
@param
(
core
.
configfile
))),
"w"
)
do
f
println
(
f
,
"#
\n
# --- Persephone configuration parameters ---"
)
println
(
f
,
"#
\n
# --- Persephone configuration parameters ---"
)
println
(
f
,
"# This file was generated automatically."
)
println
(
f
,
"# This file was generated automatically."
)
println
(
f
,
"# Simulation run on
$
(string(Dates.format(Dates.now(), "
d
u
Y
HH
:
MM
:
SS
"))),"
)
println
(
f
,
"# Simulation run on
$
(string(Dates.format(Dates.now(), "
d
u
Y
HH
:
MM
:
SS
"))),"
)
println
(
f
,
"# with git commit
$
(read(`git rev-parse HEAD`, String))#
\n
"
)
println
(
f
,
"# with Persephone
$
(pkgversion(Persephone)), git commit
$(currentcommit)
,"
)
println
(
f
,
"# running on Julia
$(VERSION)
with Agents.jl
$
(pkgversion(Agents)).
\n
#
\n
"
)
if
!
isempty
(
strip
(
read
(
`git status -s`
,
String
)))
println
(
f
,
"# WARNING: Your repository contains uncommitted changes. This may"
)
println
(
f
,
"# compromise the reproducibility of this simulation run.
\n
"
)
end
TOML
.
print
(
f
,
model
.
settings
)
TOML
.
print
(
f
,
model
.
settings
)
end
end
# Copy the map files to the output folder
# Copy the map files to the output folder
...
...
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