Fix configparser API bug and add analysis_summary_file support in sgh_restart_ensemble#6
Draft
Copilot wants to merge 2 commits into
Draft
Conversation
…_restart_ensemble Agent-Logs-Url: https://github.com/alexolinhager/compass/sessions/e99b6809-04fb-4972-afe2-92ebe441f1c9 Co-authored-by: alexolinhager <131483939+alexolinhager@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add optional analysis summary file config for restart ensemble
Fix configparser API bug and add analysis_summary_file support in sgh_restart_ensemble
Mar 31, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
configure()insgh_restart_ensemble/test_case.pyhad a broken configparser usage pattern and no way to consume an externalanalysis_summary.jsonproduced bysgh_ensemble_analysis. This PR fixes both.Changes
Fix configparser API bug:
config.get('restart_ensemble', {})was treating the result as a dict — the second arg toMpasConfigParser.get()is an option name, not a default. All config reads now use the correctconfig.get(section, option)/config.getint(...)/config.getfloat(...)/config.getboolean(...)form withtry/except (configparser.NoSectionError, configparser.NoOptionError)fallbacks.Add
analysis_summary_fileconfig option: New optional key under[restart_ensemble]. When set, loadsrestart_needed_runsfrom the referenced JSON and pre-filters the run scan to only those run numbers — skipping all others before the per-runanalysis_results.jsonlogic runs. When absent, behavior is unchanged.Checklist
api.rst) has any new or modified class, method and/or functions listedE3SM-Projectsubmodule has been updated with relevant E3SM changesMALI-Devsubmodule has been updated with relevant MALI changesTestingin this PR) any testing that was used to verify the changesOriginal prompt
Background
sgh_ensemble_analysiswrites ananalysis_summary.jsonfile into its own work directory. Currently,sgh_restart_ensemble/test_case.py'sconfigure()has no way to read this file — it only checks per-runanalysis_results.jsonfiles inside eachrun*/directory. Users need a way to point the restart ensemble at an externalanalysis_summary.json.Changes required
1.
compass/landice/tests/ensemble_generator/sgh_restart_ensemble/test_case.pyAdd an optional
analysis_summary_fileconfig option to[restart_ensemble]. When provided, use it to pre-filter which runs are eligible for restart (only runs listed inrestart_needed_runsin the summary JSON). When not provided, fall back to the existing per-runanalysis_results.jsonlogic.Also fix the existing
configparserAPI bug (separate issue already in another PR, but needs to be applied here too):config.get('restart_ensemble', {})is wrong — the second argument toMpasConfigParser.get()is an option name (string), not a default value. Replace all config reads with the properconfig.get(section, option)/config.getint(...)/config.getfloat(...)/config.getboolean(...)pattern, withtry/exceptfallbacks for optional options.The updated
configure()method should: