pip install huey
python
from huey import RedisHuey
huey = RedisHuey()
@huey.task()
def process_data(data):
# ...
python
process_data('some_data')
huey_consumer.py app.huey --workers=4
python
from huey.contrib.djhuey import HUEY
from django.urls import include
urlpatterns = [
# ...
path('huey/', include(HUEY.url_patterns)),
]
python
from huey.exceptions import RetryTask
@huey.task(retries=3, retry_delay=10)
def process_data(data):
try:
# ...
except Exception as e:
raise RetryTask()