import djcelery
from datetime import timedelta
djcelery.setup_loader()
CELERY_QUEUES = {
'beat_tasks':{
'exchange':'beat_tasks',
'exchange_type':'direct',
'binding_key':'beat_tasks',
},
'work_queue': {
'exchange': ' Work_queue ' ,
' exchange_type ' : ' Direct ' ,
' binding_key ' : ' work_queue ' ,
}
}
CELERY_DEFAULT_QUEUE = ' work_queue '
CELERY_IMPORTS = (
' app01.tasks ' ,
)
# some cases may prevent deadlocks
CELERYD_FORCE_EXECV = True
# Set The number of concurrent worker
CELERYD_CONCURRENCY. 4 = # retry is
= CELERY_ACKS_LATE True
# per worker to execute up to 100 task is destroyed, it is possible to prevent a memory leak
CELERYD_MAX_TASKS_PER_CHILD = 100 # timeout
CELERYD_TASK_TIME_LIMIT * 30 = 12 is
CELERYBEAT_SCHEDULE = {
' Task1 ' : {
' Task ' : ' Course-Task ' ,
' Schedule ' : timedelta (= seconds The. 5 ),
' Options ' : {
' Queue ' : ' beat_tasks '
}
}
}