aboutsummaryrefslogtreecommitdiff
path: root/wqflask
diff options
context:
space:
mode:
authorPjotr Prins2016-10-17 09:56:28 +0000
committerPjotr Prins2016-10-17 09:56:28 +0000
commit4ce94838a8e90636910456415b0a30bb77c88aaf (patch)
tree08b2a273c1fa88b3f42683828d3358ee820ceaaf /wqflask
parent141b7336f947bb617802eda785afa5872d82d411 (diff)
parentd79f4ebc6176185660e8e69218a0e2583b8e960f (diff)
downloadgenenetwork2-4ce94838a8e90636910456415b0a30bb77c88aaf.tar.gz
Merge branch 'pjotr-gn2' into chfi
Diffstat (limited to 'wqflask')
-rw-r--r--wqflask/runserver.py11
-rw-r--r--wqflask/utility/logger.py2
-rw-r--r--wqflask/utility/tools.py10
-rw-r--r--wqflask/wqflask/templates/marker_regression_gn1.html10
-rw-r--r--wqflask/wqflask/views.py17
5 files changed, 25 insertions, 25 deletions
diff --git a/wqflask/runserver.py b/wqflask/runserver.py
index 0342b7ad..adacc712 100644
--- a/wqflask/runserver.py
+++ b/wqflask/runserver.py
@@ -19,11 +19,18 @@ ENDC = '\033[0m'
import os
app.config['SECRET_KEY'] = os.urandom(24)
-from utility.tools import WEBSERVER_MODE,get_setting_int
+from utility.tools import WEBSERVER_MODE,get_setting_int,get_setting
port = get_setting_int("SERVER_PORT")
-logger.info("GN2 is running. Visit %shttp://localhost:%s/%s" % (BLUE,port,ENDC))
+print("GN2 API server URL is ["+BLUE+get_setting("GN_SERVER_URL")+ENDC+"]")
+
+import requests
+page = requests.get(get_setting("GN_SERVER_URL"))
+if page.status_code != 200:
+ raise Exception("API server not found!")
+
+print("GN2 is running. Visit %s[http://localhost:%s/%s](%s)" % (BLUE,str(port),ENDC,get_setting("WEBSERVER_URL")))
werkzeug_logger = logging.getLogger('werkzeug')
diff --git a/wqflask/utility/logger.py b/wqflask/utility/logger.py
index bacb0aa4..128706df 100644
--- a/wqflask/utility/logger.py
+++ b/wqflask/utility/logger.py
@@ -72,7 +72,7 @@ LOG_LEVEL_DEBUG (NYI).
def warning(self,*args):
"""Call logging.warning for multiple args"""
self.collect(self.logger.warning,*args)
- self.logger.warning(self.collect(*args))
+ # self.logger.warning(self.collect(*args))
def error(self,*args):
"""Call logging.error for multiple args"""
diff --git a/wqflask/utility/tools.py b/wqflask/utility/tools.py
index 77cb6ac5..9860f63e 100644
--- a/wqflask/utility/tools.py
+++ b/wqflask/utility/tools.py
@@ -121,9 +121,14 @@ def assert_writable_dir(dir):
fh.close()
os.remove(fn)
except IOError:
- raise Exception('Unable to write test.txt to directory ' + dir )
+ raise Exception('Unable to write test.txt to directory ' + dir)
return dir
+def assert_file(fn):
+ if not valid_file(fn):
+ raise Exception('Unable to find file '+fn)
+ return fn
+
def mk_dir(dir):
if not valid_path(dir):
os.makedirs(dir)
@@ -234,4 +239,7 @@ if os.environ.get('WQFLASK_OVERRIDES'):
logger.debug(OVERRIDES)
assert_dir(get_setting("JS_BIODALLIANCE"))
+assert_file(get_setting("JS_BIODALLIANCE")+"/build/dalliance-all.js")
+assert_file(get_setting("JS_BIODALLIANCE")+"/build/worker-all.js")
assert_dir(get_setting("JS_TWITTER_POST_FETCHER"))
+assert_file(get_setting("JS_TWITTER_POST_FETCHER")+"/js/twitterFetcher_min.js")
diff --git a/wqflask/wqflask/templates/marker_regression_gn1.html b/wqflask/wqflask/templates/marker_regression_gn1.html
index e198f8fe..843c7ed9 100644
--- a/wqflask/wqflask/templates/marker_regression_gn1.html
+++ b/wqflask/wqflask/templates/marker_regression_gn1.html
@@ -414,9 +414,9 @@
provides_entrypoints: true
});
BD.putSource({name: 'Genotype',
- controlURI: "http://test-gn2.genenetwork.org/api_pre1/genotype/mouse/BXD.json",
- URIBase: "http://test-gn2.genenetwork.org/api_pre1/genotype/mouse/",
- tier_type: 'rqtl-genotype',
+ controlURI: "{{gn_server_url}}/api_pre1/genotype/mouse/BXD.json",
+ URIBase: "{{gn_server_url}}/api_pre1/genotype/mouse/",
+ tier_type: 'rqtl-genotype',
vOffset: 8,
pinned: true,
transposed: true,
@@ -466,7 +466,7 @@
});
BD.putSource({name: 'QTL',
tier_type: 'qtl',
- uri: 'http://localhost:5003/generated_text/{{csv_filename}}',
+ uri: '/generated_text/{{csv_filename}}',
style: [{
type: 'default',
style: {
@@ -481,7 +481,7 @@
}],
});
BD.putSource({name: 'SNP density',
- jbURI: "http://test-gn2.genenetwork.org/api_pre1/snp",
+ jbURI: "{{gn_server_url}}/api_pre1/snp",
jbQuery: "",
refetchOnZoom: true,
style: [{
diff --git a/wqflask/wqflask/views.py b/wqflask/wqflask/views.py
index 289d2dc6..9fdaabf3 100644
--- a/wqflask/wqflask/views.py
+++ b/wqflask/wqflask/views.py
@@ -549,6 +549,7 @@ def marker_regression_page():
gn1_template_vars = marker_regression_gn1.MarkerRegression(result).__dict__
gn1_template_vars['json_filename'] = json_filename;
gn1_template_vars['csv_filename'] = csv_filename;
+ gn1_template_vars['gn_server_url'] = GN_SERVER_URL;
pickled_result = pickle.dumps(result, pickle.HIGHEST_PROTOCOL)
logger.info("pickled result length:", len(pickled_result))
@@ -558,22 +559,6 @@ def marker_regression_page():
with Bench("Rendering template"):
rendered_template = render_template("marker_regression_gn1.html", **gn1_template_vars)
- # with Bench("Rendering template"):
- # if result['pair_scan'] == True:
- # img_path = result['pair_scan_filename']
- # logger.info("img_path:", img_path)
- # initial_start_vars = request.form
- # logger.info("initial_start_vars:", initial_start_vars)
- # imgfile = open(TEMPDIR + '/' + img_path, 'rb')
- # imgdata = imgfile.read()
- # imgB64 = imgdata.encode("base64")
- # bytesarray = array.array('B', imgB64)
- # result['pair_scan_array'] = bytesarray
- # rendered_template = render_template("pair_scan_results.html", **result)
- # else:
- # rendered_template = render_template("marker_regression.html", **result)
- # rendered_template = render_template("marker_regression_gn1.html", **gn1_template_vars)
-
return rendered_template