From 0f11d398029f3682334309fd739781e6d1befc2d Mon Sep 17 00:00:00 2001 From: Andrew Melton Date: Tue, 2 Apr 2013 14:07:57 -0400 Subject: [PATCH] Only select exists without audit_period's for migration --- migrations/006_populate_rebuilds_from_rawdata.py | 5 +++-- migrations/008_exists_audit_period.py | 7 +++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/migrations/006_populate_rebuilds_from_rawdata.py b/migrations/006_populate_rebuilds_from_rawdata.py index 839ae61..e2111b3 100644 --- a/migrations/006_populate_rebuilds_from_rawdata.py +++ b/migrations/006_populate_rebuilds_from_rawdata.py @@ -58,8 +58,9 @@ def add_past_usage(raws): if processed % 50 == 0: next_update = last_update + datetime.timedelta(seconds=30) if datetime.datetime.utcnow() > next_update: - (processed, count - processed, float(processed) / count) - print "%s processed, %s to go, %.2f percent done" + values = (processed, count - processed, + (float(processed) / count) * 100) + print "%s processed, %s to go, %.2f percent done" % values print "completed processing %s events" % count diff --git a/migrations/008_exists_audit_period.py b/migrations/008_exists_audit_period.py index 4e931f0..b661f62 100644 --- a/migrations/008_exists_audit_period.py +++ b/migrations/008_exists_audit_period.py @@ -27,8 +27,11 @@ def print_update(total, completed, errored): to_go = total - (completed + errored) print "%s populated, %s to go, %s errored" % (completed, to_go, errored) - -exists = models.InstanceExists.objects.all() +filters = { + 'audit_period_beginning__exact': None, + 'audit_period_ending__exact': None +} +exists = models.InstanceExists.objects.filter(**filters) count = exists.count() start = datetime.datetime.utcnow()