Loading binarycpython/utils/population_class.py +18 −10 Original line number Diff line number Diff line Loading @@ -156,11 +156,19 @@ class Population( failing_systems_functions.__init__(self) sampling_variables.__init__(self) ############## # caches self.caches = {} self.cached_function_cache = {} self.original_function_cache = {} # Unsorted self.hostnameslist = hostnames() self.preloaded_population = None self.signal_count = {} ############## # binary_c arguments # TODO: put in parameter handling or something # Different sections of options Loading @@ -172,16 +180,16 @@ class Population( self.special_params = [ el for el in list(self.defaults.keys()) if el.endswith("%d") ] self.preloaded_population = None self.signal_count = {} # make the input dictionary self.bse_options = {} # bse_options is just empty. # Grid options self.population_options = copy.deepcopy( self.get_population_options_defaults_dict() ) ############### # Handle populations options initialisation # validation schema self.set_validation_schema() # load default values self.set_default_population_options() # Custom options # TODO: is this really necessary here? The custom options should be empty on start i think Loading @@ -189,7 +197,7 @@ class Population( "save_snapshot": False, } # grid code generation # grid code sampling generation self.indent_depth = 0 self.indent_string = " " self.code_string = "" Loading Loading @@ -324,7 +332,7 @@ class Population( mem = 1.0 * mem_use() for x in ["", "max_"]: self.shared_memory[x + "memory_use_per_thread"] = multiprocessing.Array( "d", [mem] * self.population_options["num_processes"] "d", [mem] * self.population_options["_num_processes"] ) ############################################################ Loading binarycpython/utils/population_extensions/analytics.py +1 −1 Original line number Diff line number Diff line Loading @@ -112,7 +112,7 @@ class analytics: """ dt = self.population_options["_time_elapsed"] ncpus = self.population_options.get("num_processes", 1) ncpus = self.population_options.get("_num_processes", 1) # print("CPU time : dt={} n={} -> {}".format(dt, ncpus, dt * ncpus)) Loading binarycpython/utils/population_extensions/argument_handling.py +18 −0 Original line number Diff line number Diff line Loading @@ -56,11 +56,13 @@ class argument_handling: via kwargs all the arguments are either set to binary_c parameters, population_options or custom_options (see above) """ ############### # Go over all the input for key, value in kwargs.items(): # match to hostname if appropriate value = self._match_arg_to_host(arg={key: value}) ############### # Filter out keys for the bse_options if key in self.defaults: self.verbose_print( Loading @@ -70,6 +72,7 @@ class argument_handling: ) self.bse_options[key] = value ############### # Extra check to check if the key fits one of parameter names that end with %d elif self._check_key_is_special_param(key): self.verbose_print( Loading @@ -81,6 +84,7 @@ class argument_handling: ) self.bse_options[key] = value ############### # Filter out keys for the population_options elif key in self.population_options.keys(): self.verbose_print( Loading @@ -88,8 +92,14 @@ class argument_handling: self.population_options["verbosity"], 1, ) # validate values self._validate_population_options(key, value) # Set values self.population_options[key] = value ############### # The of the keys go into a custom_options dict else: self.verbose_print( Loading @@ -102,6 +112,14 @@ class argument_handling: ) self.custom_options[key] = value def _validate_population_options(self, key, value): """ Function to handle validation of the arguments passed to the population options """ # validate self.validation_schema({key: value}) def parse_cmdline(self) -> None: """ Function to handle settings values via the command line in the form x=y, w=z, etc. Loading binarycpython/utils/population_extensions/cache.py +13 −0 Original line number Diff line number Diff line Loading @@ -31,6 +31,19 @@ class cache: return # def default_cache_dir(self): # """ # Return a default cache directory path, or None if we cannot find one. # """ # error_string = "__*ERR*__" # string that cannot be a path # for path in [ # os.path.join(os.environ.get("HOME", error_string), ".cache", "binary_c"), # os.path.join(os.environ.get("TMP", error_string), "cache"), # ]: # if error_string not in path and os.path.isdir(path): # return path # return None def default_cache_dir(self): """ Return a default cache directory path for binary_c-python, or None if we cannot find one. This is used in population_options_defaults.py Loading binarycpython/utils/population_extensions/condor.py +2 −2 Original line number Diff line number Diff line Loading @@ -305,7 +305,7 @@ class condor: "condor_njobs=" + str(self.population_options["condor_njobs"]), "condor_dir=" + self.population_options["condor_dir"], "verbosity=" + str(self.population_options["verbosity"]), "num_cores=" + str(self.population_options["num_processes"]), "num_cores=" + str(self.population_options["_num_processes"]), ] ) Loading Loading @@ -440,7 +440,7 @@ queue {njobs} stream_output=self.population_options["condor_stream_output"], stream_error=self.population_options["condor_stream_error"], request_memory=self.population_options["condor_memory"], request_cpus=self.population_options["num_processes"], request_cpus=self.population_options["_num_processes"], should_transfer_files=self.population_options[ "condor_should_transfer_files" ], Loading Loading
binarycpython/utils/population_class.py +18 −10 Original line number Diff line number Diff line Loading @@ -156,11 +156,19 @@ class Population( failing_systems_functions.__init__(self) sampling_variables.__init__(self) ############## # caches self.caches = {} self.cached_function_cache = {} self.original_function_cache = {} # Unsorted self.hostnameslist = hostnames() self.preloaded_population = None self.signal_count = {} ############## # binary_c arguments # TODO: put in parameter handling or something # Different sections of options Loading @@ -172,16 +180,16 @@ class Population( self.special_params = [ el for el in list(self.defaults.keys()) if el.endswith("%d") ] self.preloaded_population = None self.signal_count = {} # make the input dictionary self.bse_options = {} # bse_options is just empty. # Grid options self.population_options = copy.deepcopy( self.get_population_options_defaults_dict() ) ############### # Handle populations options initialisation # validation schema self.set_validation_schema() # load default values self.set_default_population_options() # Custom options # TODO: is this really necessary here? The custom options should be empty on start i think Loading @@ -189,7 +197,7 @@ class Population( "save_snapshot": False, } # grid code generation # grid code sampling generation self.indent_depth = 0 self.indent_string = " " self.code_string = "" Loading Loading @@ -324,7 +332,7 @@ class Population( mem = 1.0 * mem_use() for x in ["", "max_"]: self.shared_memory[x + "memory_use_per_thread"] = multiprocessing.Array( "d", [mem] * self.population_options["num_processes"] "d", [mem] * self.population_options["_num_processes"] ) ############################################################ Loading
binarycpython/utils/population_extensions/analytics.py +1 −1 Original line number Diff line number Diff line Loading @@ -112,7 +112,7 @@ class analytics: """ dt = self.population_options["_time_elapsed"] ncpus = self.population_options.get("num_processes", 1) ncpus = self.population_options.get("_num_processes", 1) # print("CPU time : dt={} n={} -> {}".format(dt, ncpus, dt * ncpus)) Loading
binarycpython/utils/population_extensions/argument_handling.py +18 −0 Original line number Diff line number Diff line Loading @@ -56,11 +56,13 @@ class argument_handling: via kwargs all the arguments are either set to binary_c parameters, population_options or custom_options (see above) """ ############### # Go over all the input for key, value in kwargs.items(): # match to hostname if appropriate value = self._match_arg_to_host(arg={key: value}) ############### # Filter out keys for the bse_options if key in self.defaults: self.verbose_print( Loading @@ -70,6 +72,7 @@ class argument_handling: ) self.bse_options[key] = value ############### # Extra check to check if the key fits one of parameter names that end with %d elif self._check_key_is_special_param(key): self.verbose_print( Loading @@ -81,6 +84,7 @@ class argument_handling: ) self.bse_options[key] = value ############### # Filter out keys for the population_options elif key in self.population_options.keys(): self.verbose_print( Loading @@ -88,8 +92,14 @@ class argument_handling: self.population_options["verbosity"], 1, ) # validate values self._validate_population_options(key, value) # Set values self.population_options[key] = value ############### # The of the keys go into a custom_options dict else: self.verbose_print( Loading @@ -102,6 +112,14 @@ class argument_handling: ) self.custom_options[key] = value def _validate_population_options(self, key, value): """ Function to handle validation of the arguments passed to the population options """ # validate self.validation_schema({key: value}) def parse_cmdline(self) -> None: """ Function to handle settings values via the command line in the form x=y, w=z, etc. Loading
binarycpython/utils/population_extensions/cache.py +13 −0 Original line number Diff line number Diff line Loading @@ -31,6 +31,19 @@ class cache: return # def default_cache_dir(self): # """ # Return a default cache directory path, or None if we cannot find one. # """ # error_string = "__*ERR*__" # string that cannot be a path # for path in [ # os.path.join(os.environ.get("HOME", error_string), ".cache", "binary_c"), # os.path.join(os.environ.get("TMP", error_string), "cache"), # ]: # if error_string not in path and os.path.isdir(path): # return path # return None def default_cache_dir(self): """ Return a default cache directory path for binary_c-python, or None if we cannot find one. This is used in population_options_defaults.py Loading
binarycpython/utils/population_extensions/condor.py +2 −2 Original line number Diff line number Diff line Loading @@ -305,7 +305,7 @@ class condor: "condor_njobs=" + str(self.population_options["condor_njobs"]), "condor_dir=" + self.population_options["condor_dir"], "verbosity=" + str(self.population_options["verbosity"]), "num_cores=" + str(self.population_options["num_processes"]), "num_cores=" + str(self.population_options["_num_processes"]), ] ) Loading Loading @@ -440,7 +440,7 @@ queue {njobs} stream_output=self.population_options["condor_stream_output"], stream_error=self.population_options["condor_stream_error"], request_memory=self.population_options["condor_memory"], request_cpus=self.population_options["num_processes"], request_cpus=self.population_options["_num_processes"], should_transfer_files=self.population_options[ "condor_should_transfer_files" ], Loading