Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NotPrimaryError handling fix #12

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions pytpcc/drivers/mongodbdriver.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
2 changes: 1 addition & 1 deletion pytpcc/util/results.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)]),
Expand Down