Skip to content

Refactor and fix Backfill commands - #352

Merged
bryanlandia merged 26 commits into
masterfrom
bryan/flexible-backfill-commands
Jun 16, 2021
Merged

bryanlandia merged 26 commits into
masterfrom
bryan/flexible-backfill-commands

Conversation

@bryanlandia

@bryanlandia bryanlandia commented May 28, 2021 •

Copy link
Copy Markdown
Contributor

This PR addresses some shortcomings of previous Figures data backfill picture. It does some things:

The old stuff:

Marks backfill_figures_metrics and populate_figures_metrics commands as pending deprecation. Replaces their handlers with calls to the new backfill commands.

The new stuff:

BaseBackfillCommand

You can pass a start date, end date, site id/domain, overwrite yes/no, and no_delay yes/no to all commands below subclassing this. Ovewrite will replace existing objects, no_delay will directly call Celery tasks instead of queueing them via RabbitMQ

backfill_figures_daily_metrics

  • Creates all CourseDailyMetrics records for a date range and site (or all sites if none passed).
  • Creates all SiteDailyMetrics records for a date range and site (or all sites if none passed).
  • Refuses to calculate average_progress for a date previous to yesterday, since this will never be accurate. The added benefit is this removes the major cause of slow processing (calculting grades).

Uses the experimental method if that option is passed, but I didn't worry much about that, since I don't think it was every really finished.

repair_figures_backfilled_progress

  • Sets average_progerss to None for dates prior yesterday within a passed date range, with a dry run option.
  • Used to correct prior backfills which would have set all dates' average_progress to the current day's average_progress for that course

backfill_figures_monthly_metrics

  • Creates all SiteMonthlyMetrics for a date range and site (or all sites if none passed)

backfill_figures_enrollment_data

  • Creates EnrollmentData objects for each course with enrollments for each site passed, or all sites if no site passed

@bryanlandia
bryanlandia requested a review from johnbaldwin May 28, 2021 00:33
Comment thread figures/tasks.py Resolved
@bryanlandia
bryanlandia force-pushed the bryan/flexible-backfill-commands branch 2 times, most recently from 5dac8f0 to 075a5c0 Compare June 10, 2021 01:12
@bryanlandia
bryanlandia marked this pull request as ready for review June 10, 2021 01:46
@bryanlandia
bryanlandia requested a review from johnbaldwin June 10, 2021 01:46
@bryanlandia

Copy link
Copy Markdown
Contributor Author

@johnbaldwin I addressed your comment (thanks!) and this is ready for your review now.

Comment thread figures/management/commands/__init__.py Resolved
@johnbaldwin

Copy link
Copy Markdown
Contributor

@bryanlandia There's a bunch here and it is way too late for me, so I'm going to pick up the review again tomorrow to make sure I don't miss something. My biggest concern is that we don't break existing django management commands that would be used with cron instead of celerybeat, namely that this PR removes populate_figures_metrics.py I'd rather we keep this command for anyone in the community who might be using it. I'm happy with making deprecation notes, but would prefer we keep this command

@johnbaldwin

Copy link
Copy Markdown
Contributor

@bryanlandia I've looked over the backfill commands. Aside from preserving populate_figures_metrics as mentioned above, I think it best to have figures in the backfill command names. For example: backfill_figures_monthly_metrics.

I ask this only as a measure against management command naming collisions. The chance of this is pretty low now. I don't see any other commands with backfill except for backfill_history for the course_overviews app. But this just helps avoid that.

The only other interface related thing with backfill commands is that I'm interested in what you see is the advantage of having multiple different commands rather than have one backfill_figures command that takes the first positional argument as a choice, like ./manage.py lms backfill_figures monthly .... Definitely not something critical now, but thinking longer term

@bryanlandia
bryanlandia force-pushed the bryan/flexible-backfill-commands branch 4 times, most recently from 9396d94 to 1e03312 Compare June 15, 2021 23:05
@bryanlandia
bryanlandia force-pushed the bryan/flexible-backfill-commands branch from 1e03312 to 7ae08e3 Compare June 15, 2021 23:28
@bryanlandia
bryanlandia requested a review from estherjsuh June 15, 2021 23:46

@estherjsuh estherjsuh 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.

looks good! 🥇

@bryanlandia
bryanlandia merged commit 4b40155 into master Jun 16, 2021
@OmarIthawi
OmarIthawi deleted the bryan/flexible-backfill-commands branch June 21, 2021 15:41
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.

3 participants