-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Basin and timestep information for error messages and warnings #723
Comments
I strongly agree having that information would improve the ability to isolate, diagnose, and fix issues within realization modules. As a matter of implementation, prefixing the error message uniformly might be pretty hard without close cooperation with all the formulation implementers. For C++ and Python formulations, if they throw an exception, we can catch it and handle accordingly. For all languages, if they return In theory, we could add verbose debug printing to emit basin, timestep, and module name before each call we make, but that would only be affordable for runs where the user knows they need it, because printing is expensive (relatively speaking). |
I've been looking at possible mechanisms for intercepting |
It would be pretty easy to at least set some variables indicating the relevant debugging variables, and add an I would be really hesitant to intercept I did a slight bit of looking, and it may be workable to throw an exception in an |
@PhilMiller For the legacy models that we've updated and implemented with BMI (e.g. Noah-OWP-Modular), we have a lot of flexibility in modernizing code. If there's anything specific we should do to make the models more framework-friendly, please let us know. |
@hellkite500 I was thinking of a simpler workflow that Keith and Phill somehow described -- verbosity at the ngen level with/without getting any information from the models. For each timestep, before calling Other options could be based on BMI_FAILURE (as Phill mentioned) or each model should implement its own ValidTimeStep() function that could be used to validate if the model has taken a successful timestep or not. I think this will require a little bit of work, but doable... |
I think the friendliest thing to do on the model side would be to make sure that the call returns For languages that can throw an exception, that's perfectly fine too, since those are cheap and easy to catch and can be handled the same way as a returned I don't think we can do a |
@PhilMiller, thanks for that. Below are my assumptions for implementing this in Noah-OWP-Modular for the error @yuqiong77 saw (linked here). Please correct anything that's wrong:
Or something like that. |
@SnowHydrology if I am understanding this correctly, won't removing @PhilMiller sorry if I was not clear enough, the |
@ajkhattak It shouldn't matter in the case of Noah-OM because we run the main program using BMI commands. So if we implement But I haven't tested it, so the "shoulds" might not correspond to reality. |
That all sounds good to me. |
@GreyEvenson-NOAA Can you open an issue on Noah-OWP-Modular to test this new implementation of error handling? |
The hydrologic models running in NextGen may fail for many reasons. Some of them have error messages that print to the console, which is helpful for diagnosing model-specific issues, but not for determining where and when the model failed.
Current behavior
Error messages and warning write to the console without location or time information.
Expected behavior
Concatenate basin and timestamp information to warning and error messages. Something like:
cat-<id>, timestep <model-timestep>: <error-message>
The text was updated successfully, but these errors were encountered: