From 4548a6df055a19d7dfbb2d44aec522bf26d670ca Mon Sep 17 00:00:00 2001 From: Tim Laszlo Date: Mon, 15 Oct 2012 07:49:52 -0500 Subject: migrate_db: add timing for imports --- tools/upgrade/1.3/migrate_dbstats.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'tools/upgrade') diff --git a/tools/upgrade/1.3/migrate_dbstats.py b/tools/upgrade/1.3/migrate_dbstats.py index 7a330cc99..ae2eed132 100755 --- a/tools/upgrade/1.3/migrate_dbstats.py +++ b/tools/upgrade/1.3/migrate_dbstats.py @@ -5,6 +5,7 @@ os.environ['DJANGO_SETTINGS_MODULE'] = 'Bcfg2.settings' import sys import logging +import time import Bcfg2.Logger import Bcfg2.Options from django.core.cache import cache @@ -243,10 +244,16 @@ def _restructure(): failures = [] int_count = legacy_models.Interaction.objects.count() int_ctr = 0 + start_time = 0 for inter in BatchFetch(legacy_models.Interaction.objects.\ select_related('metadata', 'client').all()): if int_ctr % 1000 == 0: - logger.info("Migrated %s of %s interactions" % (int_ctr, int_count)) + if int_ctr > 0: + logger.info("Migrated %s of %s interactions in %ss" % \ + (int_ctr, int_count, time.time() - start_time)) + else: + logger.info("Migrating interactions") + start_time = time.time() try: _migrate_transaction(inter, entries, fperms) except: -- cgit v1.2.3-1-g7c22