Skip to content
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

[Data rearchitecture] Handle changes in timeslice durations #6077

Conversation

gabina
Copy link
Member

@gabina gabina commented Dec 23, 2024

What this PR does

This PR adds functionality to change the timeslice duration for a given course. The timeslice duration works at course wiki level as we may want to set different timeslice durations for different wikis within the same course.

There is a new TIMESLICE_DURATION env variable to set the default timeslice duration. In addition, a course may have a timeslice_duration flag to specify timeslice durations for wikis. The flag looks as follows:

:timeslice_duration:
    :default: 86400
    :en.wikipedia.org: 43200
    :es.wikipedia.org: 864000

Lengths are measured in seconds (e.g., 86400 seconds = 1 day, 43200 seconds = 12 hours, 864000 seconds = 10 days).

  • If a specific value is defined for a wiki domain (wiki.domain), that value is used for the corresponding wiki.
  • Otherwise, the default value is applied.
  • If the timeslice_duration flag is not provided for the course, the TIMESLICE_DURATION environment variable is used.

As part of the changes, this PR also stops creating the complete universe of timeslices for course user wiki. That means that we only create a course user wiki timeslice when we found some revisions for that course user wiki in the given period of time. Note that the timeslice could still be empty (revision_count set to 0) because we only consider live revisions (revisions for tracked article courses for which already exists an article record). See CourseUserWikiTimeslice.update_cache_from_revisions. This refactor was addressed in this PR for simplicity reasons.

Open questions and concerns

An admin view to easily get and update the timeslice duration for a course will be created in the future. For now, only manual updates are supported (in the flag field).

@gabina gabina changed the title [WIP] [Data rearchitecture] Handle changes in timeslice durations [Data rearchitecture] Handle changes in timeslice durations Dec 27, 2024
@gabina gabina marked this pull request as ready for review December 27, 2024 16:32
@gabina gabina merged commit 1b48535 into WikiEducationFoundation:data-rearchitecture-for-dashboard Dec 27, 2024
1 check passed
@gabina gabina deleted the data-rearchitecture-handle-timeslice-durations branch December 27, 2024 16:33
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.

1 participant