You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This issue is just formally laying out the problem I described at the 07/12 workflow group meeting. When you pass the a yaml file to combine_diag_table_yamls.py that is formatted as "key:value" instead of "key: value", the script fails with the following error: TypeError: string indices must be integers. When run within fre/bronx, this error is quite difficult to debug, and users may not think to check the formatting of their yaml file.
It looks like combine_diag_table_yamls is outputting this error because the yaml.safe_load() function called on line 121 reads the incorrect key value pairs as one long string, rather than as a dictionary. When it finds the key base_datewithin the string on line 123, it tries to index the string using another string on the next line, leading to the string indices must be integerserror.
Note that this error only occurs when you pass in a yaml file that is just a series of incorrect key value pairs. If the file contains a correct key value pair or a list after the incorrect ones, the error will instead say yaml.scanner.ScannerError: mapping values are not allowed here. I guess this is because it is trying to interpret the incorrect key value pairs as a single string that serves as a key to the next key in the yaml file.
If combine_diag_table_yamls.py is not called, frerun seems to read the yaml file without any errors, even if it contains an incorrect key-value pair. It may be good to ensure that any other script which reads yaml files outputs clearer error messages, in case a user gets one of the above error messages while running the experiment. Alternatively, it may be a good idea to add error checking so that frerun throws an error before writing the run script.
I think the simplest solution to this issue would be just adding a print statement that just tells the user to recheck the key value pairs on the relevant lines in their yaml file if a ScannerError or TypeError occurs. I can make this change or any other solution you think would be better if you need me to. Let me know what you think!
The text was updated successfully, but these errors were encountered:
If combine_diag_table_yamls.py is not called, frerun seems to read the yaml file without any errors, even if it contains an incorrect key-value pair. It may be good to ensure that any other script which reads yaml files outputs clearer error messages, in case a user gets one of the above error messages while running the experiment. Alternatively, it may be a good idea to add error checking so that frerun throws an error before writing the run script.
@ceblanton , @uramirez8707 , regarding this issue: I'm currently running regional mom6 with an incorrectly formatted yaml, and the run hasn't had any issues even though I'm almost two hours in. I took a look at the output from the model so far, and it appears to be stuck on the following step: Starting to initialize diag_manager at 20240724 112529.966.
I'm not sure if this is because of the incorrect yaml, but it's strange to me that frerun was able to run this long without throwing any errors. Do either of you know what may be going on here?
@ceblanton , @uramirez8707 , regarding this issue: I'm currently running regional mom6 with an incorrectly formatted yaml, and the run hasn't had any issues even though I'm almost two hours in. I took a look at the output from the model so far, and it appears to be stuck on the following step: Starting to initialize diag_manager at 20240724 112529.966.
This issue is just formally laying out the problem I described at the 07/12 workflow group meeting. When you pass the a yaml file to
combine_diag_table_yamls.py
that is formatted as "key:value" instead of "key: value", the script fails with the following error:TypeError: string indices must be integers
. When run within fre/bronx, this error is quite difficult to debug, and users may not think to check the formatting of their yaml file.It looks like
combine_diag_table_yamls
is outputting this error because theyaml.safe_load()
function called on line 121 reads the incorrect key value pairs as one long string, rather than as a dictionary. When it finds the keybase_date
within the string on line 123, it tries to index the string using another string on the next line, leading to thestring indices must be integers
error.Note that this error only occurs when you pass in a yaml file that is just a series of incorrect key value pairs. If the file contains a correct key value pair or a list after the incorrect ones, the error will instead say
yaml.scanner.ScannerError: mapping values are not allowed here
. I guess this is because it is trying to interpret the incorrect key value pairs as a single string that serves as a key to the next key in the yaml file.If
combine_diag_table_yamls.py
is not called,frerun
seems to read the yaml file without any errors, even if it contains an incorrect key-value pair. It may be good to ensure that any other script which reads yaml files outputs clearer error messages, in case a user gets one of the above error messages while running the experiment. Alternatively, it may be a good idea to add error checking so thatfrerun
throws an error before writing the run script.I think the simplest solution to this issue would be just adding a print statement that just tells the user to recheck the key value pairs on the relevant lines in their yaml file if a
ScannerError
orTypeError
occurs. I can make this change or any other solution you think would be better if you need me to. Let me know what you think!The text was updated successfully, but these errors were encountered: