diff options
author | Tim Laszlo <tim.laszlo@gmail.com> | 2012-10-15 07:49:52 -0500 |
---|---|---|
committer | Tim Laszlo <tim.laszlo@gmail.com> | 2012-10-15 07:49:52 -0500 |
commit | 4548a6df055a19d7dfbb2d44aec522bf26d670ca (patch) | |
tree | fad35873ae264e2513f4fca43876f847616eeeff /tools/upgrade/1.3 | |
parent | 3c154d9beeae2a7a411cbaaae8797d1f0c2f063c (diff) | |
download | bcfg2-4548a6df055a19d7dfbb2d44aec522bf26d670ca.tar.gz bcfg2-4548a6df055a19d7dfbb2d44aec522bf26d670ca.tar.bz2 bcfg2-4548a6df055a19d7dfbb2d44aec522bf26d670ca.zip |
migrate_db: add timing for imports
Diffstat (limited to 'tools/upgrade/1.3')
-rwxr-xr-x | tools/upgrade/1.3/migrate_dbstats.py | 9 |
1 files changed, 8 insertions, 1 deletions
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: |