aboutsummaryrefslogtreecommitdiff
path: root/wqflask/utility
diff options
context:
space:
mode:
authorzsloan2018-04-06 15:51:24 +0000
committerzsloan2018-04-06 15:51:24 +0000
commit275cf9b5512df676d23f6f26ba85b5cb2d772b68 (patch)
treefc1e83540f0891cffbecf1e91909da1d83fc7513 /wqflask/utility
parent07c0daa04b2693f55dd69cae43c254ebb5c9a35b (diff)
parentc574ab005a1b61f253a7f33211c92c19bbc01301 (diff)
downloadgenenetwork2-275cf9b5512df676d23f6f26ba85b5cb2d772b68.tar.gz
Merge branch 'testing' of github.com:genenetwork/genenetwork2 into testing
Diffstat (limited to 'wqflask/utility')
-rw-r--r--wqflask/utility/elasticsearch_tools.py9
-rw-r--r--wqflask/utility/tools.py12
2 files changed, 13 insertions, 8 deletions
diff --git a/wqflask/utility/elasticsearch_tools.py b/wqflask/utility/elasticsearch_tools.py
index 734379f7..1dba357d 100644
--- a/wqflask/utility/elasticsearch_tools.py
+++ b/wqflask/utility/elasticsearch_tools.py
@@ -12,6 +12,7 @@ def test_elasticsearch_connection():
logger.warning("Elasticsearch is DOWN")
def get_elasticsearch_connection():
+ """Return a connection to ES. Returns None on failure"""
logger.info("get_elasticsearch_connection")
es = None
try:
@@ -20,14 +21,14 @@ def get_elasticsearch_connection():
logger.info("ES HOST",ELASTICSEARCH_HOST)
es = Elasticsearch([{
- "host": ELASTICSEARCH_HOST
- , "port": ELASTICSEARCH_PORT
+ "host": ELASTICSEARCH_HOST, "port": ELASTICSEARCH_PORT
}]) if (ELASTICSEARCH_HOST and ELASTICSEARCH_PORT) else None
es_logger = logging.getLogger("elasticsearch")
es_logger.setLevel(logging.INFO)
es_logger.addHandler(logging.NullHandler())
except:
+ logger.error("Failed to get elasticsearch connection")
es = None
return es
@@ -42,9 +43,7 @@ def get_item_by_unique_column(es, column_name, column_value, index, doc_type):
item_details = None
try:
response = es.search(
- index = index
- , doc_type = doc_type
- , body = {
+ index = index, doc_type = doc_type, body = {
"query": { "match": { column_name: column_value } }
})
if len(response["hits"]["hits"]) > 0:
diff --git a/wqflask/utility/tools.py b/wqflask/utility/tools.py
index 59bb49d8..ea216a35 100644
--- a/wqflask/utility/tools.py
+++ b/wqflask/utility/tools.py
@@ -285,10 +285,16 @@ TEMPDIR = tempdir() # defaults to UNIX TMPDIR
assert_dir(TEMPDIR)
# ---- Handle specific JS modules
+JS_GUIX_PATH = get_setting("JS_GUIX_PATH")
+assert_dir(JS_GUIX_PATH)
+assert_dir(JS_GUIX_PATH+'/cytoscape-panzoom')
+CSS_PATH = "UNKNOWN"
+# assert_dir(JS_PATH)
JS_TWITTER_POST_FETCHER_PATH = get_setting("JS_TWITTER_POST_FETCHER_PATH",js_path("Twitter-Post-Fetcher"))
assert_dir(JS_TWITTER_POST_FETCHER_PATH)
-
-from six import string_types
+assert_file(JS_TWITTER_POST_FETCHER_PATH+"/js/twitterFetcher_min.js")
+JS_CYTOSCAPE_PATH = get_setting("JS_CYTOSCAPE_PATH",js_path("cytoscape"))
+assert_dir(JS_CYTOSCAPE_PATH)
+assert_file(JS_CYTOSCAPE_PATH+'/cytoscape.min.js')
# assert_file(PHEWAS_FILES+"/auwerx/PheWAS_pval_EMMA_norm.RData")
-assert_file(JS_TWITTER_POST_FETCHER_PATH+"/js/twitterFetcher_min.js")