diff --git a/pytpcc/drivers/mongodbdriver.py b/pytpcc/drivers/mongodbdriver.py index cd4dd32..b05678c 100644 --- a/pytpcc/drivers/mongodbdriver.py +++ b/pytpcc/drivers/mongodbdriver.py @@ -341,9 +341,8 @@ def loadConfig(self, config): logging.error("ServerSelectionTimeoutError %d (%s) when connected to %s: ", exc.code, exc.details, display_uri) return - except pymongo.errors.ConnectionFailure: - logging.error("ConnectionFailure %d (%s) when connected to %s: ", - exc.code, exc.details, display_uri) + except pymongo.errors.ConnectionFailure, err: + logging.error("ConnectionFailure (%s) when connected to %s: ", str(err), display_uri) return except pymongo.errors.PyMongoError, err: logging.error("Some general error (%s) when connected to %s: ", str(err), display_uri) @@ -1150,6 +1149,10 @@ def save_result(self, result_doc): self.result_doc.update(result_doc) self.result_doc['after']=self.get_server_status() # saving test results and server statuses ('before' and 'after') into MongoDB as a single document - self.client.test.results.insert_one(self.result_doc) + try: + self.client.test.results.insert_one(self.result_doc) + except pymongo.errors.PyMongoError, err: + logging.error("An error (%s) occured during saving results into MongoDB", str(err)) + print "An error (%s) occured during saving results into MongoDB" % str(err) ## CLASS diff --git a/pytpcc/util/results.py b/pytpcc/util/results.py index 6572494..d714cdd 100644 --- a/pytpcc/util/results.py +++ b/pytpcc/util/results.py @@ -238,7 +238,7 @@ def show(self, load_time=None, driver=None, threads=1): ("with", "w/o ")[driver.no_transactions], driver.warehouses, round(txn_new_order*60/duration), txn_new_order, duration, - ("off", "on")[driver.batch_writes], total_retries, str(100.0*total_retries/total_cnt)[:5], + ("off", "on")[driver.batch_writes], total_retries, str(total_cnt and 100.0*total_retries/total_cnt)[:5], ("w/o ", "with")[driver.find_and_modify], driver.read_preference, u"%6.2f" % (1000* lat[int(samples/2)]), u"%6.2f" % (1000*lat[int(samples/100.0*75)]),