aboutsummaryrefslogtreecommitdiff
path: root/gn3
diff options
context:
space:
mode:
authorAlexander Kabui2021-11-10 11:38:35 +0300
committerBonfaceKilz2021-11-11 09:20:26 +0300
commit01ddb7300b451108983327ae11f69e265a2ec2e0 (patch)
treeefc91a923b60bd46887a6bfd76a7b5ba8cdccb8e /gn3
parent905626a2a27332f2fab74195bbcf615bf5c5b6bf (diff)
downloadgenenetwork3-01ddb7300b451108983327ae11f69e265a2ec2e0.tar.gz
fix:spawned processes memory issues
Diffstat (limited to 'gn3')
-rw-r--r--gn3/computations/correlations.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/gn3/computations/correlations.py b/gn3/computations/correlations.py
index 8eaa523..8302afc 100644
--- a/gn3/computations/correlations.py
+++ b/gn3/computations/correlations.py
@@ -1,6 +1,7 @@
"""module contains code for correlations"""
import math
import multiprocessing
+from contextlib import closing
from typing import List
from typing import Tuple
@@ -136,7 +137,7 @@ def fast_compute_all_sample_correlation(this_trait,
processed_values.append((trait_name, corr_method, *list(zip(*list(filter_shared_sample_keys(
this_trait_samples, target_trait_data))))
))
- with multiprocessing.Pool() as pool:
+ with closing(multiprocessing.Pool()) as pool:
results = pool.starmap(compute_sample_r_correlation, processed_values)
for sample_correlation in results: