Skip to content
Skip to Content

Run the example

Run docs/scenario.toml, the commented example scenario, and see how a refused key is reported.

A scenario file is the whole user interface of a run: no code is needed. The repository holds a commented example, docs/scenario.toml, that runs the tracer subset of the format with the test-only plugin test/ticker.

Run it

Terminal
cohortix run docs/scenario.toml --output output/tracer

With 100 placeholder persons and 12 monthly steps, the run prints:

Output
1200 journal rows written to output/tracer

The output folder must not exist, or be empty: cohortix run refuses to write into a folder that already holds files (E5001). Without --output, the folder is output/<scenario name>.

The example file

docs/scenario.toml
[scenario]
name = "tracer"
seed = 20180101

[time]
start = 2018-01-01
end = 2019-01-01
step = "month"

[phases]
order = ["ageing", "death", "migration", "union", "contraception", "conception_birth", "households"]
wave_depth = 8

[population]
placeholder_size = 100

[outputs]
persistence = "full"

[plugins."test/ticker"]

The repository copy carries a one-line comment above every key, the same comment the scenario reference shows on each key page.

When something is wrong

Every problem in a scenario file is reported at once, with its file, line and column, and nothing is written. Misspell step as stpe:

Standard error
error[E1022]: Unknown key `stpe` in [time]; did you mean `step`?
  --> docs/scenario.toml:36:1
  = fix: Rename `stpe` to `step`, or remove it; the accepted keys of [time] are "start", "end", "step".

The code links to its page: E1022 explains the cause and the fix. With --json, each diagnostic is one JSON object per line, with the fields code, severity, file, line, column, rule, fix and args. The exit code is 1.

Run it again, exactly

The output folder holds effective.toml: the scenario with every default made explicit. Running it into another folder reproduces the journal byte for byte.

Terminal
cohortix run output/tracer/effective.toml --output output/again

Next: read the outputs.

On this page

You are reading the docs for 0.1. Keys can change between versions: use the version that matches cohortix --version.