Skip to content

Feature #3218 warn overwrite, #2110 fail if output exists - #3332

Open
georgemccabe wants to merge 57 commits into
developfrom
feature_3218_warn_overwrite
Open

Feature #3218 warn overwrite, #2110 fail if output exists#3332
georgemccabe wants to merge 57 commits into
developfrom
feature_3218_warn_overwrite

Conversation

@georgemccabe

@georgemccabe georgemccabe commented Jul 27, 2026

Copy link
Copy Markdown
Collaborator

Change Summary

  • Added WARN_IF_DUPLICATE_OUTPUT (when the same output is written within the same METplus run) and wrapper-specific config options -- wrt Create WARNING message for operations that overwrite output files #3218
  • Added WARN_IF_OUTPUT_EXISTS (when output already exists on disk) and wrapper-specific config options -- wrt Add config option to fail if output already exists #2110
  • Added EXIT_IF_WARN config option to end METplus run immediately when a warning log is encountered (note: issue Enhancement: Support wrapper-specific EXIT_ON_WARN config options #3333 was created for adding support for wrapper-specific options) -- wrt Add config option to fail if output already exists #2110
  • Added WARN_IF_ENSEMBLE_IS_MISSING to disable warnings when an ensemble member is not found for GenEnsProd and/or EnsembleStat
  • Modified TCStat wrapper to ignore forecast leads to prevent redundant runs of the tool
  • Downgraded some warnings to debug messages because they are more informative than needing to raise an alert
  • Set EXIT_ON_WARN for all use case tests, requiring that all warnings be resolved or ignored for use cases added to the repository
  • Updates some use case config files to prevent unnecessarily warnings/errors
  • Added tests to demonstrate behavior of new config variables
  • Added documentation to describe how output templates are substituted from different runtime frequency settings, which clarifies confusion discussed in series_analysis in a complex use case #3066
  • Updated pillow package version in requirements.txt files to address security vulnerabilities
  • (Internal) moved pytest markers from pytest.ini file to pyproject.toml to prevent warnings when tests are run from other directories besides internal/tests/pytests
  • (Internal) Enhanced add_met_config_helper.py script to help add config support (documentation, basic use case conf updates, etc.) for all (or multiple) wrappers and for non-MET config variables (skips steps specific to MET tools)

Pull Request Testing

  • Describe testing already performed for these changes:

Added unit tests to demonstrate expected behavior

  • Recommend testing for the reviewer(s) to perform, including the location of input datasets, and any additional instructions:

review code changes under metplus directory and unit tests under internal/tests/pytests to confirm correctness. Review use case diffs (see below)

review documentation changes - Are the new configs named well? Should there be a new section in the User's Guide (under Configuration chapter?) to describe warning, config variables to skip certain warnings, and exiting when a warning is encountered? (this could be added in final dev cycle)

  • Do these changes include sufficient documentation updates, ensuring that no errors or warnings exist in the build of the documentation? [Yes]

Unless review suggests adding more

  • Do these changes include sufficient testing updates? [Yes]

  • Will this PR result in changes to the test suite? [Yes]

    If yes, describe the new output and/or changes to the existing output:

met_tool_wrapper:30-58,68-69

  • UserScript_run_once - different number of files found due to init times skipped to prevent warnings
  • GenEnsProd - different number of output files used/expected to prevent warnings

medium_range:3-5,10

  • medium_range/GridStat_fcstGFS_obsGFS_climoNCEP_MultiField -- more output files that contain field name/level in filename because previously the same file was being overwritten multiple times
  • Do these changes introduce new SonarQube findings? [No]

    If yes, please describe:

  • Please complete this pull request review by 2026/8/18.

Pull Request Checklist

See the METplus Workflow for details.

  • Add any new Python packages to the METplus Components Python Requirements table.
  • For any new datasets, an entry to the METplus Verification Datasets Guide.
  • Review the source issue metadata (required labels, projects, and milestone).
  • Complete the PR definition above.
  • Ensure the PR title matches the feature or bugfix branch name.
  • Define the PR metadata, as permissions allow.
    Select: Reviewer(s) and Development issue
    Select: Milestone as the version that will include these changes
    Select: Coordinated METplus-X.Y Support project for bugfix releases or METplus-Wrappers-X.Y.Z Development project for official releases
  • After submitting the PR, select the ⚙️ icon in the Development section of the right hand sidebar. Search for the issue that this PR will close and select it, if it is not already selected.
  • After the PR is approved, merge your changes. If permissions do not allow this, request that the reviewer do the merge.
  • Close the linked issue and delete your feature or bugfix branch from GitHub.

…ing overwritten, indicating that a misconfiguration is present. Pass list of outputs to the next wrapper in the process list so it can properly check if multiple instances are writing to the same path. Move logic to run processes into a function that can be called by unit tests to test behavior from running multiple processes, e.g. multiple instances of the same wrapper.
…t a duplicate file path is being overwritten
…sting various scenarios such as: 2 fields processed separately, runtime freq doesn't match output template, custom loop list, and multiple instances. This includes updated test logic to properly test multiple PROCESS_LIST items instead of creating/calling a single wrapper/process as many test do. Consider adding a fixture to easily handle the config and process list initialization that can be resused in many tests
…m templates for each of the RUNTIME_FREQ settings
…sues by changing the output template and/or prefix
…multiple wrappers at once and 2) skip steps specific to MET config variables
…dd to warning message with info on how to disable it
…nings when output is written more than once in a single METplus run
… encountered. This setting coupled with the new logic to warn if output has already been generated within a given METplus run will cause a run to fail in this case. Note that this does not warn/fail if the output already exists on disk from a previous run
…ee which use cases currently output a warning log
…lid behavior to read skip lead seq setting and skip if set
…me valid is processed more than once based on the configuration and it doesn't need to be run multiple times
…s when a warning occurs and EXIT_ON_WARN=True
… output a warning when the output file attempted to be written already exists on disk. Coupled with EXIT_ON_WARN, this accomplishes the desired behavior in issue #2110
…init and running processes. Note currently EXIT_ON_WARN is only supported on the global level and is read upon initial METplusConfig initialization, so the test had to be written to set this config setting before initializating the config.
… a warning log is still output if SKIP_IF_OUTPUT_EXISTS is not set
@coveralls

