about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPjotr Prins2015-03-18 12:09:21 +0300
committerPjotr Prins2015-03-18 12:09:21 +0300
commitf1056b9f4128fb91fbaf738914395697aa485b2e (patch)
treeae4353757dd4ace7f08b9a6ec3af411a37a18bb6
parent204805157912aebb92967241850453f07729e2f6 (diff)
downloadgenenetwork2-f1056b9f4128fb91fbaf738914395697aa485b2e.tar.gz
Warning to stderr
-rw-r--r--wqflask/wqflask/my_pylmm/pyLMM/lmm.py6
-rw-r--r--wqflask/wqflask/my_pylmm/pyLMM/standalone.py5
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):