From 46ad8a33997730a9187638fd3f2ef568f676bd53 Mon Sep 17 00:00:00 2001 From: jsa Date: Fri, 12 Feb 2016 12:21:10 -0500 Subject: [PATCH] specify routing / queue for program credentials task. ECOM-3638 --- lms/envs/aws.py | 4 ++++ lms/envs/common.py | 1 + lms/envs/yaml_config.py | 4 ++++ openedx/core/djangoapps/programs/tasks/v1/tasks.py | 4 +++- 4 files changed, 12 insertions(+), 1 deletion(-) diff --git a/lms/envs/aws.py b/lms/envs/aws.py index d16dcd6b4a2b..5e9327376d1b 100644 --- a/lms/envs/aws.py +++ b/lms/envs/aws.py @@ -762,3 +762,7 @@ # Cutoff date for granting audit certificates if ENV_TOKENS.get('AUDIT_CERT_CUTOFF_DATE', None): AUDIT_CERT_CUTOFF_DATE = dateutil.parser.parse(ENV_TOKENS.get('AUDIT_CERT_CUTOFF_DATE')) + +################################ Settings for Credentials Service ################################ + +CREDENTIALS_GENERATION_ROUTING_KEY = HIGH_PRIORITY_QUEUE diff --git a/lms/envs/common.py b/lms/envs/common.py index 77cc19ea3879..72c63f3cf026 100644 --- a/lms/envs/common.py +++ b/lms/envs/common.py @@ -2768,3 +2768,4 @@ ################################ Settings for Credentials Service ################################ CREDENTIALS_SERVICE_USERNAME = 'credentials_service_user' +CREDENTIALS_GENERATION_ROUTING_KEY = HIGH_PRIORITY_QUEUE diff --git a/lms/envs/yaml_config.py b/lms/envs/yaml_config.py index 5b8fbdfdcd20..c798c3d74458 100644 --- a/lms/envs/yaml_config.py +++ b/lms/envs/yaml_config.py @@ -313,3 +313,7 @@ def construct_yaml_str(self, node): if FEATURES.get('ENABLE_LTI_PROVIDER'): INSTALLED_APPS += ('lti_provider',) AUTHENTICATION_BACKENDS += ('lti_provider.users.LtiBackend', ) + +################################ Settings for Credentials Service ################################ + +CREDENTIALS_GENERATION_ROUTING_KEY = HIGH_PRIORITY_QUEUE diff --git a/openedx/core/djangoapps/programs/tasks/v1/tasks.py b/openedx/core/djangoapps/programs/tasks/v1/tasks.py index a7781bf79b38..288b6cfb1dc7 100644 --- a/openedx/core/djangoapps/programs/tasks/v1/tasks.py +++ b/openedx/core/djangoapps/programs/tasks/v1/tasks.py @@ -17,6 +17,8 @@ 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) def get_api_client(api_config, student): @@ -115,7 +117,7 @@ def award_program_certificate(client, username, program_id): }) -@task(bind=True, ignore_result=True) +@task(bind=True, ignore_result=True, routing_key=ROUTING_KEY) def award_program_certificates(self, username): """ This task is designed to be called whenever a student's completion status