2017-01-13 21:33:02 -05:00

16 lines
376 B
Python

from corputils.models import CorpStats
from celery.task import task, periodic_task
from celery.task.schedules import crontab
@task
def update_corpstats(pk):
cs = CorpStats.objects.get(pk=pk)
cs.update()
@periodic_task(run_every=crontab(minute=0, hour="*/6"))
def update_all_corpstats():
for cs in CorpStats.objects.all():
update_corpstats.delay(cs.pk)