forked from 0x2620/pandora
run cron task in the morning
This commit is contained in:
parent
bf62056bb2
commit
910b8426dc
3 changed files with 6 additions and 2 deletions
|
@ -17,6 +17,7 @@ test -e /var/log/pandora || (mkdir -p /var/log/pandora && chown $USER:$USER /var
|
||||||
test -e /var/run/pandora || (mkdir -p /var/run/pandora && chown $USER:$USER /var/run/pandora)
|
test -e /var/run/pandora || (mkdir -p /var/run/pandora && chown $USER:$USER /var/run/pandora)
|
||||||
cd $VENV/pandora
|
cd $VENV/pandora
|
||||||
exec /usr/bin/sudo -u $USER $VENV/bin/python $VENV/pandora/manage.py celeryd \
|
exec /usr/bin/sudo -u $USER $VENV/bin/python $VENV/pandora/manage.py celeryd \
|
||||||
|
-B \
|
||||||
-Q encoding \
|
-Q encoding \
|
||||||
-n pandora-encoding \
|
-n pandora-encoding \
|
||||||
-p /var/run/pandora/pandora-encoding.pid \
|
-p /var/run/pandora/pandora-encoding.pid \
|
||||||
|
|
|
@ -3,11 +3,13 @@
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
|
|
||||||
from celery.decorators import task, periodic_task
|
from celery.decorators import task, periodic_task
|
||||||
|
from celery.task.schedules import crontab
|
||||||
|
|
||||||
|
|
||||||
from models import Event
|
from models import Event
|
||||||
|
|
||||||
|
|
||||||
@periodic_task(run_every=timedelta(days=1), queue='encoding')
|
@periodic_task(run_every=crontab(hour=7, minute=30), queue='encoding')
|
||||||
def update_all_matches(**kwargs):
|
def update_all_matches(**kwargs):
|
||||||
ids = [e['id'] for e in Event.objects.all().values('id')]
|
ids = [e['id'] for e in Event.objects.all().values('id')]
|
||||||
for i in ids:
|
for i in ids:
|
||||||
|
|
|
@ -3,11 +3,12 @@
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
|
|
||||||
from celery.decorators import task, periodic_task
|
from celery.decorators import task, periodic_task
|
||||||
|
from celery.task.schedules import crontab
|
||||||
|
|
||||||
import models
|
import models
|
||||||
|
|
||||||
|
|
||||||
@periodic_task(run_every=timedelta(days=1), queue='encoding')
|
@periodic_task(run_every=crontab(hour=6, minute=30), queue='encoding')
|
||||||
def update_all_matches(**kwargs):
|
def update_all_matches(**kwargs):
|
||||||
ids = [p['id'] for p in models.Place.objects.all().values('id')]
|
ids = [p['id'] for p in models.Place.objects.all().values('id')]
|
||||||
for i in ids:
|
for i in ids:
|
||||||
|
|
Loading…
Reference in a new issue