django-celery icon indicating copy to clipboard operation
django-celery copied to clipboard

Dynamic periodic task persistence API

Open ldmberman opened this issue 10 years ago • 0 comments

I think it would be very helpful to have some sort of API for creating/updating/deleting tasks dynamically in runtime.

For now it is possible to create such things manually, eg:

from djcelery.models import PeriodicTask
from djcelery.schedulers import DatabaseScheduler


def create_or_update_periodic_task(task_id, schedule_dict):
    DatabaseScheduler.Entry.from_entry(task_id, **schedule_dict)


def delete_periodic_task(task_id):
    task_to_delete = PeriodicTask.objects.get(name=task_id)
    if task_to_delete:
        task_to_delete.delete()

but it would be very convenient to have this functionality implemented and documented as part of django-celery.

I can come up with a pull request to improve further discussion.

ldmberman avatar Feb 18 '15 12:02 ldmberman