python
from huey import RedisHuey
from huey.exceptions import TaskTimeout
huey = RedisHuey()
@huey.task(retries=3, retry_delay=5)
def process_task(task_data):
# ...
try:
result = process_task.consume(timeout=10)
except TaskTimeout:
# ...
python
from huey import RedisHuey
huey = RedisHuey(retries=3, retry_delay=5)
@huey.task()
def process_task(task_data):
# ...
result = process_task()
if result is not None and result.is_failure():
# ...
python
# huey_config.py
HUEY = {
'name': 'my-huey-queue',
'connection': {
'host': 'localhost',
'port': 6379,
},
'always_eager': False,
'result_store': True,
'consumer_options': {
'workers': 4,
'worker_type': 'thread',
'initial_delay': 0.1,
'backoff': 1.15,
'max_delay': 10.0,
},
'task_serializer': 'json',
'result_serializer': 'json',
'max_errors': 5,
'store_none': False,
'utc': False,
}