From 452b2d0976c5daea2906e9caa78f2f584f3dcadc Mon Sep 17 00:00:00 2001
From: David Hendriks <davidhendriks93@gmail.com>
Date: Tue, 1 Jun 2021 16:43:39 +0100
Subject: [PATCH] Updated the settings. Now we can set our own max queuue size

---
 binarycpython/utils/grid.py                  | 4 +---
 binarycpython/utils/grid_options_defaults.py | 2 ++
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/binarycpython/utils/grid.py b/binarycpython/utils/grid.py
index fa64c62bb..003503d1a 100644
--- a/binarycpython/utils/grid.py
+++ b/binarycpython/utils/grid.py
@@ -927,10 +927,8 @@ class Population:
         # Set up the manager object that can share info between processes
 
         # pathos_multiprocess
-        queue_size = 1000
-
         manager = multiprocessing.Manager()
-        job_queue = manager.Queue(maxsize=queue_size)
+        job_queue = manager.Queue(maxsize=self.grid_options['max_queue_size'])
         result_queue = manager.Queue(maxsize=self.grid_options["amt_cores"])
 
         # Create process instances
diff --git a/binarycpython/utils/grid_options_defaults.py b/binarycpython/utils/grid_options_defaults.py
index 46a097358..98bf8b72e 100644
--- a/binarycpython/utils/grid_options_defaults.py
+++ b/binarycpython/utils/grid_options_defaults.py
@@ -34,6 +34,7 @@ grid_options_defaults_dict = {
     "_commandline_input": "",
     "log_runtime_systems": 0,  # whether to log the runtime of the systems (1 file per thread. stored in the tmp_dir)
     "_actually_evolve_system": True,  # Whether to actually evolve the systems of just act as if. for testing. used in _process_run_population_grid
+    "max_queue_size": 1000, # Maximum size of the system call queue. Can't be too big!
     ##########################
     # Execution log:
     ##########################
@@ -471,6 +472,7 @@ grid_options_descriptions = {
     "_total_mass_run": "To count the total mass that thread/process has ran",
     "_total_probability_weighted_mass_run": "To count the total mass * probability for each system that thread/process has ran",
     "_actually_evolve_system": "Whether to actually evolve the systems of just act as if. for testing. used in _process_run_population_grid",
+    "max_queue_size": "Maximum size of the queue that is used to feed the processes. Don't make this too big! Default: 1000. Input: int"
 }
 
 ###
-- 
GitLab