Skip to content

Introduce NicknameSettingList for explicit efit tree cascade#559

Open
samc24 wants to merge 1 commit into
devfrom
sameerc/nickname-revamp
Open

Introduce NicknameSettingList for explicit efit tree cascade#559
samc24 wants to merge 1 commit into
devfrom
sameerc/nickname-revamp

Conversation

@samc24
Copy link
Copy Markdown
Collaborator

@samc24 samc24 commented May 25, 2026

Summary

  • Adds NicknameSettingList: user-specifiable cascade of efit tree candidates. Tries each via open_tree, catches mdsExceptions.TreeFOPENR (tree missing) and FetchDataError (nested cascade exhausted), returns the first that opens.
  • Resolver accepts lists (efit_nickname_setting=["efit21", "efit18", "analysis"]) and comma-separated CLI strings (--efit-tree "efit21,efit18,analysis"). Tokens that match registered keys (e.g. "disruption") dispatch to their NicknameSetting class inside the cascade.
  • Refactors DisruptionNicknameSetting._cmod_nickname to delegate to the new primitive -- replaces the disruption_time is None proxy with real fallback driven by tree-open errors. D3D path unchanged (its rundb SQL query is real functionality, not just cascade).
  • Phase 2 hook: MDSConnection.tree_nickname_cascades stores the originating NicknameSettingList so a follow-up PR can extend retry to data-path-missing errors inside an opened tree. Currently written for top-level NicknameSettingList only; nested cases (dict-wrapped, DisruptionNicknameSetting internals) are not yet surfaced.

Behavior change

For efit_nickname_setting="disruption" on CMOD, the legacy proxy disruption_time is None → return "analysis" is replaced with a real open_tree("efit18") attempt, falling back to "analysis" on TreeFOPENR.

Validated bit-identical output vs dev on two CMOD test shots:

  • 1150805012 (disrupting flat-top): both branches resolve to efit18, 83 idx points, identical data.
  • 1150805013 (no_disrup1_full, non-disrupting): old returns "analysis" via proxy; new tries efit18, gets TreeFOPENR, falls back to "analysis". Both produce 88 idx points, identical data.

Trade-off: one extra failed MDS open_tree per non-disrupting shot using "disruption", in exchange for a verbose log line documenting the fallback (Nickname cascade for shot N: selected 'analysis' after failed: efit18) and a path that handles unanticipated tree-availability patterns without proxy maintenance.

Out of scope (Phase 2 follow-up)

  • Cascade retry on FetchDataError when a tree opens but a data path inside it is missing.
  • Surfacing nested cascades (in NicknameSettingDict or inside DisruptionNicknameSetting._cmod_nickname) to MDSConnection.tree_nickname_cascades.
  • Changing the default efit_nickname_setting value.

Test plan

  • New unit tests in tests/test_nickname_setting.py (25 tests, pure-Python with a fake data_conn, no MDS required).
  • Lint suite green: make black && ruff check . && isort --check . && pylint (CI run 26377445449).
  • Manual CMOD smoke on mfews04 with shot 1150805012:
    • uv run disruption-py --efit-tree "doesnotexist,analysis" 1150805012 — cascade selects analysis after doesnotexist fails; verified via TRACE log.
    • uv run disruption-py --efit-tree "disruption,analysis" 1150805012 — first item resolves to DisruptionNicknameSetting, succeeds; 83 idx points (same as plain "disruption").
  • Bit-identical regression check vs dev on shots 1150805012 (disrupting) and 1150805013 (non-disrupting) under --efit-tree "disruption".

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