coveralls commented Jul 27, 2026

Copy link
Copy Markdown

Coverage Report for CI Build 33924738465

Coverage increased (+0.1%) to 92.133%

Details

  • Coverage increased (+0.1%) from the base build.
  • Patch coverage: 5 uncovered changes across 3 files (114 of 119 lines covered, 95.8%).
  • 1 coverage regression across 1 file.

Uncovered Changes

File Changed Covered %
metplus/wrappers/command_builder.py 52 50 96.15%
metplus/wrappers/runtime_freq_wrapper.py 7 5 71.43%
metplus/wrappers/point_stat_wrapper.py 1 0 0.0%
Total (17 files) 119 114 95.8%

Coverage Regressions

1 previously-covered line in 1 file lost coverage.

File Lines Losing Coverage Coverage
metplus/wrappers/runtime_freq_wrapper.py 1 91.18%

Coverage Stats

Coverage Status
Relevant Lines: 10639
Covered Lines: 9802
Line Coverage: 92.13%
Coverage Strength: 1.84 hits per line

💛 - Coveralls

@georgemccabe georgemccabe changed the title Feature #3218 warn overwrite, #2100 fail if output exists Feature #3218 warn overwrite, #2110 fail if output exists Jul 27, 2026
@georgemccabe
georgemccabe marked this pull request as ready for review August 27, 2026 18:18

@JohnHalleyGotway JohnHalleyGotway left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I approve of these changes.

There are changes to 84 files, which is a lot to review. Although I realize that many are minor changes in .conf files, adding commented out entries for

{MET_TOOL}_WARN_IF_DUPLICATE_OUTPUT =
{MET_TOOL}_WARN_IF_OUTPUT_EXISTS =

I see that all of the GHA tests passed (other than the expected diffs and linkcheck failures), which is great. Thanks for adding new tests.

I inspected the file diffs flagged by the GHA testing workflow and confirmed that they're the changes you describe.

I see new entries in the docs (https://metplus--3332.org.readthedocs.build/en/3332/Users_Guide/glossary.html) for the new configuration options. You could consider starting a running list of config file changes for METplus-13.0.0 in the METplus Wrappers Upgrade Instructions section... rather than compiling a list prior to METplus-13.0.0 going out the door.

I have not manually replicated all of the situations that trigger these warnings to confirm that it behaves exactly as described. So there's some risk there. Please LMK if you'd rather I do a more in-depth review, and perhaps we could schedule a working meeting to demonstrate each situation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: 🔎 In review

Development

Successfully merging this pull request may close these issues.

Create WARNING message for operations that overwrite output files Add config option to fail if output already exists

3 participants