Skip to content
Snippets Groups Projects
Commit e3245182 authored by xo30xoqa's avatar xo30xoqa
Browse files

Added a clean-repo check to the output.

parent 3aecf3f0
No related branches found
No related tags found
No related merge requests found
...@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment