Skip to content

Makes sure to register and create env every time a black box is called #242

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: dev
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 19 additions & 25 deletions src/poli/core/util/isolation/instancing.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Loading