diff --git a/binarycpython/utils/grid.py b/binarycpython/utils/grid.py index 2a71994db582a5c2ae9ef4df508a429f611b5e24..483dc15fd8e6a592fd46e487972b578adc6ca9fa 100644 --- a/binarycpython/utils/grid.py +++ b/binarycpython/utils/grid.py @@ -956,9 +956,10 @@ class Population: end_runtime_binary_c = time.time() # Debug line: logging all the lines - with open(os.path.join(self.grid_options["tmp_dir"], "thread_{}_runtime_systems.txt".format(self.process_ID)), 'a+') as f: - binary_cmdline_string = self._return_argline(full_system_dict) - f.write("{} {}\n".format(end_runtime_binary_c-start_runtime_binary_c, binary_cmdline_string)) + if self.grid_options['log_runtime_systems']==1: + with open(os.path.join(self.grid_options["tmp_dir"], "thread_{}_runtime_systems.txt".format(self.process_ID)), 'a+') as f: + binary_cmdline_string = self._return_argline(full_system_dict) + f.write("{} {}\n".format(end_runtime_binary_c-start_runtime_binary_c, binary_cmdline_string)) # Keep track of systems: probability_of_systems_run += full_system_dict["probability"] diff --git a/binarycpython/utils/grid_options_defaults.py b/binarycpython/utils/grid_options_defaults.py index e6c20526f2caa3bf5e92018b10faee4bb00b9a28..059977117b19d0d69f4f1b2780a0c5d452e7128b 100644 --- a/binarycpython/utils/grid_options_defaults.py +++ b/binarycpython/utils/grid_options_defaults.py @@ -30,6 +30,7 @@ grid_options_defaults_dict = { "combine_ensemble_with_thread_joining": True, # Flag on whether to combine everything and return it to the user or if false: write it to data_dir/ensemble_output_{popuation_id}_{thread_id}.json # "output_dir": "_commandline_input": "", + "log_runtime_systems": 0, # whether to log the runtime of the systems (1 file per thread. stored in the tmp_dir) ########################## # Execution log: ########################## @@ -465,6 +466,7 @@ grid_options_descriptions = { "evolution_type": "Variable containing the type of evolution used of the grid. Multiprocessing or linear processing", "combine_ensemble_with_thread_joining": "BOolean flag on whether to combine everything and return it to the user or if false: write it to data_dir/ensemble_output_{popuation_id}_{thread_id}.json", "ensemble_results": "Dictinary that stores the ensemble results if combine_ensemble_with_thread_joining==True", + "log_runtime_systems": "Whether to log the runtime of the systems . Each systems run by the thread is logged to a file and is stored in the tmp_dir. (1 file per thread). Don't use this if you are planning to run alot of systems. This is mostly for debugging and finding systems that take long to run. Integer, default = 0. if value is 1 then the systems are logged", } #################################