From 5cd0e91c1de07b8932d0ff973660607605122bcc Mon Sep 17 00:00:00 2001 From: christian Date: Wed, 3 Aug 2016 16:27:57 +0200 Subject: Add settings & routing for serving Biodalliance --- etc/default_settings.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'etc') diff --git a/etc/default_settings.py b/etc/default_settings.py index df734f7c..f3ca2e58 100644 --- a/etc/default_settings.py +++ b/etc/default_settings.py @@ -56,3 +56,6 @@ GENENETWORK_FILES = HOME+"/gn2_data" PYLMM_COMMAND = str.strip(os.popen("which pylmm_redis").read()) PLINK_COMMAND = str.strip(os.popen("which plink2").read()) GEMMA_COMMAND = str.strip(os.popen("which gemma").read()) + + +BIODALLIANCE_PATH = os.environ['HOME']+"/dalliance" -- cgit v1.2.3 From 31752672213c56df3b3a70ce375151de62efab4d Mon Sep 17 00:00:00 2001 From: Pjotr Prins Date: Mon, 8 Aug 2016 11:10:02 +0000 Subject: BD: Using localhost --- etc/default_settings.py | 2 +- wqflask/wqflask/static/new/javascript/biodalliance.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'etc') diff --git a/etc/default_settings.py b/etc/default_settings.py index f3ca2e58..8081f603 100644 --- a/etc/default_settings.py +++ b/etc/default_settings.py @@ -58,4 +58,4 @@ PLINK_COMMAND = str.strip(os.popen("which plink2").read()) GEMMA_COMMAND = str.strip(os.popen("which gemma").read()) -BIODALLIANCE_PATH = os.environ['HOME']+"/dalliance" +BIODALLIANCE_PATH = os.environ['HOME']+"/dalliance/build" diff --git a/wqflask/wqflask/static/new/javascript/biodalliance.js b/wqflask/wqflask/static/new/javascript/biodalliance.js index 2dde6365..849c9f67 100644 --- a/wqflask/wqflask/static/new/javascript/biodalliance.js +++ b/wqflask/wqflask/static/new/javascript/biodalliance.js @@ -63,8 +63,8 @@ var openBDBrowser = function() { provides_entrypoints: true}, {name: 'QTL', tier_type: 'qtl', - uri: 'http://gsocbox:8880/static/qtl/lod2.csv', - stylesheet_uri: "http://gsocbox:8880/stylesheets/qtl-stylesheet.xml" + uri: 'http://localhost:8880/static/qtl/lod2.csv', + stylesheet_uri: "http://localhost:8880/stylesheets/qtl-stylesheet.xml" }] ); } else { -- cgit v1.2.3 From 22ccb2c516ba18dce08b06a9a3570d326dea05f8 Mon Sep 17 00:00:00 2001 From: Pjotr Prins Date: Mon, 8 Aug 2016 15:22:46 +0000 Subject: BD: reverted on build in path so CSS is seen again --- etc/default_settings.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'etc') diff --git a/etc/default_settings.py b/etc/default_settings.py index 8081f603..f3ca2e58 100644 --- a/etc/default_settings.py +++ b/etc/default_settings.py @@ -58,4 +58,4 @@ PLINK_COMMAND = str.strip(os.popen("which plink2").read()) GEMMA_COMMAND = str.strip(os.popen("which gemma").read()) -BIODALLIANCE_PATH = os.environ['HOME']+"/dalliance/build" +BIODALLIANCE_PATH = os.environ['HOME']+"/dalliance" -- cgit v1.2.3 From f71939a443b3fe07f1683f00ccd342b540016084 Mon Sep 17 00:00:00 2001 From: Pjotr Prins Date: Sun, 14 Aug 2016 07:55:35 +0000 Subject: Default settings --- etc/default_settings.py | 24 ++++++++++++++++++------ wqflask/wqflask/views.py | 2 +- 2 files changed, 19 insertions(+), 7 deletions(-) (limited to 'etc') diff --git a/etc/default_settings.py b/etc/default_settings.py index f3ca2e58..aa4e8d83 100644 --- a/etc/default_settings.py +++ b/etc/default_settings.py @@ -2,17 +2,19 @@ # webserver running in developer mode with limited console # output. Copy this file and run it from ./bin/genenetwork2 configfile # -# Note that these settings are fetched in ./wqflask/utilities/tools.py +# Note: these settings are fetched in ./wqflask/utilities/tools.py # which has support for overriding them through environment variables, # e.g. # # env LOG_SQL=True USE_REDIS=False ./bin/genenetwork2 # -# Note also that in the near future we will additionally fetch +# Note: in the near future we will additionally fetch # settings from a JSON file # -# Note that values for False and 0 have to be strings here - otherwise +# Note: values for False and 0 have to be strings here - otherwise # Flask won't pick them up +# +# Final note: see below information to pick up the GNU Guix paths import os import sys @@ -49,13 +51,23 @@ LOG_BENCH = True # Log bench marks USE_REDIS = True # REDIS caching (note that redis will be phased out) USE_GN_SERVER = 'False' # Use GN_SERVER SQL calls -# Path overrides for Genenetwork +# For GNU Guix deployment also check the paths in +# +# ~/.guix-profile/lib/python2.7/site-packages/genenetwork2-2.0-py2.7.egg/etc/default_settings.py + +# General paths for Genenetwork + HOME=os.environ['HOME'] LOGFILE = HOME+"/genenetwork2.log" GENENETWORK_FILES = HOME+"/gn2_data" + +# Paths to JS libraries + +BIODALLIANCE_JS = os.environ['HOME']+"/genenetwork/biodalliance" + +# Paths to invoked binaries + PYLMM_COMMAND = str.strip(os.popen("which pylmm_redis").read()) PLINK_COMMAND = str.strip(os.popen("which plink2").read()) GEMMA_COMMAND = str.strip(os.popen("which gemma").read()) - -BIODALLIANCE_PATH = os.environ['HOME']+"/dalliance" diff --git a/wqflask/wqflask/views.py b/wqflask/wqflask/views.py index 0a2fa83a..5cc22cc4 100644 --- a/wqflask/wqflask/views.py +++ b/wqflask/wqflask/views.py @@ -110,7 +110,7 @@ def tmp_page(img_path): @app.route("/dalliance/") def bd_files(filename): - bd_path = app.config['BIODALLIANCE_PATH'] + bd_path = app.config['BIODALLIANCE_JS'] return send_from_directory(bd_path, filename) -- cgit v1.2.3 From 88fa71d35fe261470bcfcb184aea14c5fb5b7c5e Mon Sep 17 00:00:00 2001 From: Pjotr Prins Date: Wed, 12 Oct 2016 10:51:40 +0000 Subject: API: GN_SERVER_URL and test --- etc/default_settings.py | 6 +++--- wqflask/runserver.py | 11 +++++++++-- wqflask/utility/logger.py | 2 +- wqflask/wqflask/templates/marker_regression_gn1.html | 10 +++++----- wqflask/wqflask/views.py | 1 + 5 files changed, 19 insertions(+), 11 deletions(-) (limited to 'etc') diff --git a/etc/default_settings.py b/etc/default_settings.py index ac5dc266..08eae024 100644 --- a/etc/default_settings.py +++ b/etc/default_settings.py @@ -26,7 +26,7 @@ GN_VERSION = open("../VERSION","r").read() SQL_URI = "mysql://gn2:mysql_password@localhost/db_webqtl_s" SQLALCHEMY_DATABASE_URI = 'mysql://gn2:mysql_password@localhost/db_webqtl_s' SQLALCHEMY_POOL_RECYCLE = 3600 -GN_SERVER_URL = "http://localhost:8880/" +GN_SERVER_URL = "http://test-gn2.genenetwork.org/" # ---- Flask configuration (see website) TRAP_BAD_REQUEST_ERRORS = True @@ -37,7 +37,7 @@ SECURITY_RECOVERABLE = True SECURITY_EMAIL_SENDER = "no-reply@genenetwork.org" SECURITY_POST_LOGIN_VIEW = "/thank_you" -SERVER_PORT = 5003 +SERVER_PORT = 5003 # running on localhost SECRET_HMAC_CODE = '\x08\xdf\xfa\x93N\x80\xd9\\H@\\\x9f`\x98d^\xb4a;\xc6OM\x946a\xbc\xfc\x80:*\xebc' # ---- Behavioural settings (defaults) note that logger and log levels can @@ -45,6 +45,7 @@ SECRET_HMAC_CODE = '\x08\xdf\xfa\x93N\x80\xd9\\H@\\\x9f`\x98d^\xb4a;\xc6OM\x946a WEBSERVER_MODE = 'DEV' # Python webserver mode (DEBUG|DEV|PROD) WEBSERVER_BRANDING = None # Set the branding (nyi) WEBSERVER_DEPLOY = None # Deployment specifics (nyi) +WEBSERVER_URL = "http://localhost:"+str(SERVER_PORT)+"/" # external URL LOG_LEVEL = 'WARNING' # Logger mode (DEBUG|INFO|WARNING|ERROR|CRITICAL) LOG_LEVEL_DEBUG = '0' # logger.debugf log level (0-5, 5 = show all) @@ -72,4 +73,3 @@ LOCAL_PRIVATE_FILES = HOME+"/gn2_private_data" # private static data files PYLMM_COMMAND = str.strip(os.popen("which pylmm_redis").read()) PLINK_COMMAND = str.strip(os.popen("which plink2").read()) GEMMA_COMMAND = str.strip(os.popen("which gemma").read()) - 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/wqflask/templates/marker_regression_gn1.html b/wqflask/wqflask/templates/marker_regression_gn1.html index a39da73a..7aceabee 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, @@ -465,7 +465,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: { @@ -480,7 +480,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..8d5eadb6 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)) -- cgit v1.2.3