aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander_Kabui2023-05-15 23:33:11 +0300
committerAlexander_Kabui2023-05-15 23:33:11 +0300
commitf965cc7fc6088ce714e3ed602c0816063dd6bc5c (patch)
tree90eef9529e038749ccad6414486d4ecf63509aa5
parentccc1ade74c5ec52e9b122d6d12bc2e652809f8bf (diff)
downloadgenenetwork2-chores/lmdb-integration.tar.gz
write files to TMPDIRchores/lmdb-integration
-rw-r--r--wqflask/wqflask/correlation/pre_computes.py6
1 files 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 {})