From 8d65eaea1fa5eeb0b4f105cef8b21e8eee1a2960 Mon Sep 17 00:00:00 2001 From: Corentin Chary Date: Thu, 26 Jul 2012 21:18:43 +0200 Subject: [PATCH] djeuscan: use crontabs and depends on djcelery migrations Signed-off-by: Corentin Chary --- .../0015_initial_celery_periodictasks.py | 34 +++++++++++-------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/euscanwww/djeuscan/migrations/0015_initial_celery_periodictasks.py b/euscanwww/djeuscan/migrations/0015_initial_celery_periodictasks.py index a5b3bed..d86eca9 100644 --- a/euscanwww/djeuscan/migrations/0015_initial_celery_periodictasks.py +++ b/euscanwww/djeuscan/migrations/0015_initial_celery_periodictasks.py @@ -4,34 +4,38 @@ from south.v2 import DataMigration class Migration(DataMigration): + depends_on = ( + ("djcelery", "0001_initial"), + ) + def forwards(self, orm): - every_minute = orm["djcelery.IntervalSchedule"].objects.create( - every=1, period="minutes" + every_day = orm["djcelery.CrontabSchedule"].objects.create( + minute = "00", + hour = "01", + day_of_week = "*", + day_of_month = "*", + month_of_year = "*" ) - every_day = orm["djcelery.IntervalSchedule"].objects.create( - every=1, period="days" - ) - every_week = orm["djcelery.IntervalSchedule"].objects.create( - every=7, period="days" - ) - orm["djcelery.PeriodicTask"].objects.create( - name="Refresh package queries", - task="djeuscan.tasks.consume_refresh_package_request", - interval=every_minute + every_week = orm["djcelery.CrontabSchedule"].objects.create( + minute = "00", + hour = "03", + day_of_week = "1", + day_of_month = "*", + month_of_year = "*" ) orm["djcelery.PeriodicTask"].objects.create( name="Daily portage update", task="djeuscan.tasks.update_portage", - interval=every_day + crontab=every_day ) orm["djcelery.PeriodicTask"].objects.create( name="Weekly upstream update", task="djeuscan.tasks.update_upstream", - interval=every_week + crontab=every_week ) def backwards(self, orm): - orm["djcelery.IntervalSchedule"].objects.all().delete() + orm["djcelery.CrontabSchedule"].objects.all().delete() orm["djcelery.PeriodicTask"].objects.all().delete()