def get_samplelist(self): result = None key = "samplelist:v2:" + self.name if USE_REDIS: result = Redis.get(key) if result is not None: #logger.debug("Sample List Cache hit!!!") #logger.debug("Before unjsonifying {}: {}".format(type(result), result)) self.samplelist = json.loads(result) #logger.debug(" type: ", type(self.samplelist)) #logger.debug(" self.samplelist: ", self.samplelist) else: logger.debug("Cache not hit") genotype_fn = locate_ignore_error(self.name+".geno",'genotype') mapping_fn = locate_ignore_error(self.name+".fam",'mapping') if mapping_fn: self.samplelist = get_group_samplelists.get_samplelist("plink", mapping_fn) elif genotype_fn: self.samplelist = get_group_samplelists.get_samplelist("geno", genotype_fn) else: self.samplelist = None logger.debug("Sample list: ",self.samplelist) if USE_REDIS: Redis.set(key, json.dumps(self.samplelist)) Redis.expire(key, 60*5)
def get_samplelist(self): key = "samplelist:v2:" + self.name print("key is:", key) with Bench("Loading cache"): result = Redis.get(key) if result: print("Sample List Cache hit!!!") print("Before unjsonifying {}: {}".format(type(result), result)) self.samplelist = json.loads(result) print(" type: ", type(self.samplelist)) print(" self.samplelist: ", self.samplelist) else: print("Cache not hit for", self.name) genotype_fn = locate_ignore_error(self.name+".geno",'genotype') mapping_fn = locate_ignore_error(self.name+".fam",'mapping') if mapping_fn: self.samplelist = get_group_samplelists.get_samplelist("plink", mapping_fn) elif genotype_fn: self.samplelist = get_group_samplelists.get_samplelist("geno", genotype_fn) else: self.samplelist = None print("Sample list: ",self.samplelist) Redis.set(key, json.dumps(self.samplelist)) Redis.expire(key, 60*5)
def get_samplelist(self): result = None key = "samplelist:v3:" + self.name if USE_REDIS: result = Redis.get(key) if result is not None: self.samplelist = json.loads(result) else: logger.debug("Cache not hit") genotype_fn = locate_ignore_error(self.name + ".geno", 'genotype') if genotype_fn: self.samplelist = get_group_samplelists.get_samplelist( "geno", genotype_fn) else: self.samplelist = None if USE_REDIS: Redis.set(key, json.dumps(self.samplelist)) Redis.expire(key, 60 * 5)
def get_samplelist(self): key = "samplelist:v4:" + self.name print("key is:", key) with Bench("Loading cache"): result = Redis.get(key) if result: print("Sample List Cache hit!!!") print("Before unjsonifying {}: {}".format(type(result), result)) self.samplelist = json.loads(result) print(" type: ", type(self.samplelist)) print(" self.samplelist: ", self.samplelist) else: print("Cache not hit") try: self.samplelist = get_group_samplelists.get_samplelist(self.name + ".geno") except IOError: self.samplelist = None print("after get_samplelist") Redis.set(key, json.dumps(self.samplelist)) Redis.expire(key, 60*5)