-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make rrule fast forwarding stable #15601
Conversation
aef1c4a
to
4057916
Compare
f2584db
to
ea714de
Compare
fd620a3
to
6f169cc
Compare
Can this be an HTTP 400 when a Schedule is created with an "invalid" rrule? Basically preventing this type of rrules to be created in the first place. Also, I would specify the value of the |
Ok, I think I understood what's going on:
Did I get that right? |
awx/main/models/schedules.py
Outdated
logger.warning(e) | ||
# fallback to setting dtstart to 7 days ago, but this has the consequence of | ||
# occurrences not matching the old occurrences. | ||
new_start = now() - datetime.timedelta(days=7) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as @PabloHiro mentioned, this would lead to the exact problem that is being fixed. Can we just reject the rrule here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder how we should handle the cases where a user has these "invalid" rules already. We can prevent further invalid rules, but this code has a solution to handle the existing ones.
6f169cc
to
d2e1cfa
Compare
@fosterseth can this be merged? The failures seem to be about code coverage. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
got a few observations below
By stable, we mean future occurrences of the rrule should be the same before and after the fast forward operation. The problem before was that we were fast forwarding to 7 days ago. For some rrules, this does not retain the old occurrences. Thus, jobs would launch at unexpected times. This change makes sure we fast forward in increments of the rrule INTERVAL (converted to seconds), thus the new dtstart should be in the occurrence list of the old rrule. Signed-off-by: Seth Foster <[email protected]>
Signed-off-by: Seth Foster <[email protected]>
d2e1cfa
to
6f321f3
Compare
Signed-off-by: Seth Foster <[email protected]>
Co-authored-by: 🇺🇦 Sviatoslav Sydorenko (Святослав Сидоренко) <[email protected]>
Co-authored-by: 🇺🇦 Sviatoslav Sydorenko (Святослав Сидоренко) <[email protected]>
Signed-off-by: Seth Foster <[email protected]>
Signed-off-by: Seth Foster <[email protected]>
Signed-off-by: Seth Foster <[email protected]>
Signed-off-by: Seth Foster <[email protected]>
Co-authored-by: 🇺🇦 Sviatoslav Sydorenko (Святослав Сидоренко) <[email protected]>
Signed-off-by: Seth Foster <[email protected]>
Co-authored-by: 🇺🇦 Sviatoslav Sydorenko (Святослав Сидоренко) <[email protected]>
Signed-off-by: Seth Foster <[email protected]>
Signed-off-by: Seth Foster <[email protected]>
Co-authored-by: 🇺🇦 Sviatoslav Sydorenko (Святослав Сидоренко) <[email protected]>
Signed-off-by: Seth Foster <[email protected]>
Quality Gate passedIssues Measures |
SUMMARY
By stable, we mean future occurrences of the rrule should be the same before and after the fast forward operation.
The problem before was that we were fast forwarding to exactly 7 days ago. For some rrules, this does not retain the old occurrences (for example, freq=HOURLY and INTERVAL=23). Thus, jobs would launch at unexpected times any time the schedule would fast forward.
This change makes sure we fast forward in increments of the rrule INTERVAL (converted to seconds), thus the new dtstart should be in the occurrence list of the old rrule.
DETAIL
It is important that each rrule in the rruleset gets fast forwarded independently. For example consider this rruleset
Each of those rrules will need its own dtstart, since the occurrences from each rrule do not perfectly overlap.
the API also support exclusion rules, which are basically just rrules. So we can use the same method to fast forward those too.
PERFORMANCE
We want to retain the performance gains from introducing fast forwarding to begin with
create a bunch of old schedules
runit will update_computed_fields for each schedule
benchmark it
before:
after:
ISSUE TYPE
COMPONENT NAME