I'm working with a django (django=2.2 & python3.6.9) project that has very few celery tasks.
The celery background tasks currently in the project deal with sending emails, sending dashboard notifications etc.
Below I mention examples of how the celery tasks are defined in the project:
# tasks.py
...
from celery import shared_task
from backend.tasks import json_result
...
@shared_task
@json_result
def task1(args):
# logic_here
...
@shared_task
def send_email():
# logic here
...
@shared_task
def task2(args):
# logic here
...
# Trigger other Celery shared task for sending email
send_email.apply_async(
args=[user.pk], countdown=10)
Since the load on celery is quite less, I thought of replacing them with simple async python functions that would run in the background.
I haven't myself used celery or asyncio library in my django projects till now so I'm in need of some help.
Would highly appreciate if someone helps me with any information on how to do this, or if there is any similar/better way.
Also if there are any books/docs or any resource on the internet that would help, please share it along.
Thanks!