From ff8a5333ff06379bb334c9b19edd714d4b83d104 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20Gonz=C3=A1lez=20Duque?= Date: Fri, 9 Aug 2024 15:45:07 +0200 Subject: [PATCH] Always registers and creates env --- src/poli/core/util/isolation/instancing.py | 44 ++++++++++------------ 1 file changed, 19 insertions(+), 25 deletions(-) diff --git a/src/poli/core/util/isolation/instancing.py b/src/poli/core/util/isolation/instancing.py index cde12103..c37d1a59 100644 --- a/src/poli/core/util/isolation/instancing.py +++ b/src/poli/core/util/isolation/instancing.py @@ -211,31 +211,25 @@ def register_isolated_function(name: str, quiet: bool = False): If True, we squelch the messages giving feedback about the creation process. By default, it is False. """ - config = load_config() - if name not in config: - # Register problem - - # Two cases: - # (i) some of the isolated functions are not alongside - # their black boxes and problem factories, but are rather inside - # the core of poli. For now, the only case is tdc, but more may - # come in the future. - # - # (ii) the isolated function is in the repository, living alongside - # the black box and the problem factory. - if name == "tdc__isolated": - logging.debug( - "poli 🧪: Registered the isolated function from the repository." - ) - __register_isolated_function_from_core(name, quiet=quiet) - config = load_config() - else: - logging.debug( - "poli 🧪: Registered the isolated function from the repository." - ) - __register_isolated_function_from_repository(name, quiet=quiet) - # Refresh the config - config = load_config() + # Register problem + # Two cases: + # (i) some of the isolated functions are not alongside + # their black boxes and problem factories, but are rather inside + # the core of poli. For now, the only case is tdc, but more may + # come in the future. + # + # (ii) the isolated function is in the repository, living alongside + # the black box and the problem factory. + if name == "tdc__isolated": + logging.debug("poli 🧪: Registered the isolated function from the repository.") + __register_isolated_function_from_core(name, quiet=quiet) + # Refresh the config + _ = load_config() + else: + logging.debug("poli 🧪: Registered the isolated function from the repository.") + __register_isolated_function_from_repository(name, quiet=quiet) + # Refresh the config + _ = load_config() def __create_function_as_isolated_process(