Before this change, the notify_credentials management command ran for about 10-15 minutes and occasionally overlapped with an edxapp deployment which would cause the machine the command was running on to die. The command ran through a bunch of certs and grades, and then spun off celery tasks to send the relevant data to credentials. Now, most of the logic of the notify_credentials management command has been moved into a new celery task, so that combing through longs lists of certs and grades is done asynchronously. This task then spins off the original data-sending tasks as before. Note that this requires a change in alerting: where the jenkins job would previously notify us about failures, we need to know when this new celery task fails for any reason. We’ve made this a LoggedTask so that failures will be logged to Splunk and alerting can be built off of the error messages. This commit also moves the relevant tests. MICROBA-963
29 lines
831 B
Python
29 lines
831 B
Python
"""
|
|
This file contains signal handlers for credentials-related functionality.
|
|
"""
|
|
|
|
|
|
from .tasks.v1.tasks import send_grade_if_interesting
|
|
|
|
|
|
def handle_grade_change(user, course_grade, course_key, **kwargs):
|
|
"""
|
|
Notifies the Credentials IDA about certain grades it needs for its records, when a grade changes.
|
|
"""
|
|
send_grade_if_interesting(
|
|
user,
|
|
course_key,
|
|
None,
|
|
None,
|
|
course_grade.letter_grade,
|
|
course_grade.percent,
|
|
verbose=kwargs.get('verbose', False)
|
|
)
|
|
|
|
|
|
def handle_cert_change(user, course_key, mode, status, **kwargs):
|
|
"""
|
|
Notifies the Credentials IDA about certain grades it needs for its records, when a cert changes.
|
|
"""
|
|
send_grade_if_interesting(user, course_key, mode, status, None, None, verbose=kwargs.get('verbose', False))
|