Simplify sgh_restart_ensemble: require analysis_summary_file, remove _should_restart_run and glob scanning#7
Draft
Copilot wants to merge 2 commits into
Conversation
…emove _should_restart_run and glob Agent-Logs-Url: https://github.com/alexolinhager/compass/sessions/fb97e0bd-5318-4dc9-883f-17d2a4bb05ea Co-authored-by: alexolinhager <131483939+alexolinhager@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Simplify analysis configuration and run checks in test_case.py
Simplify sgh_restart_ensemble: require analysis_summary_file, remove _should_restart_run and glob scanning
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.
sgh_restart_ensemble/test_case.pyhad a broken configparser API usage (config.get('restart_ensemble', {})crashes withAttributeError), relied on per-runanalysis_results.jsonfiles that don't exist in the current workflow, and usedglobto discover run directories instead of reading the canonical list from the ensemble analysis output.Changes
analysis_summary_fileis now required in[restart_ensemble]—ValueErrorraised if missing from config or file not found on diskrestart_needed_runsinanalysis_summary_fileJSON — eliminatesglobdirectory scanning entirely_should_restart_run()deleted — no per-runanalysis_results.jsonlogic remains anywheremin_simulation_years_before_restartremoved — no longer neededsection = config.get('restart_ensemble', {})pattern with properconfig.get(section, option)/config.getint(...)/config.getboolean(...)calls withtry/exceptfallbacks for optional optionsimport compass.namelistmoved to top-level importsRequired
.cfgconfigChecklist
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
Goal
Simplify
sgh_restart_ensemble/test_case.pyso that:analysis_summary_fileis a required config option in[restart_ensemble]— raiseValueErrorif it is missing or the file doesn't exist.restart_needed_runsin that JSON — no directory scanning withglob._should_restart_run()is completely removed. There is no per-runanalysis_results.jsoncheck — ever.restart_needed_runs,configure()only checks:spinup_work_dir/runXXX) existsrestart_timestampexists (i.e. the run actually started)restart_timestampcontents toconfig_stop_timeinnamelist.landice)max_consecutive_restarts(countrestart_attempt_*subdirs — keep this for safety but it's secondary)auto_restart_incompleteis Trueconfig.get('restart_ensemble', {})with properconfig.get(section, option)/config.getint(...)/config.getfloat(...)/config.getboolean(...)calls withtry/exceptfallbacks for optional options.Resulting configure() logic