From bd0a84464fe9054515085f102ac5587ee12010c5 Mon Sep 17 00:00:00 2001 From: said-moj <45761276+said-moj@users.noreply.github.com> Date: Wed, 9 Aug 2023 08:45:25 +0100 Subject: [PATCH] Manually register reason for contacting export task --- cla_backend/apps/reports/tasks.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/cla_backend/apps/reports/tasks.py b/cla_backend/apps/reports/tasks.py index 25b17fe1e..dc64f75be 100644 --- a/cla_backend/apps/reports/tasks.py +++ b/cla_backend/apps/reports/tasks.py @@ -153,10 +153,15 @@ def run(self, user_id, filename, form_class_name, post_data, *args, **kwargs): pass +# The Task base class no longer automatically register tasks +# https://docs.celeryq.dev/en/v4.0.0/whatsnew-4.0.html#the-task-base-class-no-longer-automatically-register-tasks +# https://github.com/celery/celery/issues/5992 app.tasks.register(OBIEEExportTask()) class ReasonForContactingExportTask(ExportTaskBase): + name = "reasonforcontactingexport" + def run(self, user_id, filename, form_class_name, post_data, *args, **kwargs): """ Export csv files for each of the referrers from reason for contacting @@ -228,3 +233,9 @@ def generate_rfc_zip(self): with ZipFile(self.filepath, "w") as refer_zip: for csv_file in glob.glob("*.csv"): refer_zip.write(csv_file) + + +# The Task base class no longer automatically register tasks +# https://docs.celeryq.dev/en/v4.0.0/whatsnew-4.0.html#the-task-base-class-no-longer-automatically-register-tasks +# https://github.com/celery/celery/issues/5992 +app.tasks.register(ReasonForContactingExportTask())