-
Notifications
You must be signed in to change notification settings - Fork 56
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
Add git-hash information to EAMxx and in the output metadata #3094
base: master
Are you sure you want to change the base?
Add git-hash information to EAMxx and in the output metadata #3094
Conversation
I'm not CMake savvy so I wouldn't be surprised if there is a better way to accomplish this. @jgfouca or @bartgol , feel free to comment on this approach. The main goal is to have the EAMXX_GIT_VERSION variable always be defined in EAMxx. We already use this variable in the metadata of our output, but it is |
Is this for standalone? The coupler has the git hash in the infobuffer and passes it to all the models. |
This is for CIME cases. If there is already a GIT hash variable available then that would be the correct way to grab the info I think. @rljacob can you point me to an example of this being done? |
@rljacob any reason to believe the info we get with rev-parse would differ from what CIME would pass? I suppose there is a corner case, but it should not affect most users: the logic we have in our cmake code only runs when CMake runs. If one adds another commit and rebuilds, unless the changes trigger another cmake run, EAMXX_GIT_SHA will not get updated. That said, I think the corner case should not impact any production run, only development. So I am ok with it. Unless Rob sees a reason for which we SHOULD rely on CIME's passed var. |
cime's passed var is output in all the other component's history files so its a way to verify output from different models were all made by the same version. In this line: |
Thanks for pointing me to the proper code @rljacob . I'll make the change. |
Question for @rljacob , @jgfouca and @bartgol . Following Rob's example for EAMxx it looks like I get a different git-hash then if I use the CMake approach. I think the CMake approach will grab whatever the git-hash is for the current run, meaning it will change with new commits to a branch. On the other hand I'm not sure how the My question is about what we want in our metadata:
I think that regardless we want to use the EAM convention so that the metadata matches what the other components are using. The main question is, do we also want to add the most up-to-date git hash to the meta data too? |
The hash is what CIME retrieves. And that will be from the SRCROOT. If you've made new commits but haven't rerun preview_namelists (which happens with case.build or case.submit), it won't be updated. |
That's interesting. I definitely ran case.build and case.submit because I needed to rebuild after making the changes. The commit that it appears to point to isn't even the |
If I understand CIME correctly, the sha you get from CIME will always be at least as recent as the one you get in standalone EAMxx. I would use that one, it seems like it should an easy addition to our f90-cxx interface for the coupler. |
Merge ProtectionsYour pull request matches the following merge protections and will not be merged until they are valid. 🟠 Enforce checks passingWaiting checks:
|
Yes, it wasn't difficult to grab the git version from the component coupler and pass that all the way down to our output metadata. My only remaining question is about the discrepancy I see in the different git hashes between the two approaches. @rljacob I think you told me on Slack you were able to recreate the different hash values, any idea why? |
components/eamxx/CMakeLists.txt
Outdated
else() | ||
set(SCREAM_CIME_BUILD TRUE) | ||
endif() | ||
|
||
# Print the sha of the last commit (useful to double check which version was tested on CDash) |
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.
This block should now be moved back into where it was before.
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.
Triggering mergify, to check something. But also pointing out that the mods in the main CMakeLists.txt file should be reverted.
I opened a CIME issue about the behavior. ESMCI/cime#4705. The hash is set at create_newcase time and never changes. Its possible CIME always did this and no one noticed until Aaron started looking carefully. For a production run, those will be done on master so the hash will be right. For any runs done on a frequently changing feature branch, most of that data gets thrown away so no one checked. |
@jgfouca do you agree? From the perspective of this PR reverting the CMake changes makes sense. We are no longer passing the EAMXX_GIT_VERSION variable to the netCDF metadata. But in the old approach were we ever setting this variable to anything other than ""? In other words should we keep my change so that if EAMXX_GIT_VERSION is ever queried it reflects the git hash? If we plan to only use the CIME passed one can we remove EAMXX_GIT_VERSION altogether? |
We cannot remove it altogether, since we need it for standalone runs. But is should not be used for CIME runs. |
This commit retrieves the git-hash saved in the component coupler and makes sure it is passed into the atmosphere driver. This is then used to improve the netcdf metadata in all EAMxx output files.
0fbd70f
to
1062373
Compare
6318f41
to
db5b35d
Compare
@bartgol can I go ahead and merge this? |
This commit changes the CMake commands for eamxx to ensure that the git-hash is saved to the EAMXX_GIT_VERSION variable and is thus available to EAMxx itself.
This naturally causes the git-hash to be added to the netCDF metadata for all EAMxx output.
Partially addresses #2142