From 01ddb7300b451108983327ae11f69e265a2ec2e0 Mon Sep 17 00:00:00 2001 From: Alexander Kabui Date: Wed, 10 Nov 2021 11:38:35 +0300 Subject: fix:spawned processes memory issues --- gn3/computations/correlations.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'gn3') 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: -- cgit v1.2.3