From dfd2d1bcc0ee050246c3fb56c388c35a4b6d0b7c Mon Sep 17 00:00:00 2001 From: Uriel Ramirez Date: Tue, 25 Nov 2025 10:42:05 -0500 Subject: [PATCH 1/5] Fix to allow for platforms to contain fre_properties that can be used in the compile and model yaml --- .../info_parsers/compile_info_parser.py | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/fre/yamltools/info_parsers/compile_info_parser.py b/fre/yamltools/info_parsers/compile_info_parser.py index 4cca5395d..24bc909c8 100644 --- a/fre/yamltools/info_parsers/compile_info_parser.py +++ b/fre/yamltools/info_parsers/compile_info_parser.py @@ -121,9 +121,9 @@ def combine_platforms(self, yaml_content): :param yaml_content: string of yaml information including name, platform, target, model, and compile yaml content :type yaml_content: str - :return: dictionary of yaml information including name, platform, - target, model, compile, and platform yaml content - :rtype: dict + :return: string of yaml information including name, platform, + target, model, and compile yaml content + :rtype: str """ self.mainyaml_dir = os.path.dirname(self.yml) @@ -139,12 +139,9 @@ def combine_platforms(self, yaml_content): # Combine information as strings yaml_content += platform_content - # Load string as yaml - yml = yaml.load(yaml_content, Loader = yaml.Loader) - # Return the combined string and loaded yaml fre_logger.info(f" platforms yaml: {py_path}") - return yml + return yaml_content def combine(self): """ @@ -168,19 +165,22 @@ def combine(self): # Merge compile into combined file to create updated yaml_content/yaml try: - yaml_content = self.combine_compile(yaml_content) + yaml_content = self.combine_platforms(yaml_content) except Exception as exc: raise ValueError("ERR: Could not merge compile yaml config with model config.") from exc # Merge platforms.yaml into combined file try: - full_combined = self.combine_platforms(yaml_content) + full_combined = self.combine_compile(yaml_content) except Exception as exc: raise ValueError("ERR: Could not merge platform yaml config with model and compile configs.") from exc + # Load string as yaml + yml = yaml.load(full_combined, Loader = yaml.Loader) + # Clean the yaml try: - cleaned_yaml = clean_yaml(full_combined) + cleaned_yaml = clean_yaml(yml) except Exception as exc: raise ValueError("The final YAML could not cleaned.") from exc From 8b81722b9006bf5b7e84d10e3d656bd6a66dabd3 Mon Sep 17 00:00:00 2001 From: Uriel Ramirez Date: Tue, 25 Nov 2025 11:22:34 -0500 Subject: [PATCH 2/5] clean up any fre_properties from the platform yaml --- fre/yamltools/helpers.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/fre/yamltools/helpers.py b/fre/yamltools/helpers.py index 36fe2836a..18c4da22e 100644 --- a/fre/yamltools/helpers.py +++ b/fre/yamltools/helpers.py @@ -129,6 +129,11 @@ def clean_yaml(yml_dict): if kc in yml_dict.keys(): del yml_dict[kc] + # Clean up any fre_properties in the platforms + for platform in yml_dict['platforms']: + if "fre_properties" in platform: + del platform['fre_properties'] + # Dump cleaned dictionary back into combined yaml file #cleaned_yaml = yaml.safe_dump(yml_dict,default_flow_style=False,sort_keys=False) return yml_dict From 29c181232ee8f4da73fb5b50004db050bc0f14e5 Mon Sep 17 00:00:00 2001 From: Uriel Ramirez Date: Tue, 25 Nov 2025 11:25:38 -0500 Subject: [PATCH 3/5] Fix error messages --- fre/yamltools/info_parsers/compile_info_parser.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fre/yamltools/info_parsers/compile_info_parser.py b/fre/yamltools/info_parsers/compile_info_parser.py index 24bc909c8..70832673d 100644 --- a/fre/yamltools/info_parsers/compile_info_parser.py +++ b/fre/yamltools/info_parsers/compile_info_parser.py @@ -167,13 +167,13 @@ def combine(self): try: yaml_content = self.combine_platforms(yaml_content) except Exception as exc: - raise ValueError("ERR: Could not merge compile yaml config with model config.") from exc + raise ValueError("ERR: Could not merge platform yaml config with model config.") from exc # Merge platforms.yaml into combined file try: full_combined = self.combine_compile(yaml_content) except Exception as exc: - raise ValueError("ERR: Could not merge platform yaml config with model and compile configs.") from exc + raise ValueError("ERR: Could not merge compile yaml config with model and platform configs.") from exc # Load string as yaml yml = yaml.load(full_combined, Loader = yaml.Loader) From efdbec0b2fadbb5d447c27869c0cd61b3370bb26 Mon Sep 17 00:00:00 2001 From: Uriel Ramirez Date: Tue, 25 Nov 2025 11:43:55 -0500 Subject: [PATCH 4/5] Safely handle case when there are no platforms (i.e pp yamls) --- fre/yamltools/helpers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fre/yamltools/helpers.py b/fre/yamltools/helpers.py index 18c4da22e..46c6d98f7 100644 --- a/fre/yamltools/helpers.py +++ b/fre/yamltools/helpers.py @@ -130,7 +130,7 @@ def clean_yaml(yml_dict): del yml_dict[kc] # Clean up any fre_properties in the platforms - for platform in yml_dict['platforms']: + for platform in yml_dict.get('platforms', []): if "fre_properties" in platform: del platform['fre_properties'] From 2b6a84b80fb53378364b66c3cdbe096ed218aca1 Mon Sep 17 00:00:00 2001 From: Uriel Ramirez Date: Tue, 25 Nov 2025 12:16:54 -0500 Subject: [PATCH 5/5] #everythingworks --- fre/yamltools/helpers.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/fre/yamltools/helpers.py b/fre/yamltools/helpers.py index 46c6d98f7..51624a651 100644 --- a/fre/yamltools/helpers.py +++ b/fre/yamltools/helpers.py @@ -130,9 +130,11 @@ def clean_yaml(yml_dict): del yml_dict[kc] # Clean up any fre_properties in the platforms - for platform in yml_dict.get('platforms', []): - if "fre_properties" in platform: - del platform['fre_properties'] + platforms = yml_dict.get('platforms', []) + if platforms: + for platform in platforms: + if "fre_properties" in platform: + del platform['fre_properties'] # Dump cleaned dictionary back into combined yaml file #cleaned_yaml = yaml.safe_dump(yml_dict,default_flow_style=False,sort_keys=False)