fix: Add code_owner decorator to remaining Celery tasks (#31762)
This will ensure that errors raised by these tasks will alert the right team. `send_course_enrollment_email` is the one I set out to fix, but I discovered a few others. I located tasks that were missing decorators by running the following search and visually inspecting the results, although semgrep might be able to do better: ``` ack '^@.*task|^@set_code_owner_attribute' cms lms common openedx xmodule --ignore-dir=tests --python ``` Also, add more detailed explanation of why a couple of tasks can't use the decorator. This should only be an issue on tasks inheriting from UserTaskMixin, which in practice is just CourseExportTask and CourseImportTask (and the apparently unused EnrollmentReadTask and EnrollmentWriteTask), via UserTask.
This commit is contained in:
@@ -7,7 +7,7 @@ import logging
|
||||
|
||||
from celery import shared_task
|
||||
from celery_utils.logged_task import LoggedTask
|
||||
|
||||
from edx_django_utils.monitoring import set_code_owner_attribute
|
||||
from opaque_keys.edx.keys import CourseKey
|
||||
|
||||
from . import api
|
||||
@@ -18,6 +18,7 @@ logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@shared_task(base=LoggedTask)
|
||||
@set_code_owner_attribute
|
||||
def import_blocks_from_course(import_task_id, course_key_str):
|
||||
"""
|
||||
A Celery task to import blocks from a course through modulestore.
|
||||
|
||||
@@ -6,12 +6,15 @@ Tasks for Survey Report.
|
||||
import logging
|
||||
|
||||
from celery import shared_task
|
||||
from edx_django_utils.monitoring import set_code_owner_attribute
|
||||
|
||||
from .api import generate_report
|
||||
|
||||
log = logging.getLogger('edx.celery.task')
|
||||
|
||||
|
||||
@shared_task(name='openedx.features.survey_report.tasks.generate_survey_report')
|
||||
@set_code_owner_attribute
|
||||
def generate_survey_report():
|
||||
"""
|
||||
Tasks to generate a new survey report with non-sensitive data.
|
||||
|
||||
Reference in New Issue
Block a user