aboutsummaryrefslogtreecommitdiff
path: root/wqflask/utility
diff options
context:
space:
mode:
authorZachary Sloan2013-03-07 00:34:51 +0000
committerZachary Sloan2013-03-07 00:34:51 +0000
commit855a586f82fd1774358d8cfde28ce067f1c6c2ae (patch)
treed51c2771ab266e2660327fad89850f45d508016c /wqflask/utility
parent4bce386b619c55e66d6cdd81b11b54baadc5ae87 (diff)
downloadgenenetwork2-855a586f82fd1774358d8cfde28ce067f1c6c2ae.tar.gz
Created file temp_data to store data related to progress
of the marker regression calculations Storing progress of kinship matrix calculation in variable as portion of 45 (the rough percent of total marker regression calculation time
Diffstat (limited to 'wqflask/utility')
-rw-r--r--wqflask/utility/helper_functions.py1
-rw-r--r--wqflask/utility/temp_data.py27
2 files changed, 28 insertions, 0 deletions
diff --git a/wqflask/utility/helper_functions.py b/wqflask/utility/helper_functions.py
index d2567b63..56b409e6 100644
--- a/wqflask/utility/helper_functions.py
+++ b/wqflask/utility/helper_functions.py
@@ -4,6 +4,7 @@ from base.trait import GeneralTrait
from base import data_set
from base.species import TheSpecies
+
def get_species_dataset_trait(self, start_vars):
#assert type(read_genotype) == type(bool()), "Expecting boolean value for read_genotype"
self.dataset = data_set.create_dataset(start_vars['dataset'])
diff --git a/wqflask/utility/temp_data.py b/wqflask/utility/temp_data.py
new file mode 100644
index 00000000..192dcc44
--- /dev/null
+++ b/wqflask/utility/temp_data.py
@@ -0,0 +1,27 @@
+from __future__ import print_function, division, absolute_import
+from redis import Redis
+
+import simplejson as json
+
+class TempData(object):
+
+ def __init__(self, temp_uuid):
+ self.temp_uuid = temp_uuid
+ self.redis = Redis()
+ self.key = "tempdata:{}".format(self.temp_uuid)
+
+ def store(self, field, value):
+ print("Storing...")
+ self.redis.hset(self.key, field, value)
+ self.redis.expire(self.key, 60*15) # Expire in 15 minutes
+
+ def get_all(self):
+ return self.redis.hgetall(self.key)
+
+
+
+if __name__ == "__main__":
+ redis = Redis()
+ for key in redis.keys():
+ for field in redis.hkeys(key):
+ print("{}.{}={}".format(key, field, redis.hget(key, field)))