Skip to content

Add exclude_hours and valid_hours attributes to cycledef#123

Open
guoqing-noaa wants to merge 1 commit intochristopherwharrop:developfrom
guoqing-noaa:exclude_valid_hours2
Open

Add exclude_hours and valid_hours attributes to cycledef#123
guoqing-noaa wants to merge 1 commit intochristopherwharrop:developfrom
guoqing-noaa:exclude_valid_hours2

Conversation

@guoqing-noaa
Copy link

@guoqing-noaa guoqing-noaa commented Feb 25, 2026

Add exclude_hours and valid_hours attributes to cycledef

  • exclude_hours: removes specified hours from expanded cycles
  • valid_hours: keeps only specified hours in expanded cycles
  • Updated CycleInterval class with hour filtering in next/previous/member?
  • Updated XML schemas and workflowdoc.rb parser
  • Added unit tests for new functionality
  • raise ERROR if exclude_hours/valid_hours in cron-style <cycledef>

Example usage:

<cycledef exclude_hours="3 4 5 6">201101010000 201112311800 06:00:00</cycledef>
<cycledef valid_hours="0 6 12 18">201101010000 201112312300 01:00:00</cycledef>

solved problem:

This PR address the complexity in the specification of the following types of cycles:
For example, during the retro period 2024122712-2025021012, we need to run a task only at 03-08 and 15-20 cycles each day. Currently, we need to use 5 different cycledef to correctly represent this situation:

<cycledef group="spinup0">00 15-20 27 12 2024 *</cycledef>
<cycledef group="spinup1">00 03-08,15-20 28-31 12 2024 *</cycledef>
<cycledef group="spinup2">00 03-08,15-20 01-31 01 2025 *</cycledef>
<cycledef group="spinup3">00 03-08,15-20 01-09 02 2025 *</cycledef>
<cycledef group="spinup4">00 03-08 10 02 2025 *</cycledef>

With this PR we can simplify the above 5 cycledef into one:

<cycledef group="spinup" valid_hours="3 4 5 6 7 8 15 16 17 18 19 20">202412271200 202502101200 01:00:00</cycledef>

This significantly simplifies our workflow logic.

- exclude_hours: removes specified hours from expanded cycles
- valid_hours: keeps only specified hours in expanded cycles
- Updated CycleInterval class with hour filtering in next/previous/member?
- Updated XML schemas and workflowdoc.rb parser
- Added unit tests for new functionality
- raise ERROR if exclude_hours/valid_hours in cron-style <cycledef>

Example usage:
  <cycledef exclude_hours="3 4 5 6">201101010000 201112311800 06:00:00</cycledef>
  <cycledef valid_hours="0 6 12 18">201101010000 201112312300 01:00:00</cycledef>
@guoqing-noaa
Copy link
Author

@christopherwharrop-noaa I closed PR #122 and create a new one here. Let's use this PR. Thanks!

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