[Django]-Celery scheduled tasks with expiration time for each task instance?

0👍

I solved it by running an scheduled task which runs defined task with desired expiry time:

@shared_task(bind=True, queue='q1', max_retries=3)
def parent_task(self, arg1):
    child_task.apply_async(kwargs={'arg1': arg1}, expires=86400)


@shared_task(bind=True, queue='q1', max_retries=3)
def child_task(self, arg1):
    pass
👤mhk

0👍

Sounds like you need to use a custom scheduler class.

Leave a comment