Repository navigation
fix(hermes): handle wrap-around weekday ranges, overnight hours, and zero occupancy in pool_sizing - #6
Open
Mohammed Lubbad (mlubbad) wants to merge 1 commit into
Conversation
…zero-hold in pool_sizing Signed-off-by: Dr. Mohammed Lubbad <engmlubbad@gmail.com>
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.
Summary
Fixes four edge cases in
hermes/deploy/pool_sizing.pyso fleet sizing matchesgateway/cron.pysemantics and handles non-Mon-Fri workweeks and night shifts cleanly:active_daysranges (parse_days): Ranges such asSun-Thu(standard across MENA/GCC teams) orFri-Monpreviously evaluatedrange(a, b + 1)witha > b, silently returning an empty set (set()) and dropping all workday traffic.7(cron_minutes):gateway/cron.pysupports wrap-around weekday ranges (e.g.5-0for Fri-Sun) and7as Sunday, whereaspool_sizing.pyreturned zero fires for5-0and did not validate out-of-range weekday numbers.active_hoursand non-positivemedian_gap_minutes(agent_intervals): Overnight windows such as22:00-06:00produced a negativespan(zero arrivals), andmedian_gap_minutes <= 0caused an infinite loop in the exponential-gap generator.main): Guardworst / heldwhenheld == 0so an idle/empty fleet does not raiseZeroDivisionError.Verification
Added regression tests in
hermes/deploy/test_pool_sizing.pycoveringSun-Thu,Fri-Mon, cron5-0, cron weekday7, overnight22:00-06:00, andmedian_gap_minutes <= 0.