aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPjotr Prins2016-06-21 09:55:11 +0000
committerPjotr Prins2016-06-21 09:55:11 +0000
commit67472b942129130ea77cb0a15e14ef42fd4d3b91 (patch)
tree7c24d7caf3fd79bcb9ac673978adc53447165141
parent74ab1eff68fdad4183ce2a7490cfbc9ac1f4513f (diff)
downloadgenenetwork2-67472b942129130ea77cb0a15e14ef42fd4d3b91.tar.gz
Logger: switch for logging SQLALCHEMY
-rw-r--r--etc/default_settings.py3
-rw-r--r--wqflask/dbFunction/webqtlDatabaseFunction.py13
-rw-r--r--wqflask/utility/tools.py1
-rw-r--r--wqflask/wqflask/user_manager.py4
4 files changed, 9 insertions, 12 deletions
diff --git a/etc/default_settings.py b/etc/default_settings.py
index 4bb1b80c..b0060ed3 100644
--- a/etc/default_settings.py
+++ b/etc/default_settings.py
@@ -38,7 +38,8 @@ WEBSERVER_DEPLOY = None # Deployment specifics (nyi)
LOG_LEVEL = 'WARNING' # Logger mode (DEBUG|INFO|WARNING|ERROR|CRITICAL)
LOG_LEVEL_DEBUG = 1 # Debug log level (0-5) (nyi)
-LOG_SQL = 'False' # Log SQL/backend calls
+LOG_SQL = 'False' # Log SQL/backend and GN_SERVER calls
+LOG_SQLALCHEMY = 'False'
LOG_BENCH = True # Log bench marks
USE_REDIS = True # REDIS caching (note that redis will be phased out)
diff --git a/wqflask/dbFunction/webqtlDatabaseFunction.py b/wqflask/dbFunction/webqtlDatabaseFunction.py
index b14c9312..846d5146 100644
--- a/wqflask/dbFunction/webqtlDatabaseFunction.py
+++ b/wqflask/dbFunction/webqtlDatabaseFunction.py
@@ -80,16 +80,11 @@ def retrieve_species(group):
result = fetchone("select Species.Name from Species, InbredSet where InbredSet.Name = '%s' and InbredSet.SpeciesId = Species.Id" % (group))
return result[0]
-###########################################################################
-#input: cursor, groupName (string)
-#output: mappingMethodId (int) info, value will be Null or else
-#function: retrieve mappingMethodId info from InbredSet table
-###########################################################################
-
def getMappingMethod(cursor=None, groupName=None):
- cursor.execute("select MappingMethodId from InbredSet where Name= '%s'" % groupName)
- mappingMethodId = cursor.fetchone()[0]
- return mappingMethodId
+ if USE_GN_SERVER:
+ return gn_server("/cross/"+group+".json")["mapping_method_id"]
+ else:
+ return fetchone("select MappingMethodId from InbredSet where Name= '%s'" % groupName)
###########################################################################
#input: cursor, inbredSetId (int), strainId (int)
diff --git a/wqflask/utility/tools.py b/wqflask/utility/tools.py
index c1b635e0..0df471fc 100644
--- a/wqflask/utility/tools.py
+++ b/wqflask/utility/tools.py
@@ -171,6 +171,7 @@ WEBSERVER_MODE = get_setting('WEBSERVER_MODE')
LOG_LEVEL = get_setting('LOG_LEVEL')
LOG_LEVEL_DEBUG = get_setting_int('LOG_LEVEL_DEBUG')
LOG_SQL = get_setting_bool('LOG_SQL')
+LOG_SQLALCHEMY = get_setting_bool('LOG_SQLALCHEMY')
LOG_BENCH = get_setting_bool('LOG_BENCH')
USE_REDIS = get_setting_bool('USE_REDIS')
USE_GN_SERVER = get_setting_bool('USE_GN_SERVER')
diff --git a/wqflask/wqflask/user_manager.py b/wqflask/wqflask/user_manager.py
index 6c67cc87..10fac06d 100644
--- a/wqflask/wqflask/user_manager.py
+++ b/wqflask/wqflask/user_manager.py
@@ -46,7 +46,7 @@ from wqflask.database import db_session
from wqflask import model
from utility import Bunch, Struct, after
-from utility.tools import LOG_SQL
+from utility.tools import LOG_SQL, LOG_SQLALCHEMY
import logging
from utility.logger import getLogger
@@ -145,7 +145,7 @@ class UserSession(object):
"""Actual sqlalchemy record"""
# Only look it up once if needed, then store it
try:
- if LOG_SQL:
+ if LOG_SQLALCHEMY:
logging.getLogger('sqlalchemy.pool').setLevel(logging.DEBUG)
# Already did this before