From f1056b9f4128fb91fbaf738914395697aa485b2e Mon Sep 17 00:00:00 2001 From: Pjotr Prins Date: Wed, 18 Mar 2015 12:09:21 +0300 Subject: Warning to stderr --- wqflask/wqflask/my_pylmm/pyLMM/lmm.py | 6 ++++-- wqflask/wqflask/my_pylmm/pyLMM/standalone.py | 5 +++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/wqflask/wqflask/my_pylmm/pyLMM/lmm.py b/wqflask/wqflask/my_pylmm/pyLMM/lmm.py index 66c952aa..95272818 100644 --- a/wqflask/wqflask/my_pylmm/pyLMM/lmm.py +++ b/wqflask/wqflask/my_pylmm/pyLMM/lmm.py @@ -57,10 +57,11 @@ import gwas # ---- A trick to decide on the environment: try: from wqflask.my_pylmm.pyLMM import chunks - from gn2 import uses + from gn2 import uses, set_progress_storage except ImportError: has_gn2=False - from standalone import uses + import standalone as handlers + from standalone import uses, set_progress_storage sys.stderr.write("WARNING: LMM standalone version missing the Genenetwork2 environment\n") pass @@ -816,6 +817,7 @@ def gn2_redis(key,species,new_code=True): params = json.loads(json_params) tempdata = temp_data.TempData(params['temp_uuid']) + set_progress_storage(tempdata) print('kinship', np.array(params['kinship_matrix'])) print('pheno', np.array(params['pheno_vector'])) diff --git a/wqflask/wqflask/my_pylmm/pyLMM/standalone.py b/wqflask/wqflask/my_pylmm/pyLMM/standalone.py index 538007f1..e20d4092 100644 --- a/wqflask/wqflask/my_pylmm/pyLMM/standalone.py +++ b/wqflask/wqflask/my_pylmm/pyLMM/standalone.py @@ -17,7 +17,12 @@ logger = logging.getLogger('lmm2') logging.basicConfig(level=logging.DEBUG) np.set_printoptions(precision=3,suppress=True) +def set_progress_storage(location): + global storage + storage = location + def progress(location, count, total): + storage['percentage'] = round(count*100.0)/total) logger.info("Progress: %s %d%%" % (location,round(count*100.0/total))) def mprint(msg,data): -- cgit v1.2.3