aboutsummaryrefslogtreecommitdiff
path: root/wqflask/db/call.py
diff options
context:
space:
mode:
authorMunyoki Kilyungi2022-08-30 11:36:58 +0300
committerBonfaceKilz2022-08-31 23:14:30 +0300
commit9d0f492d8a999c1a3eb6525b0ae72bbbcaad4279 (patch)
tree8bfce7520ce59eb5950f7b1ed7783872344793bf /wqflask/db/call.py
parent8c06a9534d3340ff0287b5c70f63b2000b6eb612 (diff)
downloadgenenetwork2-9d0f492d8a999c1a3eb6525b0ae72bbbcaad4279.tar.gz
Remove "with Bench ..." calls
"with Bench" instruments how long a function takes and generates time reports on as INFO logs. This should be done on a developer server. Should the log level be low enough, this bench marks will generate a lot of noise. Instrumentation should be done during development. * wqflask/base/data_set.py (create_datasets_list): Remove "with Bench...". * wqflask/db/call.py (fetchone): Ditto. (fetchall): Ditto. (gn_server): Ditto. * wqflask/wqflask/gsearch.py (GSearch.__init__): Ditto. * wqflask/wqflask/marker_regression/display_mapping_results.py (DisplayMappingResults.__init__): Ditto. * wqflask/wqflask/marker_regression/run_mapping.py (RunMapping.__init__): Ditto. * wqflask/wqflask/update_search_results.py (GSearch.__init__): Ditto. * wqflask/wqflask/views.py (search_page): Ditto. (heatmap_page): Ditto. (mapping_results_page): Ditto.
Diffstat (limited to 'wqflask/db/call.py')
-rw-r--r--wqflask/db/call.py38
1 files changed, 16 insertions, 22 deletions
diff --git a/wqflask/db/call.py b/wqflask/db/call.py
index a6bbda54..c27e0326 100644
--- a/wqflask/db/call.py
+++ b/wqflask/db/call.py
@@ -11,13 +11,10 @@ except:
import urllib2
import json
from utility.tools import USE_GN_SERVER, LOG_SQL, GN_SERVER_URL
-from utility.benchmark import Bench
from utility.logger import getLogger
logger = getLogger(__name__)
-# from inspect import stack
-
def fetch1(query, path=None, func=None):
"""Fetch one result as a Tuple using either a SQL query or the URI
@@ -41,11 +38,10 @@ def fetchone(query):
original fetchone, but with logging)
"""
- with Bench("SQL", LOG_SQL):
- def helper(query):
- res = g.db.execute(query)
- return res.fetchone()
- return logger.sql(query, helper)
+ def helper(query):
+ res = g.db.execute(query)
+ return res.fetchone()
+ return logger.sql(query, helper)
def fetchall(query):
@@ -53,23 +49,21 @@ def fetchall(query):
original fetchall, but with logging)
"""
- with Bench("SQL", LOG_SQL):
- def helper(query):
- res = g.db.execute(query)
- return res.fetchall()
- return logger.sql(query, helper)
+ def helper(query):
+ res = g.db.execute(query)
+ return res.fetchall()
+ return logger.sql(query, helper)
def gn_server(path):
"""Return JSON record by calling GN_SERVER
"""
- with Bench("GN_SERVER", LOG_SQL):
- res = ()
- try:
- res = urllib.request.urlopen(GN_SERVER_URL + path)
- except:
- res = urllib2.urlopen(GN_SERVER_URL + path)
- rest = res.read()
- res2 = json.loads(rest)
- return res2
+ res = ()
+ try:
+ res = urllib.request.urlopen(GN_SERVER_URL + path)
+ except:
+ res = urllib2.urlopen(GN_SERVER_URL + path)
+ rest = res.read()
+ res2 = json.loads(rest)
+ return res2