[open-ils-commits] r794 - constrictor/trunk/constrictor (erickson)
svn at svn.open-ils.org
svn at svn.open-ils.org
Tue Feb 23 21:41:24 EST 2010
Author: erickson
Date: 2010-02-23 21:41:22 -0500 (Tue, 23 Feb 2010)
New Revision: 794
Modified:
constrictor/trunk/constrictor/data.py
Log:
only update end time on current task set (not all). log some basic stats after storing data
Modified: constrictor/trunk/constrictor/data.py
===================================================================
--- constrictor/trunk/constrictor/data.py 2010-02-24 02:35:50 UTC (rev 793)
+++ constrictor/trunk/constrictor/data.py 2010-02-24 02:41:22 UTC (rev 794)
@@ -67,8 +67,9 @@
def create_task_set(self):
+ self.task_set_start_time = time.time()
res = self.engine.execute(
- self.task_set_table.insert().values(start_time = time.time())
+ self.task_set_table.insert().values(start_time = self.task_set_start_time)
)
#self.task_set_id = res.inserted_primary_key
self.task_set_id = res.last_inserted_ids()[0]
@@ -76,11 +77,17 @@
def store_data(self):
+ end_time = time.time()
log.log_info("Inserting data into data store...")
# close out the task set
self.engine.execute(
- self.task_set_table.update().values(end_time = time.time())
+ self.task_set_table.update(
+ ).where(
+ self.task_set_table.c.id == self.task_set_id
+ ).values(
+ end_time = end_time
+ )
).close()
# insert all of the task data
@@ -97,4 +104,10 @@
)
).close()
+ # log some basic stats
+ task_set_time = end_time - self.task_set_start_time
+ log.log_info(
+ "Total time %0.3f seconds, %d total tasks, average task duration %0.3f seconds" % (
+ task_set_time, len(self.runtime_data), task_set_time / len(self.runtime_data)))
+
More information about the open-ils-commits
mailing list