-
Notifications
You must be signed in to change notification settings - Fork 11
Description
Hello @kinow , @VindeeR , @isimo00
Opening this issue due https://earth.bsc.es/gitlab/digital-twins/de_340-2/workflow/-/issues/1049#note_362808
The error message is very confusing whenever there is an issue with the number of elements that the FOR expected (few or too many as the elements listed in the "NAME" ).
IndexError: list index out of range
During handling of the above exception, another exception occurred:Should be similar to ( perhaps the file of the name has to be obtained in the function that calls this one so the final message can differ)
FILE X has an issue related to a FOR configuration. Please revise that the number of elements matches, or if there is an unintended indentation. The exception should be added to
def parse_data_loops
pointer_to_last_data[section_ending_name] = current_data_aux
try: # here
for key, value in for_sections.items():
if key != "NAME":
pointer_to_last_data[section_ending_name][key] = value[name_index]
except Exception as e: # add this
... # add a message related to "FOR" exception
raiseThe name of the file can be obtained in this function ( yaml_file):
def load_config_file(self, current_folder_data, yaml_file, load_misc=False):
"""
Load a config file and parse it
:param current_folder_data: current folder data
:param yaml_file: yaml file to load
:param load_misc: Load misc files
:return: unified config file
"""
# check if path is file o folder
# load yaml file with ruamel.yaml
new_file = AutosubmitConfig.get_parser(self.parser_factory, yaml_file)
new_file.data = self.normalize_variables(new_file.data.copy(),
must_exists=False) # TODO Figure out why this .copy is needed
if new_file.data.get("DEFAULT", {}).get("CUSTOM_CONFIG", None) is not None:
new_file.data["DEFAULT"]["CUSTOM_CONFIG"] = self.convert_list_to_string(
new_file.data["DEFAULT"]["CUSTOM_CONFIG"])
if new_file.data.get("AS_MISC", False) and not load_misc:
self.misc_files.append(yaml_file)
new_file.data = {}
return self.unify_conf(current_folder_data, new_file.data)The call order is
reload->load_custom_config_section -> load_custom_config -> load_config_file ( I would add the final message here, I think as we have the yaml_file) -> unify_conf -> parse_data_loops
Metadata
Metadata
Assignees
Labels
Type
Projects
Status