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

Is there a way to set graceful to True globally? #61

Closed hugobessa closed 5 years ago

hugobessa commented 6 years ago

I'd like to fail gracefully for every task except some few, so setting this to True globally would be really nice. Is it possible?

cameronmaske commented 6 years ago

@hugobessa Super delayed getting back to you. Currently there is not, but I'd be happy to take a PR that adds it to the settings, e.g.

celery.conf.ONCE = {
  'backend': 'celery_once.backends.Redis',
  'graceful': True,
   ....
}

It would work very similar to the default_timeout logic. https://github.com/cameronmaske/celery-once/blob/master/celery_once/tasks.py#L88

cameronmaske commented 5 years ago

I'm gonna close this out for now, if anyone else is interested in taking this forward, happy to re-open/discuss!