diff --git a/expconfig.py b/expconfig.py index 95cdcfeca1e2c479b9f349013d16311bd884a5e2..d3a833a5ea9f78c8aaa07e3c9fe249239f86ef29 100644 --- a/expconfig.py +++ b/expconfig.py @@ -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)