Skip to content

Commit 12f5b31

Browse files
committed
feat: added patches + updated model for bulk email skip/failure details
1 parent eed5821 commit 12f5b31

4 files changed

Lines changed: 25 additions & 5 deletions

File tree

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Generated by Django 4.2.20 on 2025-10-17 15:37
2+
3+
from django.db import migrations, models
4+
5+
6+
class Migration(migrations.Migration):
7+
8+
dependencies = [
9+
('instructor_task', '0006_alter_historicalinstructortaskschedule_options'),
10+
]
11+
12+
operations = [
13+
migrations.AlterField(
14+
model_name='instructortask',
15+
name='task_output',
16+
field=models.TextField(null=True),
17+
),
18+
]

lms/djangoapps/instructor_task/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ class Meta:
7676
task_input = models.TextField()
7777
task_id = models.CharField(max_length=255, db_index=True) # max_length from celery_taskmeta
7878
task_state = models.CharField(max_length=50, null=True, db_index=True) # max_length from celery_taskmeta
79-
task_output = models.CharField(max_length=1024, null=True)
79+
task_output = models.TextField(null=True)
8080
requester = models.ForeignKey(User, db_index=True, on_delete=models.CASCADE)
8181
created = models.DateTimeField(auto_now_add=True, null=True)
8282
updated = models.DateTimeField(auto_now=True)

lms/djangoapps/instructor_task/subtasks.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818

1919
from common.djangoapps.util.db import outer_atomic
20+
from openedx_wikilearn_features.wikimedia_general.djangoapps_patches.instructor_task.utils import update_task_dict
2021

2122
from .exceptions import DuplicateTaskException
2223
from .models import PROGRESS, QUEUING, InstructorTask
@@ -249,7 +250,7 @@ def initialize_subtask_info(entry, action_name, total_num, subtask_id_list):
249250
'duration_ms': int(0),
250251
'start_time': time()
251252
}
252-
entry.task_output = InstructorTask.create_output_for_success(task_progress)
253+
entry.task_output = InstructorTask.create_output_for_success(update_task_dict(task_progress))
253254
entry.task_state = PROGRESS
254255

255256
# Write out the subtasks information.
@@ -263,7 +264,7 @@ def initialize_subtask_info(entry, action_name, total_num, subtask_id_list):
263264
'failed': 0,
264265
'status': subtask_status
265266
}
266-
entry.subtasks = json.dumps(subtask_dict)
267+
entry.subtasks = json.dumps(update_task_dict(subtask_dict))
267268

268269
# and save the entry immediately, before any subtasks actually start work:
269270
entry.save_now()
@@ -549,7 +550,7 @@ def _update_subtask_status(entry_id, current_task_id, new_subtask_status):
549550
# retry.
550551
new_state = new_subtask_status.state
551552
if new_subtask_status is not None and new_state in READY_STATES:
552-
for statname in ['attempted', 'succeeded', 'failed', 'skipped']:
553+
for statname in ['attempted', 'succeeded', 'failed', 'skipped','skip_details', 'failure_details']:
553554
task_progress[statname] += getattr(new_subtask_status, statname)
554555

555556
# Figure out if we're actually done (i.e. this is the last task to complete).

lms/djangoapps/instructor_task/views.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
from lms.djangoapps.instructor_task.api_helper import get_status_from_instructor_task, get_updated_instructor_task
1111
from lms.djangoapps.instructor_task.models import PROGRESS
12+
from openedx_wikilearn_features.wikimedia_general.djangoapps_patches.instructor_task.utils import get_detailed_message
1213

1314
log = logging.getLogger(__name__)
1415

@@ -228,5 +229,5 @@ def get_task_completion_info(instructor_task): # lint-amnesty, pylint: disable=
228229
total=num_total,
229230
skipped=num_skipped,
230231
student=student
231-
)
232+
) + "\n" + get_detailed_message(task_output)
232233
return (succeeded, message)

0 commit comments

Comments
 (0)