changeset 895:e7c549e4dbf7

Add counter and timer.
author Brian Neal <bgneal@gmail.com>
date Thu, 19 Feb 2015 21:02:21 -0600
parents 101728976f9c
children 0054a4a88c1c
files core/management/commands/ssl_images.py
diffstat 1 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/core/management/commands/ssl_images.py	Wed Feb 18 21:20:31 2015 -0600
+++ b/core/management/commands/ssl_images.py	Thu Feb 19 21:02:21 2015 -0600
@@ -7,6 +7,7 @@
       an S3 bucket. The src attribute is replaced with the new S3 URL.
 """
 import base64
+import datetime
 import httplib
 import logging
 from optparse import make_option
@@ -312,6 +313,7 @@
             )
 
     def handle_noargs(self, **options):
+        time_started = datetime.datetime.now()
         _setup_logging()
         logger.info("Starting; arguments received: %s", options)
 
@@ -363,6 +365,7 @@
         if i is None:
             i = 0
 
+        count = 0
         for n, model in enumerate(qs.iterator()):
             if quit_flag:
                 logger.warning("SIGINT received, exiting")
@@ -384,5 +387,9 @@
                 # the model again to force updated HTML to be created.
                 logger.info("Older Smiley HTML detected, forcing a save")
                 model.save()
+            count += 1
 
-        logger.info("ssl_images exiting")
+        time_finished = datetime.datetime.now()
+        elapsed = time_finished - time_started
+        logger.info("ssl_images exiting; number of objects: %d; elapsed: %s",
+                    count, elapsed)