From 0380d57b4138625e53caf3de79df73e633c7415c Mon Sep 17 00:00:00 2001
From: David Hammer <dhammer@mailbox.org>
Date: Wed, 21 Apr 2021 16:14:54 +0200
Subject: [PATCH] Lower number of processes based on actual files present

---
 notebooks/AGIPD/Characterize_AGIPD_Gain_Darks_NBC.ipynb | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/notebooks/AGIPD/Characterize_AGIPD_Gain_Darks_NBC.ipynb b/notebooks/AGIPD/Characterize_AGIPD_Gain_Darks_NBC.ipynb
index ab8941188..8c35cb47b 100644
--- a/notebooks/AGIPD/Characterize_AGIPD_Gain_Darks_NBC.ipynb
+++ b/notebooks/AGIPD/Characterize_AGIPD_Gain_Darks_NBC.ipynb
@@ -340,8 +340,9 @@
    "metadata": {},
    "outputs": [],
    "source": [
-    "parallel_num_procs = 6\n",
+    "parallel_num_procs = min(6, total_sequences)\n",
     "parallel_num_threads = multiprocessing.cpu_count() // parallel_num_procs\n",
+    "print(f\"Running with {parallel_num_procs} processes spawning {parallel_num_threads} threads each\")\n",
     "\n",
     "def characterize_module(\n",
     "    fast_data_filename: str, channel: int, gain_index: int\n",
-- 
GitLab