From 1937f3e471bc230217d482e2476cb7c3f5daee3a Mon Sep 17 00:00:00 2001 From: Andy McKay Date: Wed, 2 Mar 2011 10:26:57 -0800 Subject: [PATCH] add in to crons and make sure we order ids (bug 636397) --- apps/amo/cron.py | 3 ++- scripts/crontab/make-crons.py | 2 ++ scripts/crontab/preview | 1 + scripts/crontab/prod | 1 + 4 files changed, 6 insertions(+), 1 deletion(-) diff --git a/apps/amo/cron.py b/apps/amo/cron.py index 5ab6f7d086..270d85d313 100644 --- a/apps/amo/cron.py +++ b/apps/amo/cron.py @@ -173,7 +173,8 @@ def migrate_approvals(): a = MigrationTracker('approvals') id = a.get() or 0 - items = Approval.objects.filter(pk__gt=id).values_list('id', flat=True) + items = (Approval.objects.filter(pk__gt=id).order_by('id') + .values_list('id', flat=True)) for chunk in chunked(items, 100): _migrate_approvals(chunk) diff --git a/scripts/crontab/make-crons.py b/scripts/crontab/make-crons.py index be77914dcb..37de85dbaf 100755 --- a/scripts/crontab/make-crons.py +++ b/scripts/crontab/make-crons.py @@ -38,6 +38,7 @@ for dict_ in CRONS.values(): break +# TODO(andym) remove migrate_approvals when zamboni editor tools are live cron = """\ # # !!AUTO-GENERATED!! Edit scripts/crontab/make-crons.py instead. @@ -53,6 +54,7 @@ HOME = /tmp # Every 20 minutes. */20 * * * * $Z_CRON check_queues +*/20 * * * * $Z_CRON migrate_approvals # Every 30 minutes. */30 * * * * $Z_CRON tag_jetpacks diff --git a/scripts/crontab/preview b/scripts/crontab/preview index f93d5678ed..b507b00088 100644 --- a/scripts/crontab/preview +++ b/scripts/crontab/preview @@ -12,6 +12,7 @@ HOME = /tmp # Every 20 minutes. */20 * * * * cd /data/amo_python/src/preview/zamboni; /usr/bin/python26 manage.py cron check_queues +*/20 * * * * cd /data/amo_python/src/preview/zamboni; /usr/bin/python26 manage.py cron migrate_approvals # Every 30 minutes. */30 * * * * cd /data/amo_python/src/preview/zamboni; /usr/bin/python26 manage.py cron tag_jetpacks diff --git a/scripts/crontab/prod b/scripts/crontab/prod index accef27c55..4af7077578 100644 --- a/scripts/crontab/prod +++ b/scripts/crontab/prod @@ -12,6 +12,7 @@ HOME = /tmp # Every 20 minutes. */20 * * * * apache cd /data/amo_python/src/prod/zamboni; /usr/bin/python26 manage.py cron check_queues +*/20 * * * * apache cd /data/amo_python/src/prod/zamboni; /usr/bin/python26 manage.py cron migrate_approvals # Every 30 minutes. */30 * * * * apache cd /data/amo_python/src/prod/zamboni; /usr/bin/python26 manage.py cron tag_jetpacks