From 0191f2f1bbaee1d2a4f793a3ed73481a7df4e6b9 Mon Sep 17 00:00:00 2001 From: Feanil Patel Date: Tue, 27 Oct 2020 18:34:27 -0400 Subject: [PATCH] Don't install instructor_task for common testing. (#25459) * Import instructor tasks explicitly on workers. Importing them via app config leads to an dependency chain nightmare as lots of other apps get pulled into the startup and are not configured in situations like testing the common and lib unit tests. This should register tasks to the celery workers without messing with the startup dependency chains of the LMS, CMS and test setup. --- lms/djangoapps/instructor_task/apps.py | 3 +-- lms/envs/common.py | 5 ++++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/lms/djangoapps/instructor_task/apps.py b/lms/djangoapps/instructor_task/apps.py index f5454bb989..cb7ddf0095 100644 --- a/lms/djangoapps/instructor_task/apps.py +++ b/lms/djangoapps/instructor_task/apps.py @@ -12,5 +12,4 @@ class InstructorTaskConfig(AppConfig): name = u'lms.djangoapps.instructor_task' def ready(self): - # noinspection PyUnresolvedReferences - from . import tasks # pylint: disable=unused-import + pass diff --git a/lms/envs/common.py b/lms/envs/common.py index 87b5cf8a4d..cf147b1876 100644 --- a/lms/envs/common.py +++ b/lms/envs/common.py @@ -2233,7 +2233,10 @@ DEBUG_TOOLBAR_PATCH_SETTINGS = False # Celery's task autodiscovery won't find tasks nested in a tasks package. # Tasks are only registered when the module they are defined in is imported. CELERY_IMPORTS = ( - 'poll.tasks' + 'poll.tasks', + 'lms.djangoapps.instructor_task.tasks', + 'lms.djangoapps.bulk_email.tasks', + 'openedx.core.djangoapps.bookmarks.tasks', ) # Message configuration