0

Django Celery Beat has an option in the admin panel where you can run tasks directly by selecting each individual PeriodicTask model object.

https://github.com/celery/django-celery-beat

enter image description here

from django_celery_beat.models import PeriodicTask

get_task = PeriodicTask.objects.get(id=1)
  • different objects have different tasks registered to them. How to execute the celery task by taking the values from the PeriodicTask model object?
1

1 Answer 1

1
from celery.execute import send_task   
from django_celery_beat.models import PeriodicTask
import json

get_task = PeriodicTask.objects.get(id=1)
get_task_registed_taskname = get_task.task
get_task_kwargs = json.loads(get_task.kwargs)

send_task(get_task_registed_taskname,[],get_task_kwargs)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.