protect against 0-task runs
authorerickson <erickson@6d9bc8c9-1ec2-4278-b937-99fde70a366f>
Sun, 11 Apr 2010 19:33:43 +0000 (19:33 +0000)
committererickson <erickson@6d9bc8c9-1ec2-4278-b937-99fde70a366f>
Sun, 11 Apr 2010 19:33:43 +0000 (19:33 +0000)
git-svn-id: svn://svn.open-ils.org/ILS-Contrib/constrictor/trunk@861 6d9bc8c9-1ec2-4278-b937-99fde70a366f

constrictor/data.py

index 946f8fc..ac8d0be 100644 (file)
@@ -83,6 +83,14 @@ class Data(object):
     def store_data(self):
 
         end_time = time.time()
+        total_tasks = len(self.runtime_data)
+        task_counts = {}
+        task_times = 0
+        counter = 0
+
+        if total_tasks == 0:
+            log.log_info("No tasks were run!")
+            return
 
         # close out the task set
         if self.insert_data:
@@ -95,11 +103,6 @@ class Data(object):
                     )
             ).close()
 
-        task_counts = {}
-        task_times = 0
-        total_tasks = len(self.runtime_data)
-        counter = 0
-
         log.log_info("Inserting %d rows of data into data store..." % total_tasks)
 
         # insert all of the task data