7
0
mirror of https://github.com/ChristianLight/tutor.git synced 2024-06-07 00:20:49 +00:00

feat: backfill persistent grades during upgrade

In Olive, persistent grades are now mandatory. This was already the case in
Nutmeg, but it didn't mean that existing, non-persistent grades were migrated
to be persistent. This introduces a job that is run whenever a user upgrades
from Nutmeg. Alternatively, it can be run manually with:

    tutor local upgrade --from=nutmeg

See relevant documentation: https://openedx.atlassian.net/wiki/spaces/AC/pages/755171487/Migrating+to+Persistent+Grading#The-Persistent-Grades-Backfill
See discussion: https://app.slack.com/client/T02SNA1T6/C049JQZFR5E/thread/C02SNA1U4-1670937183.881709
This commit is contained in:
Régis Behmo 2022-12-13 16:39:35 +01:00 committed by Régis Behmo
parent 93d139d4bf
commit 7a61f07dfd
5 changed files with 17 additions and 6 deletions

View File

@ -0,0 +1 @@
- [Improvement] Backfill persistent grades during upgrade from Nutmeg. If you observe missing grades after the upgrade from Nutmeg, run `tutor local upgrade --from=nutmeg`. (by @regisb)

View File

@ -475,7 +475,7 @@ def upgrade(context: click.Context, from_release: Optional[str]) -> None:
"This command only performs a partial upgrade of your Open edX platform. "
"To perform a full upgrade, you should run `tutor k8s launch`."
)
upgrade_from(context.obj, from_release)
upgrade_from(context, from_release)
# We update the environment to update the version
context.invoke(config_save_command)

View File

@ -1,3 +1,5 @@
import click
from tutor import config as tutor_config
from tutor import fmt, plugins
from tutor.types import Config
@ -31,3 +33,9 @@ def upgrade_from_lilac(config: Config) -> None:
)
plugins.load("mfe")
tutor_config.save_enabled_plugins(config)
def upgrade_from_nutmeg(context: click.Context, config: Config) -> None:
context.obj.job_runner(config).run_task(
"lms", "./manage.py lms compute_grades -v1 --all_courses"
)

View File

@ -1,3 +1,5 @@
import click
from tutor import config as tutor_config
from tutor import env as tutor_env
from tutor import fmt
@ -8,8 +10,8 @@ from tutor.types import Config
from . import common as common_upgrade
def upgrade_from(context: Context, from_release: str) -> None:
config = tutor_config.load(context.root)
def upgrade_from(context: click.Context, from_release: str) -> None:
config = tutor_config.load(context.obj.root)
running_release = from_release
if running_release == "ironwood":
@ -29,11 +31,11 @@ def upgrade_from(context: Context, from_release: str) -> None:
running_release = "maple"
if running_release == "maple":
upgrade_from_maple(context, config)
upgrade_from_maple(context.obj, config)
running_release = "nutmeg"
if running_release == "nutmeg":
# Upgrade is a no-op
common_upgrade.upgrade_from_nutmeg(context, config)
running_release = "olive"

View File

@ -36,7 +36,7 @@ def upgrade_from(context: click.Context, from_release: str) -> None:
running_release = "nutmeg"
if running_release == "nutmeg":
# Upgrade is a no-op
common_upgrade.upgrade_from_nutmeg(context, config)
running_release = "olive"