cameronmaske / celery-once

Celery Once allows you to prevent multiple execution and queuing of celery tasks.
https://pypi.python.org/pypi/celery_once/
BSD 2-Clause "Simplified" License
661 stars 90 forks source link

Only delay and apply_async check against the lock. #113

Open sogloarcadius opened 4 years ago

sogloarcadius commented 4 years ago

Hello,

I am struglling to make celery-once check against the lock when using celery.send_task. Can you explain me the reason why it fails to check against the lock when using send_task ? Is it possible to add this feature to the library ?

I am making the flower rest api available to the end users to make calls to my tasks and it would be great if celery_once could prevent calling the task when using send_task endpoint ?

Thanks,

Regards

frankV commented 4 years ago

Hey @sogloarcadius this is probably late for you, but in case someone else finds this you can use a signature instead of send_task.

It works similar to send_task, here's an example:

from celery import signature

signature("task.name", (arg1, arg2), countdown=60,).apply_async()