quiero saber cuándo se iniciará el trabajo en apio
Frecuentes
Visto 145 veces
0
soy nuevo en celery
. i have some configuration in celeryconfig.py
de la siguiente manera:
from datetime import timedelta
BROKER_URL='redis://localhost:6379/0'
CELERY_RESULT_BACKEND="redis"
CELERY_REDIS_HOST="localhost"
CELERY_REDIS_PORT=6379
CELERY_REDIS_DB=0
CELERY_IMPORT=("mail")
CELERYBEAT_SCHEDULE={'runs-every-30-seconds' :
{
'task': 'mail.mail',
'schedule': timedelta(seconds=30),
},
}
i have scheduled that the job will run periodically in 30 seconds. now i want that the jobs should start on 29 aug
at 4:00PM
then how should i configure this??
1 Respuestas
1
You should use Cron instead of timedelta. The Celery documentation discusses this specifically, and provides some useful examples. See Horarios de crontab
Here is an example from Celery:
from celery.schedules import crontab
CELERYBEAT_SCHEDULE = {
# Executes every Monday morning at 7:30 A.M
'every-monday-morning': {
'task': 'tasks.add',
'schedule': crontab(hour=7, minute=30, day_of_week=1),
'args': (16, 16),
},
}
To make this work for your condition, you will also need to specify the cron month_of_year
parámetro.
Respondido 29 ago 12, 05:08
No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas celery celery-task celerybeat or haz tu propia pregunta.
hey, i want that the job should start at a fix time and should repeat after every 30 secons - Rohitashv Singhal
Ah, I see what you are saying. Off the top of my head, I can't think of a simple way to do this using the CELERYBEAT_SCHEDULE setting. However, this can be accomplished by creating a custom beat schedule class. See 'Custom Scheduler Class' docs.celeryproject.org/en/latest/userguide/periodic-tasks.html and here is the actual beat scheduler class documentation docs.celeryproject.org/en/latest/internals/reference/… You will probably want to create a task that adds a new entry into the schedule, where that entry will be the 30-sec task - pedro kirby
hey for example i have a job which i want to start at 4:00 PM on 31-Aug-2012 and this job should run after every 15 minutes - Rohitashv Singhal