apply_decay_factor: change decay application to incremental instead of cumulative#816
Merged
mergify[bot] merged 2 commits intoflux-framework:masterfrom Feb 13, 2026
Merged
Conversation
Problem: The apply_decay_factor() function applies cumulative decay factors (0.5^1, 0.5^2, 0.5^3, etc.) to each usage period every time the function runs. However, each period already contains values that have been decayed in previous cycles. This causes compound decay - for example, a value that should have been decayed by 0.5^3 total was actually being decayed by much more (0.5^5 or higher). Change the decay application from cumulative to incremental, i.e. just multiply each value by 0.5 once (representing one half-life period) rather than raising 0.5 to increasing powers. Change the expected job usage values in t1006_job_archive.py with the change in how decay factors are applied to previous job usage period values.
Problem: There are no tests that simulate a half-life period and then checks *all* job usage period values to make sure that half-life decays are happening properly. Add some tests.
755fdc1 to
fa19831
Compare
Member
Author
|
Thanks @jameshcorbett! Setting MWP here |
Contributor
Merge Queue StatusRule:
This pull request spent 6 seconds in the queue, with no time running CI. Required conditions to merge
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #816 +/- ##
=======================================
Coverage 82.93% 82.93%
=======================================
Files 27 27
Lines 2479 2479
=======================================
Hits 2056 2056
Misses 423 423 🚀 New features to boost your workflow:
|
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.
Problem
As mentioned in #815, the
apply_decay_factor()function applies cumulative decay factors (0.5^1,0.5^2,0.5^3, etc.) to each usage period every time the function runs. However, each period already contains values that havebeen decayed in previous cycles. This causes compound decay - for example, a value that should have been decayed by
0.5^3total was actually being decayed by much more (0.5^5or higher).This PR changes the decay application from cumulative to incremental, i.e. just multiplies each value by 0.5 once (representing one half-life period) rather than raising 0.5 to increasing powers.
As a result, some of the expected job usage values in
t1006_job_archive.pyare changed with the new decay application. I've also added some new tests to simulate multiple half-life periods and checks to make sure that all job usage period values are updated properly.Fixes #815