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.
31 lines
706 B
Python
31 lines
706 B
Python
"""
|
|
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.
|
|
"""
|
|
log.info(
|
|
'Started - generate survey report'
|
|
)
|
|
|
|
try:
|
|
generate_report()
|
|
log.info('Done - generate survey report')
|
|
except (Exception, ): # pylint: disable=broad-except
|
|
log.error('Error - generate survey report')
|