From d0b01d0be72ff541e72373cd085a58c3af2b4fed Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Tue, 20 Sep 2022 22:56:55 +0300 Subject: Remove global `Dataset_Getter` variable Since the `__post_init__` method in the 'DatasetType' class checks whether data is in redis before hitting the database, it does not matter whether there is a global object of the type, as long as we make sure to call the object correctly. This commit makes that happen. --- wqflask/base/data_set/__init__.py | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'wqflask') diff --git a/wqflask/base/data_set/__init__.py b/wqflask/base/data_set/__init__.py index eaf80b19..6d475df2 100644 --- a/wqflask/base/data_set/__init__.py +++ b/wqflask/base/data_set/__init__.py @@ -31,18 +31,13 @@ DS_NAME_MAP = { "ProbeSet": "MrnaAssayDataSet" } -# Do the intensive work at startup one time only -# TODO: Pass in the Redis conniction from elsewhere to allow fo flexible -# configuration -Dataset_Getter = DatasetType(Redis()) - def create_dataset(dataset_name, dataset_type=None, - get_samplelist=True, group_name=None): + get_samplelist=True, group_name=None, redis_conn=Redis()): if dataset_name == "Temp": dataset_type = "Temp" if not dataset_type: - dataset_type = Dataset_Getter(dataset_name) + dataset_type = DatasetType(redis_conn)(dataset_name) dataset_ob = DS_NAME_MAP[dataset_type] dataset_class = globals()[dataset_ob] -- cgit v1.2.3