Skip to content

Resolve LogSettings defaults from configuration - #569

Open
samc24 wants to merge 1 commit into
devfrom
sameerc/config-log-settings
Open

Resolve LogSettings defaults from configuration#569
samc24 wants to merge 1 commit into
devfrom
sameerc/config-log-settings

Conversation

@samc24

@samc24 samc24 commented Jul 10, 2026

Copy link
Copy Markdown
Collaborator

Prototype for #445: move hardcoded tunables into the layered configuration, using LogSettings as the proof of pattern.

  • file_level and the console thresholds (warning_threshold, success_threshold, info_threshold) now default to None and are resolved in __post_init__ from a new [default.log] section in config.toml.
  • Precedence: explicit argument, then DISPY_LOG__* environment variable, then ~/.config/disruption-py/user.toml, then the repo config.toml. The env and user-file layers come for free from the existing Dynaconf setup, e.g. DISPY_LOG__WARNING_THRESHOLD=2000.
  • console_level is deliberately left alone since its None already means "derive the level from the shot count", and file_path is left alone since it is a computed default that needs its own design call.
  • Log settings are machine-independent by construction: logging is set up before the tokamak is resolved in get_shots_data, so the default config environment is the right (and only possible) source. Per-machine log overrides are out of scope.
  • No behavior change for existing callers: explicitly passed values always win, and the config defaults match the previous hardcoded values. Workers under spawn are unaffected since the settings are resolved in the main process before pickling.
  • Added precedence tests to tests/test_config.py. The per-run config dump now includes the effective log section.

If this pattern looks right, the same treatment can roll out to the rest of the hardcoded values inventoried in #445.

Signed-off-by: Sameer Chaturvedi <sameerc@mit.edu>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant