aboutsummaryrefslogtreecommitdiff
path: root/wqflask/base/data_set.py
diff options
context:
space:
mode:
authorZachary Sloan2013-06-27 23:03:14 +0000
committerZachary Sloan2013-06-27 23:03:14 +0000
commit62bd1bb6ad9f9f1c991127387154b5e0ca271fae (patch)
tree1f458ff27728111487887f564d907c0708e3055c /wqflask/base/data_set.py
parente712f665d8d1000d87a7c1aafce776062ff75cf1 (diff)
downloadgenenetwork2-62bd1bb6ad9f9f1c991127387154b5e0ca271fae.tar.gz
Created a group manager page where user administrators can create
groups of datasets to give/add read privileges to
Diffstat (limited to 'wqflask/base/data_set.py')
-rwxr-xr-xwqflask/base/data_set.py50
1 files changed, 28 insertions, 22 deletions
diff --git a/wqflask/base/data_set.py b/wqflask/base/data_set.py
index 803cbc4f..03b24230 100755
--- a/wqflask/base/data_set.py
+++ b/wqflask/base/data_set.py
@@ -77,14 +77,31 @@ def create_dataset(dataset_name, dataset_type = None):
def create_datasets_list():
key = "all_datasets"
result = Redis.get(key)
+
if result:
print("Cache hit!!!")
- result = pickle.loads(result)
+ datasets = pickle.loads(result)
+
else:
+ datasets = list()
with Bench("Creating DataSets object"):
- ds = DataSets()
- Redis.set(key, pickle.dumps(result))
- Redis.expire(key, 2*60)
+ type_dict = {'Publish': 'PublishFreeze',
+ 'ProbeSet': 'ProbeSetFreeze',
+ 'Geno': 'GenoFreeze'}
+
+ for dataset_type in type_dict:
+ query = "SELECT Name FROM {}".format(type_dict[dataset_type])
+ for result in g.db.execute(query).fetchall():
+ #The query at the beginning of this function isn't necessary here, but still would
+ #rather just reuse it
+ print("type: {}\tname: {}".format(dataset_type, result.Name))
+ dataset = create_dataset(result.Name, dataset_type)
+ datasets.append(dataset)
+
+ Redis.set(key, pickle.dumps(datasets, pickle.HIGHEST_PROTOCOL))
+ Redis.expire(key, 60*60)
+
+ return datasets
def create_in_clause(items):
@@ -240,24 +257,13 @@ class DatasetGroup(object):
self.samplelist = list(genotype.prgy)
-class DataSets(object):
- """Builds a list of DataSets"""
-
- def __init__(self):
- self.datasets = list()
-
- type_dict = {'Publish': 'PublishFreeze',
- 'ProbeSet': 'ProbeSetFreeze',
- 'Geno': 'GenoFreeze'}
-
- for dataset_type in type_dict:
- query = "SELECT Name FROM {}".format(type_dict[dataset_type])
- for result in g.db.execute(query).fetchall():
- #The query at the beginning of this function isn't necessary here, but still would
- #rather just reuse it
- print("type: {}\tname: {}".format(dataset_type, result.Name))
- create_dataset(result.Name, dataset_type)
-
+#class DataSets(object):
+# """Builds a list of DataSets"""
+#
+# def __init__(self):
+# self.datasets = list()
+#
+
#query = """SELECT Name FROM ProbeSetFreeze
# UNION