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

can you specify prefix of task name? #79

Open grayguest opened 5 years ago

grayguest commented 5 years ago

can you specify prefix of task name, because our company have unified format.

grayguest commented 5 years ago

sorry, i am wrong, i want to know how to specify the prefix of redis lock, now is 'qo', how to change it manual?

grayguest commented 5 years ago

ok, i got it, it's here. https://sourcegraph.com/github.com/cameronmaske/celery-once@master/-/blob/celery_once/helpers.py?utm_source=share#L76

cameronmaske commented 5 years ago

Hey @grayguest sorry for my lack of reply, but seems you found the source.

I'm gonna close this out for now, if you have an interest in making the prefix configurable, feel free to re-open this for a discussion.

process0 commented 5 years ago

@cameronmaske

I think it would be useful to have the prefix configurable. RedBeat ( a Celery Beat schedule using Redis) has this option. It allows for multiple versions of the same app to run on the same Redis server without conflict.

Something like

app.conf.ONCE = {
    ...
    'key_prefix': 'dev'
}
cameronmaske commented 5 years ago

@boundless-thread Certainly, that's a nice paradigm! PR welcome.

Alternatively, you can keep the keys separated by assigning them a different Redis DB within the same server, i.e. redis://localhost:6379/?db=2