Skip to content

feat(nimbus): Celery tasks to run holdback analysis weekly#16136

Merged
yashikakhurana merged 22 commits into
mainfrom
16086
Jul 9, 2026
Merged

feat(nimbus): Celery tasks to run holdback analysis weekly#16136
yashikakhurana merged 22 commits into
mainfrom
16086

Conversation

@yashikakhurana

Copy link
Copy Markdown
Contributor

Because

  • Holdback experiments run continuously and need Jetstream to rerun analysis weekly as the eligible population grows

This commit

  • Adds a weekly Celery task that expands the proposed_enrollment window and sets do_rerun to signal Jetstream to rerun analysis

Fixes #16086

@yashikakhurana yashikakhurana changed the title 16086 feat(nimbus): Celery tasks to run holdback analysis weekly Jun 29, 2026
@yashikakhurana

Copy link
Copy Markdown
Contributor Author

Blocked on this #16096

Comment thread experimenter/experimenter/jetstream/tasks.py
Comment thread experimenter/experimenter/jetstream/tasks.py Outdated
Comment thread experimenter/experimenter/jetstream/tasks.py Outdated
Comment thread experimenter/experimenter/jetstream/tasks.py Outdated
Comment thread experimenter/experimenter/jetstream/tasks.py Outdated
Comment thread experimenter/experimenter/settings.py
@yashikakhurana yashikakhurana requested a review from mikewilli June 30, 2026 22:45
Yashika Khurana added 6 commits June 30, 2026 15:50
…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).
…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
@yashikakhurana yashikakhurana requested a review from RJAK11 as a code owner July 7, 2026 16:57

@mikewilli mikewilli left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread experimenter/experimenter/jetstream/tasks.py Outdated
Comment thread experimenter/experimenter/experiments/api/v8/serializers.py Outdated
Comment thread experimenter/experimenter/experiments/api/v8/serializers.py Outdated
Comment thread experimenter/experimenter/experiments/api/v8/serializers.py Outdated
Comment thread experimenter/experimenter/jetstream/tasks.py
Comment thread experimenter/experimenter/jetstream/tasks.py Outdated
Comment thread experimenter/experimenter/experiments/api/v8/serializers.py
- 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
@yashikakhurana yashikakhurana requested a review from mikewilli July 7, 2026 23:17
@yashikakhurana

Copy link
Copy Markdown
Contributor Author

@mikewilli did the changes, I think its clear now, not updating the dates to not impact any working functionality, computing on the fly

@mikewilli mikewilli left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know if it makes a difference, but should this be .get instead of .filter?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we don't need this anymore as we are not updating any private property, we can directly access for the save

Comment thread experimenter/experimenter/jetstream/tasks.py
Comment thread experimenter/experimenter/settings.py Outdated
@yashikakhurana yashikakhurana enabled auto-merge July 8, 2026 22:19
@yashikakhurana yashikakhurana added this pull request to the merge queue Jul 8, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jul 8, 2026
@yashikakhurana yashikakhurana added this pull request to the merge queue Jul 8, 2026
Merged via the queue into main with commit 57ab275 Jul 9, 2026
26 checks passed
@yashikakhurana yashikakhurana deleted the 16086 branch July 9, 2026 00:06
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.

Weekly task to update holdback enrollment period and trigger Jetstream rerun

2 participants