-
Notifications
You must be signed in to change notification settings - Fork 213
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
Have usermod directory support fail if shell_commands returns an error #4355
Comments
This sounds like a good idea in theory, but I suspect there is – or at least used to be – a reason why this is using run_cmd_no_fail. I see that @jgfouca changed it from |
Right now we are trying to have NEON cases fail for FATES runs at two crop sites and our current method was to have the shell_commands file tell the user why they can't run those cases for FATES and then exit. But then the job is still submittable, when I think we would like it to not be. Is there another method for achieving this behavior? |
can you point me to the shell_commands file that does this? |
That is a good point @billsacks , although I'm more of the mind that if you create a shell_commands that fails in some cases, that you've set it up wrong. So you actually want it to fail. But, if we end up with a lot of things that fail because of this that would be a problem. But, in my mind I would want a case to fail if the shell_commands doesn't work, because that means I've done something wrong in setting it up, or I'm using it for a case that I really shouldn't. @jgfouca do you have some thoughts here? |
Here is the one I was trying to create for our NEON sites. |
@billsacks , that PR is really old and I switched tons of run_cmd calls to run_cmd_no_fail in it so I doubt a lot of thought went into the switch or that I would remember it if I did actually think about it. Looking at this code now, I am confused by @ekluzek 's comments because switching from run_cmd_no_fail to run_cmd should actually hide errors if the return code from run_cmd is not checked. run_cmd_no_fail should always raise an exception when the command returns non-zero. It seems like you must be talking about stderr output being hidden and not necessarily non-zero return codes? |
How about adding something like |
@jgfouca you are right as constructed it should fail with the use of run_cmd_no_fail at the expect statement which should happen provided the error code isn't 0. So I'm not getting why it isn't aborting in a clean way. @jedwards4b might have a good idea here. On Monday we'll see what @adrifoster finds out, and have her show us what it looks like when it's run. |
Hello, So for @ekluzek's suggestion above we get this output after the
For @jedwards4b's suggestion, I got this for a
So that is good! But unfortunately, for a
And then |
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days. |
This issue was closed because it has been stalled for 5 days with no activity. |
Currently when you setup a case with user-mods it will run shell_commands for you -- but won't fail with an error. I think this should be changed to exist with error if there is an error in the shell_commands.
This would be a simple change on line 121 the last line of the following snippet in CIME/user_mod_support.py
That last line should just be changed to
This came up, because we expected it to fail in this CTSM PR...
ESCOMP/CTSM#1932
So it's an easy change, if we agree with it.
@fischer-ncar @jedwards4b @billsacks thoughts on this?
The text was updated successfully, but these errors were encountered: