Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion cms/djangoapps/modulestore_migrator/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,9 @@ def get_migration_info(source_keys: list[CourseKey | LibraryLocator]) -> dict:
return {
info.key: info
for info in ModulestoreSource.objects.filter(
migrations__task_status__state=UserTaskStatus.SUCCEEDED, key__in=source_keys
migrations__task_status__state=UserTaskStatus.SUCCEEDED,
migrations__is_failed=False,
key__in=source_keys,
)
.values_list(
'migrations__target__key',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 4.2.24 on 2025-10-21 23:37

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('modulestore_migrator', '0002_alter_modulestoremigration_task_status'),
]

operations = [
migrations.AddField(
model_name='modulestoremigration',
name='is_failed',
field=models.BooleanField(default=False, help_text='is the migration failed?'),
),
]
13 changes: 12 additions & 1 deletion cms/djangoapps/modulestore_migrator/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class ModulestoreSource(models.Model):
)

def __str__(self):
return f"{self.__class__.__name__}('{self.key}')"
return f"{self.key}"

__repr__ = __str__

Expand Down Expand Up @@ -131,6 +131,17 @@ class ModulestoreMigration(models.Model):
"We temporarily save the staged content to allow for troubleshooting of failed migrations."
)
)
# Mostly used in bulk migrations. The `UserTaskStatus` represents the status of the entire bulk migration;
# a `FAILED` status means that the entire bulk-migration has failed.
# Each `ModulestoreMigration` saves the data of the migration of each legacy library.
# The `is_failed` value is to keep track a failed legacy library in the bulk migration,
# but allow continuing with the migration of the rest of the legacy libraries.
is_failed = models.BooleanField(
default=False,
help_text=_(
"is the migration failed?"
),
)

def __str__(self):
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ class ModulestoreMigrationSerializer(serializers.Serializer):
required=False,
default=False,
)
is_failed = serializers.BooleanField(
help_text="It is true if this migration is failed",
required=False,
default=False,
)

def get_fields(self):
fields = super().get_fields()
Expand Down
Loading
Loading