-
Notifications
You must be signed in to change notification settings - Fork 322
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 fsurdat_modifier system test use conda environment rather than ncar_pylib #1798
Conversation
…ronment rather than ncar_pylib
Thanks for working on this. It's not as pretty or simple as I hoped, but it's still an improvement over what we had before - and I really hope any such mechanism can go away before too long. Can you confirm two things:
|
I think I can improve on what I have here, so I'll try to do that. But, I also really like your suggestions on tests as well, so I'll do that. To simplify this further we'll need conda to be loaded on machines in ccs_config/cime rather than python. That should be OK as when you activate an environment with conda you get a python version with it. But, we've got to convince CESM people that doing that would be OK. |
I'm not sure it's worth spending much more time on this. (Sorry: my last comment probably suggested that it would be good to improve this, but I don't really think that should be a priority.) The vision we have discussed in CSEG is that users will load an appropriate python environment before doing anything with CESM / CIME. We don't want CIME to be responsible for controlling the python environment. Once we are comfortable with that (maybe the switch to derecho will be a good time???), I believe we can remove any 'module load python' from CIME. (I don't think we want a conda load in ccs_config/cime: I think we want to leave this up to the user - at least based on previous discussions.) So I feel like a less-than-elegant solution is okay for now as long as it works, and then we can hopefully remove this soon. |
Also: I appreciate that this new solution works on multiple machines, not just cheyenne. |
One other thing to confirm, if you haven't already, is: if there are failures in various aspects of the subprocess call, make sure that the test stops at that point with a FAIL result noted in the TestStatus file. You should definitely confirm this is the case for a possible failure in running fsurdat_modifier (e.g., deliberately introduce an error there and make sure the test aborts appropriately), but I'd also want to know that a failure in an earlier step in the subprocess call (where you have strung a bunch of commands together) correctly results in an error being reported. (I see you use |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approving with the testing caveats noted in my earlier comments. Thanks for your work on changing this so it will work on other systems as well as not relying on the deprecated ncar_pylib!
Thanks, @ekluzek |
The tools modify_fsurdat and subset_data have similar options modify_fsurdat: zero_nonveg subset_data: include-nonveg modify_fsurdat: dom_plant subset_data: dom-pft Make more similar and use README file for documenting modify_fsurdat. There's potential for additional changes to be addressed later. Change name of manage_python_env to py_env_create as agreed in CTSM software meeting
…m_pylib to match ncar_pylib and to use a different name from the Hammon script that uses a ctsm_py environment name
…black check isn't duplicated
Oh, I had forgotten about this one too. Thanks @billsacks |
@slevisconsulting I'm not going to be able to get back to working on this one for awhile, I wonder if you shouldn't merge this into your PR and shepherd bringing it in to CTSM main? |
This set of changes allows CTSM to continue API compatability with changes to the FATES API. FATES has updated its nutrient dynamics routine, and required a modification to the test environment, some minor updates to variable dimensions in the history, and a call to a new FATES history routine. Implicitly, the updating of the FATES tag introduces new content in the FATES model since the last API update (mostly bug fixes). Resolved conflicts: cime_config/SystemTests/fsurdatmodifyctsm.py test/tools/test_driver.sh
@ekluzek looks as though I can push directly to your PR, so I will work here for now, and we will likely close the redundant PR that I opened (#1925) |
@slevisconsulting I think some of the documentation changes you have in #1925, might still apply. So you could merge this into that, or the other way around, whichever you prefer. I'm glad you'll be able to work on it though, it would be nice to see this come in. |
This comment was marked as resolved.
This comment was marked as resolved.
FSURDATMODIFYCTSM_D_Mmpi-serial_Ld1.5x5_amazon.I2000Clm50SpRs.cheyenne_intel
I ran aux_clm on cheyenne and it passed other than expected failures. I did not get motivated to try a custom list of tests :-) |
Awesome, thanks @slevisconsulting |
Tested the latest commit in clm_pymods, as well as with ./create_test and both passed. |
@ekluzek and @slevisconsulting agreed this morning (2023/1/24) that this PR will likely get merged/tagged as dev118, pending successful testing once I update to dev117. |
@ekluzek I think something has changed in my permissions here. I updated to dev117, but the push to the PR has been failing. If nothing has changed on your side, we may need to troubleshoot tomorrow morning after Stand-up. |
Meanwhile So now I need to difference this PR from vanilla dev117 to figure out what causes the above failure... |
Resolved conflicts: cime_config/SystemTests/fsurdatmodifyctsm.py test/tools/test_driver.sh
I have tried once more doing everything from scratch and the FSURDAT system test still fails. This is how I resolved the conflicts:
but changing ctsm_py to ctsm_pylib as I did elsewhere in this PR.
I now suspect that one or more new things in this PR fail for some reason. New items include:
Also, I still get an error when I try to push to the PR:
|
Regarding the permissions: I have noticed that there is a bug with git-lfs that can prevent you from pushing to other people's forks. The workaround is to do a |
I think the permission is just the problem with making @slevisconsulting a collaborator on my fork, which we've resolved now. In test driver you should change the use of ctsm_py to ctsm_pylib as follows... conda activate ctsm_pylib
if [ \$? -ne 0 ]; then
echo "ERROR: Trouble activating the ctsm_py conda environment, be sure it's setup with \$CLM_ROOT/py_env_create, then rerun"
exit 4
fi in fsurdatmodifyctsm.py you do need to change the line in try:
subprocess.run( conda_env+"python3 "+tool_path+" "+self._cfg_file_path, shell=True, check=True)
except subprocess.CalledProcessError as error: to try:
subprocess.check_call(conda_env+"python3 "+tool_path+" "+self._cfg_file_path+"--verbose --overwrite --allow_ideal_and_include_non_veg", shell=True, check=True)
except subprocess.CalledProcessError as error: Do you see why those need to change? Just want to make sure this makes sense to you... |
@ekluzek I think I have found the source of the problem. For some reason it eluded me until now. I have discovered this message, and wanted to ask whether you had a specific reason to add this requirement or if simply it made sense to you: |
If you had a specific reason, then I will keep it. If not, then I would rather remove this requirement. |
I now see (probably saw in the review, as well, but forgot) that you had added this option: |
@slevisconsulting the reason I thought that idealized and include_nonveg should be on together is because idealized explicitly sets the dominant PFT to zero, while include_nonveg (actually false) zeros' out the PFT's. So they contradict each other. It looks like I got the logic wrong though -- and that combination should be allowed. First I got it wrong about it being about include_nonveg True, when it should be False. But, also I got it wrong that include_nonveg=False isn't zeroing vegetation -- just all the other landunit types -- so that's actually fine. So you should remove that restriction and option I added. The one that still makes sense is idealized and dom_pft, because idealized explicitly sets the dominant PFT to bare-soil, while dom_pft sets it to the value the user asks for. What behavior you get is then dependent on how it's implemented in the code -- but since it's ambiguous that means it's something that should be checked for. Sorry I added a non useful restriction there. It is good to think these things through and make sure options make sense together and restrict ones that don't. |
@ekluzek I thought about it some more and decided that I also disagree about keeping the second restriction. The comments in the configure file explain why:
In other words, dom_pft is meant to be zero if the user leaves it UNSET or if the user explicitly sets it to zero. |
Thanks @billsacks . |
I really think this is due to the lfs issue. There are two ways you can have permission to push to someone else's fork: (1) If they make you a collaborator. This works even if you have git lfs installed. (2) If you are a "maintainer" of CTSM (which I think means you have write permission), then by default you are given permission to push to any branch for which there is a PR. (Authors can choose not to give this permission, but the default is to give it. For this pr, it is allowed: I see the message "Maintainers are allowed to edit this pull request" in the metadata on the top right of the PR.) This feature is broken by git lfs for some reason. |
@slevisconsulting that makes sense, and nicely documented in the file. Thanks for pointing that out. It might be good to add a comment in the code that the dom_pft section HAS to be after the the idealized part for those reasons above. You could also add a comment to the idealized section that this should be done first, so that other options could override the behavior there. The idea that the idealized section is done and other things override its behavior then becomes an expectation of how the script is supposed to function. It's good to make all the expectations on how the script is intended to behavior to be as clear as possible. |
Update ChangeLog and python tests
|
Description of changes
Use the manage_python_env script to setup the conda environment and use it rather than ncar_pylib
Specific notes
Contributors other than yourself, if any: None
CTSM Issues Fixed (include github issue #):
Fixes #1786
Fixes #1925
Are answers expected to change (and if so in what way)? No
Any User Interface Changes (namelist or namelist defaults changes)? No
Testing performed, if any:
FSURDATMODIFYCTSM_D_Mmpi-serial_Ld1.5x5_amazon.I2000Clm50SpRs.cheyenne_intel runs and PASSes on cheyenne