feat(nimbus): Celery tasks to run holdback analysis weekly#16136
Conversation
|
Blocked on this #16096 |
…riod and trigger Jetstream rerun
…x test expectations Holdback experiments never pause enrollment so actual_enrollment_end_date is always None, causing the task to skip every experiment. Switch to computed_enrollment_end_date (start_date + proposed_enrollment) which correctly reflects when the initial enrollment window expires. Update test comment and expected value to match the corrected calculation (36 days since end → weeks_elapsed=5 → 14+35=49).
…sized context managers
…back - Run daily instead of weekly (holdbacks can launch any day) - Use today - 21 days as rolling enrollment_end (observation period) - Skip experiments with end_date set (actually ended holdbacks) - Update _enrollment_end_date instead of proposed_enrollment - Add changelog entry per updated experiment - Compute proposedEnrollment, enrollmentEndDate, endDate on-the-fly in v8 serializer for active holdbacks — real fields stay untouched - Add HOLDBACK_ENROLLMENT_UPDATED changelog message constant
…on _enrollment_end_date
… serializer methods
mikewilli
left a comment
There was a problem hiding this comment.
I suggested a couple small changes, but more importantly I think there's still some confusion over which dates to fake, when to fake them, and what they should be set to. My understanding of what we want to do here isn't quite in line with what you have here, and I'm not totally sure if that's a misunderstanding on my part or if I'm just not quite explaining it clearly enough.
Let me know if you want to chat about it to try and make sure we're on the same page.
- Move HOLDBACK_OBSERVATION_DAYS constant to settings.py - Remove _enrollment_end_date update from task — serializer computes on-the-fly - Serializer computes fake enrollment end (today - 21 days) when holdback has no explicit enrollment_end_date, rather than relying on stored value - Use shared constant from settings in both task and serializer
|
@mikewilli did the changes, I think its clear now, not updating the dates to not impact any working functionality, computing on the fly |
…nt + 21 observation)
…p if enrollment stopped
mikewilli
left a comment
There was a problem hiding this comment.
Alright this is looking good now! Please change the schedule before merging, the other comments are up to you.
Thanks for working through everything.
| update_fields = {"do_rerun_timestamp": now} | ||
| if not experiment.do_rerun: | ||
| update_fields["do_rerun"] = True | ||
| NimbusExperiment.objects.filter(pk=experiment.pk).update(**update_fields) |
There was a problem hiding this comment.
I don't know if it makes a difference, but should this be .get instead of .filter?
There was a problem hiding this comment.
I think we don't need this anymore as we are not updating any private property, we can directly access for the save
Because
This commit
Fixes #16086