Move award program certificates tasks to background_process queue (OPS-3687)
This commit is contained in:
@@ -917,6 +917,9 @@ if ENV_TOKENS.get('AUDIT_CERT_CUTOFF_DATE', None):
|
||||
|
||||
CREDENTIALS_GENERATION_ROUTING_KEY = ENV_TOKENS.get('CREDENTIALS_GENERATION_ROUTING_KEY', DEFAULT_PRIORITY_QUEUE)
|
||||
|
||||
# Queue to use for award program certificates
|
||||
PROGRAM_CERTIFICATES_ROUTING_KEY = ENV_TOKENS.get('PROGRAM_CERTIFICATES_ROUTING_KEY', DEFAULT_PRIORITY_QUEUE)
|
||||
|
||||
# The extended StudentModule history table
|
||||
if FEATURES.get('ENABLE_CSMH_EXTENDED'):
|
||||
INSTALLED_APPS.append('coursewarehistoryextended')
|
||||
|
||||
@@ -3237,6 +3237,9 @@ AUDIT_CERT_CUTOFF_DATE = None
|
||||
CREDENTIALS_SERVICE_USERNAME = 'credentials_service_user'
|
||||
CREDENTIALS_GENERATION_ROUTING_KEY = DEFAULT_PRIORITY_QUEUE
|
||||
|
||||
# Queue to use for award program certificates
|
||||
PROGRAM_CERTIFICATES_ROUTING_KEY = DEFAULT_PRIORITY_QUEUE
|
||||
|
||||
# Settings for Comprehensive Theming app
|
||||
|
||||
# See https://github.com/edx/edx-django-sites-extensions for more info
|
||||
|
||||
@@ -914,6 +914,9 @@ if ENV_TOKENS.get('AUDIT_CERT_CUTOFF_DATE', None):
|
||||
|
||||
CREDENTIALS_GENERATION_ROUTING_KEY = ENV_TOKENS.get('CREDENTIALS_GENERATION_ROUTING_KEY', DEFAULT_PRIORITY_QUEUE)
|
||||
|
||||
# Queue to use for award program certificates
|
||||
PROGRAM_CERTIFICATES_ROUTING_KEY = ENV_TOKENS.get('PROGRAM_CERTIFICATES_ROUTING_KEY', DEFAULT_PRIORITY_QUEUE)
|
||||
|
||||
# The extended StudentModule history table
|
||||
if FEATURES.get('ENABLE_CSMH_EXTENDED'):
|
||||
INSTALLED_APPS.append('coursewarehistoryextended')
|
||||
|
||||
@@ -22,6 +22,7 @@ from openedx.core.djangoapps.programs.utils import ProgramProgressMeter
|
||||
LOGGER = get_task_logger(__name__)
|
||||
# Under cms the following setting is not defined, leading to errors during tests.
|
||||
ROUTING_KEY = getattr(settings, 'CREDENTIALS_GENERATION_ROUTING_KEY', None)
|
||||
PROGRAM_CERTIFICATES_ROUTING_KEY = getattr(settings, 'PROGRAM_CERTIFICATES_ROUTING_KEY', None)
|
||||
# Maximum number of retries before giving up on awarding credentials.
|
||||
# For reference, 11 retries with exponential backoff yields a maximum waiting
|
||||
# time of 2047 seconds (about 30 minutes). Setting this to None could yield
|
||||
@@ -101,7 +102,7 @@ def award_program_certificate(client, username, program_uuid, visible_date):
|
||||
})
|
||||
|
||||
|
||||
@task(bind=True, ignore_result=True, routing_key=ROUTING_KEY)
|
||||
@task(bind=True, ignore_result=True, routing_key=PROGRAM_CERTIFICATES_ROUTING_KEY)
|
||||
def award_program_certificates(self, username):
|
||||
"""
|
||||
This task is designed to be called whenever a student's completion status
|
||||
|
||||
Reference in New Issue
Block a user