From 60e8f77fdb5a493f23401c93582f9d037be813ea Mon Sep 17 00:00:00 2001
From: Josh Willis <joshua.willis@ligo.org>
Date: Fri, 25 Feb 2022 09:21:22 +0000
Subject: [PATCH] Add pool.join after pool.close in bilby.gw.conversion

---
 AUTHORS.md             | 1 +
 bilby/gw/conversion.py | 2 ++
 2 files changed, 3 insertions(+)

diff --git a/AUTHORS.md b/AUTHORS.md
index b95f3ff66..32f41f250 100644
--- a/AUTHORS.md
+++ b/AUTHORS.md
@@ -33,6 +33,7 @@ James A Clark
 Jeremy G Baier
 John Veitch
 Joshua Brandt
+Josh Willis
 Katerina Chatziioannou
 Kaylee de Soto
 Khun Sang Phukon
diff --git a/bilby/gw/conversion.py b/bilby/gw/conversion.py
index e1ea605c8..abef885cf 100644
--- a/bilby/gw/conversion.py
+++ b/bilby/gw/conversion.py
@@ -1167,6 +1167,7 @@ def compute_snrs(sample, likelihood, npool=1):
                 )
                 new_samples = pool.map(_compute_snrs, tqdm(fill_args, file=sys.stdout))
                 pool.close()
+                pool.join()
             else:
                 new_samples = [_compute_snrs(xx) for xx in tqdm(fill_args, file=sys.stdout)]
 
@@ -1307,6 +1308,7 @@ def generate_posterior_samples_from_marginalized_likelihood(
 
     if pool is not None:
         pool.close()
+        pool.join()
 
     new_samples = np.concatenate(
         [np.array(val) for key, val in cached_samples_dict.items() if key != "_samples"]
-- 
GitLab