From f965cc7fc6088ce714e3ed602c0816063dd6bc5c Mon Sep 17 00:00:00 2001 From: Alexander_Kabui Date: Mon, 15 May 2023 23:33:11 +0300 Subject: write files to TMPDIR --- wqflask/wqflask/correlation/pre_computes.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/wqflask/wqflask/correlation/pre_computes.py b/wqflask/wqflask/correlation/pre_computes.py index c995b471..dca608b8 100644 --- a/wqflask/wqflask/correlation/pre_computes.py +++ b/wqflask/wqflask/correlation/pre_computes.py @@ -17,9 +17,11 @@ from utility.tools import SQL_URI from json.decoder import JSONDecodeError + + def to_generate_datasets(dataset_name, dataset_type, gen_type, species="mouse"): try: - with lmdb.open(os.path.join("/tmp", "todolist_generate"), map_size=20971520) as env: + with lmdb.open(os.path.join(TMPDIR, "todolist_generate"), map_size=20971520) as env: with env.begin(write=True) as txn: data = txn.get(f"{gen_type}:{dataset_type}".encode()) if data: @@ -51,7 +53,7 @@ def cache_trait_metadata(dataset_name, data): def read_trait_metadata(dataset_name, dataset_type): try: - with lmdb.open(os.path.join("/tmp/", f"metadata_{dataset_type}"), readonly=True, lock=False) as env: + with lmdb.open(os.path.join(TMPDIR, f"metadata_{dataset_type}"), readonly=True, lock=False) as env: with env.begin() as txn: metadata = txn.get(dataset_name.encode()) return (pickle.loads(metadata)["data"] if metadata else {}) -- cgit v1.2.3