Skip to content
Snippets Groups Projects
Commit 788b1d4f authored by Karl-Hermann Wieners's avatar Karl-Hermann Wieners
Browse files

Config: disentangle changes to config and final evaluation in expconfig

parent 1bfa0cd5
No related branches found
No related tags found
No related merge requests found
......@@ -543,19 +543,6 @@ class ExpConfig(ConfigObj):
if not getexp:
pre_config['VERSIONS_'] = config_versions
# Re-read merged config with interpolation set.
# This works around incomprehensible inheritance of interpolation with
# merge. Make sure that all values are interpolated
config_lines = io.BytesIO()
pre_config.write(config_lines)
pre_config = None
config_lines.seek(0)
pre_config = ConfigObj(io.TextIOWrapper(config_lines),
interpolation=False if getexp else 'template')
# Extract experiment description from initial comment
# if not set explicitly
if 'EXP_DESCRIPTION' not in pre_config:
......@@ -574,6 +561,23 @@ class ExpConfig(ConfigObj):
))
)
# Additional experiment info
self.experiment_id = pre_config[ExpConfig.id_name]
self.experiment_kind = re.sub(r'-\w+$', '', experiment_type)
# Re-read merged config with interpolation set.
# This works around incomprehensible inheritance of interpolation with
# merge. Make sure that all values are interpolated
config_lines = io.BytesIO()
pre_config.write(config_lines)
pre_config = None
config_lines.seek(0)
pre_config = ConfigObj(io.TextIOWrapper(config_lines),
interpolation=False if getexp else 'template')
pre_config.walk(eval_key)
# Re-read final config without interpolation.
......@@ -588,7 +592,4 @@ class ExpConfig(ConfigObj):
ConfigObj.__init__(self, io.TextIOWrapper(config_lines),
interpolation=False)
self.walk(uneval_key)
self.experiment_id = self[ExpConfig.id_name]
self.experiment_kind = re.sub(r'-\w+$', '', experiment_type)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment