Skip to content

Commit 89d9a65

Browse files
committed
simulation: docs: tag sim-data outputs with git rev
1 parent c906eef commit 89d9a65

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

simulation/docs/Makefile

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,25 @@ OTHER_SCENARIOS := scenario4-higher-IB-rate scenario4-lower-stage-length scenari
5252
$(foreach s,$(OTHER_SCENARIOS),$(eval $(call main_scenario_template,$(s))))
5353

5454
#### Running simulations.
55-
SHORT_LEIOS = cabal run ols -- sim --output-seconds="$(SIM_SECONDS)" --output-file="$@" short-leios --log-verbosity=0
55+
56+
GIT_REV := $(shell git rev-parse HEAD)
57+
58+
ifeq ($(shell git status --porcelain --untracked-files=no),)
59+
GIT_DIRTY_TRACKED :=
60+
else
61+
GIT_DIRTY_TRACKED := -dirty
62+
endif
63+
64+
## In some cases it's useful to keep logs.
65+
LOG_VERBOSITY ?= 0
66+
67+
TAGGED_SIM_DATA = $(basename $@)-$(GIT_REV)$(GIT_DIRTY_TRACKED).json
68+
SHORT_LEIOS = cabal run ols -- sim --output-seconds="$(SIM_SECONDS)" --output-file="$(TAGGED_SIM_DATA)" short-leios --log-verbosity="$(LOG_VERBOSITY)"
5669

5770
%/sim-data.json: %/config.yaml %/topology.yaml
5871
$(SHORT_LEIOS) -l "$(word 1, $^)" -t "$(word 2, $^)" +RTS -s
72+
ln -srf $(TAGGED_SIM_DATA) $@
73+
ln -srf $(basename $(TAGGED_SIM_DATA)).log $(basename $@).log
5974

6075
%/sim-data.json: SIM_SECONDS=300
6176

0 commit comments

Comments
 (0)