This is what I’ve found:
Kombu uses its own json serializer, and it calls the __json__ method for unknown classes:
So I added the __json__ method in the same way as the to_json in the LazyStaticAbsoluteUrl class:
def __json__(self):
return str(self)
Now the error is gone and the logs look better:
2022-01-11 16:22:26,589 INFO 1 [celery.worker.strategy] [user None] [ip None] strategy.py:157 - Received task: lms.djangoapps.instructor_task.tasks.send_bulk_course_email[975f5f3f-c87e-49d4-9db5-b3e5eb8bfa33]
2022-01-11 16:22:26,648 INFO 12 [edx.celery.task] [user None] [ip None] runner.py:108 - Task: 975f5f3f-c87e-49d4-9db5-b3e5eb8bfa33, InstructorTask ID: 14, Course: course-v1:edX+DemoX+Demo_Course, Input: {'email_id': 14, 'to_option': ['myself']}, Starting update (nothing emailed yet)
2022-01-11 16:22:26,677 INFO 12 [edx.celery.task] [user None] [ip None] tasks.py:194 - Task 975f5f3f-c87e-49d4-9db5-b3e5eb8bfa33: Preparing to queue subtasks for sending emails for course course-v1:edX+DemoX+Demo_Course, email 14
2022-01-11 16:22:26,678 INFO 12 [edx.celery.task] [user None] [ip None] subtasks.py:308 - Task 975f5f3f-c87e-49d4-9db5-b3e5eb8bfa33: updating InstructorTask 14 with subtask info for 1 subtasks to process 1 items.
2022-01-11 16:22:26,693 INFO 12 [edx.celery.task] [user None] [ip None] subtasks.py:331 - Task 975f5f3f-c87e-49d4-9db5-b3e5eb8bfa33: creating 1 subtasks to process 1 items.
2022-01-11 16:22:26,695 INFO 12 [edx.celery.task] [user None] [ip None] subtasks.py:343 - Queueing BulkEmail Task: 975f5f3f-c87e-49d4-9db5-b3e5eb8bfa33 Subtask: 85e6691c-b494-45e3-b41c-a4c7d22c1794 at timestamp: 2022-01-11 16:22:26.695370
2022-01-11 16:22:26,735 INFO 12 [edx.celery.task] [user None] [ip None] runner.py:126 - Task: 975f5f3f-c87e-49d4-9db5-b3e5eb8bfa33, InstructorTask ID: 14, Course: course-v1:edX+DemoX+Demo_Course, Input: {'email_id': 14, 'to_option': ['myself']}, Task type: emailed, Finishing task: {'action_name': 'emailed', 'attempted': 0, 'failed': 0, 'skipped': 0, 'succeeded': 0, 'total': 1, 'duration_ms': 0, 'start_time': 1641918146.6798043}
2022-01-11 16:22:26,739 INFO 12 [celery.app.trace] [user None] [ip None] trace.py:125 - Task lms.djangoapps.instructor_task.tasks.send_bulk_course_email[975f5f3f-c87e-49d4-9db5-b3e5eb8bfa33] succeeded in 0.141009203158319s: {'action_name': 'emailed', 'attempted': 0, 'failed': 0, 'skipped': 0, 'succeeded': 0, 'total': 1, 'duration_ms': 0, 'start_time': 1641918146.6798043}
However, I cannot get the emails sent. They stay in “PROGRESS” “Incomplete”.
Any idea?