Skip to content

Commit f55def7

Browse files
authored
Update externals (including git-fleximod) to match cam6_4_117 (#425)
Tag name (required for release branches): Originator(s): nusbaume Description (include the issue title, and the keyword ['closes', 'fixes', 'resolves'] followed by the issue number): Updates the externals to match cam6_4_115 (CAM PR is ESCOMP/CAM#1384). This PR also updates git-fleximod to v1.0.2, which is needed to fix a bug which shows up when one uses the wrong tag for an external submodule. Describe any changes made to build system: N/A Describe any changes made to the namelist: N/A List any changes to the defaults for the input datasets (e.g. boundary datasets): N/A List all files eliminated and why: N/A List all files added and what they do: N/A List all existing files that have been modified, and describe the changes: (Helpful git command: `git diff --name-status development...<your_branch_name>`) M .lib/git-fleximod/git_fleximod/cli.py M .lib/git-fleximod/git_fleximod/git_fleximod.py M .lib/git-fleximod/git_fleximod/gitinterface.py M .lib/git-fleximod/git_fleximod/submodule.py M .lib/git-fleximod/pyproject.toml M .lib/git-fleximod/tbump.toml M .lib/git-fleximod/tests/conftest.py M .lib/git-fleximod/tests/test_c_required.py - Update git-fleximod to v1.0.2 M .github/workflows/fleximod_test.yaml - Update fleximod test to match what is in CAM. M .gitmodules M ccs_config M cime M components/cdeps M components/cism M components/clm M components/cmeps M components/mizuRoute M components/mosart M components/rtm M libraries/parallelio M src/physics/ncar_ccpp M tools/CUPiD - Update externals to match cam6_4_117 If there are new failures (compared to the `test/existing-test-failures.txt` file), have them OK'd by the gatekeeper, note them here, and add them to the file. If there are baseline differences, include the test and the reason for the diff. What is the nature of the change? Roundoff? derecho/intel/aux_sima: ALL PASS derecho/gnu/aux_sima: ALL PASS If this changes climate describe any run(s) done to evaluate the new climate in enough detail that it(they) could be reproduced: CAM-SIMA date used for the baseline comparison tests if different than latest:
1 parent 77fa975 commit f55def7

File tree

22 files changed

+188
-98
lines changed

22 files changed

+188
-98
lines changed

.github/workflows/fleximod_test.yaml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
uses: actions/checkout@v4
1414
- id: run-fleximod
1515
run: |
16-
$GITHUB_WORKSPACE/bin/git-fleximod update
16+
$GITHUB_WORKSPACE/bin/git-fleximod update -o
1717
echo
1818
echo "Update complete, checking status"
1919
echo
@@ -23,6 +23,4 @@ jobs:
2323
echo
2424
echo "Checking if git fleximod matches expected externals"
2525
echo
26-
git diff --exit-code
27-
28-
26+
git add . && git diff --exit-code && git diff --cached --exit-code

.gitmodules

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
[submodule "ncar-physics"]
2121
path = src/physics/ncar_ccpp
2222
url = https://github.com/ESCOMP/atmospheric_physics
23-
fxtag = 178c1833d72a4027c6162a6c11b52bbbdcb272b6
23+
fxtag = atmos_phys0_17_002
2424
fxrequired = AlwaysRequired
2525
fxDONOTUSEurl = https://github.com/ESCOMP/atmospheric_physics
2626
[submodule "rrtmgp-data"]
@@ -32,13 +32,13 @@
3232
[submodule "ccs_config"]
3333
path = ccs_config
3434
url = https://github.com/ESMCI/ccs_config_cesm.git
35-
fxtag = ccs_config_cesm1.0.53
35+
fxtag = ccs_config_cesm1.0.61
3636
fxrequired = ToplevelRequired
3737
fxDONOTUSEurl = https://github.com/ESMCI/ccs_config_cesm.git
3838
[submodule "cdeps"]
3939
path = components/cdeps
4040
url = https://github.com/ESCOMP/CDEPS.git
41-
fxtag = cdeps1.0.73
41+
fxtag = cdeps1.0.80
4242
fxrequired = ToplevelRequired
4343
fxDONOTUSEurl = https://github.com/ESCOMP/CDEPS.git
4444
[submodule "cice"]
@@ -50,25 +50,25 @@
5050
[submodule "cime"]
5151
path = cime
5252
url = https://github.com/ESMCI/cime
53-
fxtag = cime6.1.113
53+
fxtag = cime6.1.126
5454
fxrequired = ToplevelRequired
5555
fxDONOTUSEurl = https://github.com/ESMCI/cime
5656
[submodule "cism"]
5757
path = components/cism
5858
url = https://github.com/ESCOMP/CISM-wrapper
59-
fxtag = cismwrap_2_2_006
59+
fxtag = cismwrap_2_2_010
6060
fxrequired = ToplevelRequired
6161
fxDONOTUSEurl = https://github.com/ESCOMP/CISM-wrapper
6262
[submodule "clm"]
6363
path = components/clm
6464
url = https://github.com/ESCOMP/CTSM
65-
fxtag = ctsm5.3.029
65+
fxtag = alpha-ctsm5.4.CMIP7.09.ctsm5.3.068
6666
fxrequired = ToplevelRequired
6767
fxDONOTUSEurl = https://github.com/ESCOMP/CTSM
6868
[submodule "cmeps"]
6969
path = components/cmeps
7070
url = https://github.com/ESCOMP/CMEPS.git
71-
fxtag = cmeps1.0.47
71+
fxtag = cmeps1.1.16
7272
fxrequired = ToplevelRequired
7373
fxDONOTUSEurl = https://github.com/ESCOMP/CMEPS.git
7474
[submodule "fms"]
@@ -80,25 +80,25 @@
8080
[submodule "mizuRoute"]
8181
path = components/mizuRoute
8282
url = https://github.com/ESCOMP/mizuRoute
83-
fxtag = cesm-coupling.n03_v2.2.0
83+
fxtag = v3.0.0
8484
fxrequired = ToplevelRequired
8585
fxDONOTUSEurl = https://github.com/ESCOMP/mizuRoute
8686
[submodule "mosart"]
8787
path = components/mosart
8888
url = https://github.com/ESCOMP/MOSART
89-
fxtag = mosart1.1.08
89+
fxtag = mosart1.1.12
9090
fxrequired = ToplevelRequired
9191
fxDONOTUSEurl = https://github.com/ESCOMP/MOSART
9292
[submodule "parallelio"]
9393
path = libraries/parallelio
9494
url = https://github.com/NCAR/ParallelIO
95-
fxtag = pio2_6_4
95+
fxtag = pio2_6_6
9696
fxrequired = ToplevelRequired
9797
fxDONOTUSEurl = https://github.com/NCAR/ParallelIO
9898
[submodule "rtm"]
9999
path = components/rtm
100100
url = https://github.com/ESCOMP/RTM
101-
fxtag = rtm1_0_86
101+
fxtag = rtm1_0_89
102102
fxrequired = ToplevelRequired
103103
fxDONOTUSEurl = https://github.com/ESCOMP/RTM
104104
[submodule "share"]
@@ -110,6 +110,6 @@
110110
[submodule "tools/CUPiD"]
111111
path = tools/CUPiD
112112
url = https://github.com/NCAR/CUPiD.git
113-
fxtag = v0.2.1
113+
fxtag = v0.3.1
114114
fxrequired = ToplevelRequired
115115
fxDONOTUSEurl = https://github.com/NCAR/CUPiD.git

.lib/git-fleximod/git_fleximod/cli.py

Lines changed: 35 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,50 @@
11
from pathlib import Path
2-
import argparse
2+
import argparse, os, sys
33
from git_fleximod import utils
44

5-
__version__ = "0.9.4"
5+
__version__ = "1.0.2"
6+
7+
class CustomArgumentParser(argparse.ArgumentParser):
8+
def print_help(self, file=None):
9+
# First print the default help message
10+
super().print_help(file)
11+
12+
# Then append the contents of README.md
13+
candidate_paths = [
14+
Path(sys.prefix) / "share" / "git_fleximod" / "README.md",
15+
Path(__file__).resolve().parent.parent / "README.md", # fallback for dev
16+
]
17+
for path in candidate_paths:
18+
if os.path.exists(path):
19+
with open(path) as f:
20+
print( f.read(), file=file)
21+
return
22+
print( "README.md not found.", file=file)
623

724
def find_root_dir(filename=".gitmodules"):
825
""" finds the highest directory in tree
926
which contains a file called filename """
10-
try:
11-
root = utils.execute_subprocess(["git","rev-parse", "--show-toplevel"],
12-
output_to_caller=True ).rstrip()
13-
except:
14-
d = Path.cwd()
15-
root = Path(d.root)
16-
dirlist = []
17-
dl = d
18-
while dl != root:
19-
dirlist.append(dl)
20-
dl = dl.parent
21-
dirlist.append(root)
22-
dirlist.reverse()
23-
24-
for dl in dirlist:
25-
attempt = dl / filename
26-
if attempt.is_file():
27-
return str(dl)
28-
return None
29-
return Path(root)
27+
d = Path.cwd()
28+
root = Path(d.root)
29+
dirlist = []
30+
dl = d
31+
while dl != root:
32+
dirlist.append(dl)
33+
dl = dl.parent
34+
dirlist.append(root)
35+
dirlist.reverse()
36+
37+
for dl in dirlist:
38+
attempt = dl / filename
39+
if attempt.is_file():
40+
return str(dl)
41+
return None
3042

3143
def get_parser():
3244
description = """
3345
%(prog)s manages checking out groups of gitsubmodules with additional support for Earth System Models
3446
"""
35-
parser = argparse.ArgumentParser(
47+
parser = CustomArgumentParser(
3648
description=description, formatter_class=argparse.RawDescriptionHelpFormatter
3749
)
3850

.lib/git-fleximod/git_fleximod/git_fleximod.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import shutil
1010
import logging
1111
import textwrap
12+
import asyncio
1213
from git_fleximod import utils
1314
from git_fleximod import cli
1415
from git_fleximod.gitinterface import GitInterface
@@ -218,10 +219,10 @@ def git_toplevelroot(root_dir, logger):
218219
_, superroot = rgit.git_operation("rev-parse", "--show-superproject-working-tree")
219220
return superroot
220221

221-
def submodules_update(gitmodules, root_dir, requiredlist, force):
222-
for name in gitmodules.sections():
222+
async def submodules_update(gitmodules, root_dir, requiredlist, force):
223+
async def update_submodule(name, requiredlist, force):
223224
submod = init_submodule_from_gitmodules(gitmodules, name, root_dir, logger)
224-
225+
225226
_, needsupdate, localmods, testfails = submod.status()
226227
if not submod.fxrequired:
227228
submod.fxrequired = "AlwaysRequired"
@@ -239,11 +240,11 @@ def submodules_update(gitmodules, root_dir, requiredlist, force):
239240
if "Optional" in fxrequired and "Optional" not in requiredlist:
240241
if fxrequired.startswith("Always"):
241242
print(f"Skipping optional component {name:>20}")
242-
continue
243+
return # continue to next submodule
243244
optional = "AlwaysOptional" in requiredlist
244245

245246
if fxrequired in requiredlist:
246-
submod.update()
247+
await submod.update()
247248
repodir = os.path.join(root_dir, submod.path)
248249
if os.path.exists(os.path.join(repodir, ".gitmodules")):
249250
# recursively handle this checkout
@@ -252,7 +253,10 @@ def submodules_update(gitmodules, root_dir, requiredlist, force):
252253
newrequiredlist = ["AlwaysRequired"]
253254
if optional:
254255
newrequiredlist.append("AlwaysOptional")
255-
submodules_update(gitsubmodules, repodir, newrequiredlist, force=force)
256+
await submodules_update(gitsubmodules, repodir, newrequiredlist, force=force)
257+
258+
tasks = [update_submodule(name, requiredlist, force) for name in gitmodules.sections()]
259+
await asyncio.gather(*tasks)
256260

257261
def local_mods_output():
258262
text = """\
@@ -346,7 +350,7 @@ def main():
346350
sys.exit(f"No submodule components found, root_dir={root_dir}")
347351
retval = 0
348352
if action == "update":
349-
submodules_update(gitmodules, root_dir, fxrequired, force)
353+
asyncio.run(submodules_update(gitmodules, root_dir, fxrequired, force))
350354
elif action == "status":
351355
tfails, lmods, updates = submodules_status(gitmodules, root_dir, toplevel=True)
352356
if tfails + lmods + updates > 0:

.lib/git-fleximod/git_fleximod/gitinterface.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import sys
33
from . import utils
44
from pathlib import Path
5+
import asyncio
56

67
class GitInterface:
78
def __init__(self, repo_path, logger):
@@ -47,6 +48,16 @@ def _init_git_repo(self):
4748
command = ("git", "-C", str(self.repo_path), "init")
4849
utils.execute_subprocess(command)
4950

51+
def _git_operation_command(self, operation, args):
52+
newargs = []
53+
for a in args:
54+
# Do not use ssh interface
55+
if isinstance(a, str):
56+
a = a.replace("git@github.com:", "https://github.com/")
57+
newargs.append(a)
58+
59+
return self._git_command(operation, *newargs)
60+
5061
# pylint: disable=unused-argument
5162
def git_operation(self, operation, *args, **kwargs):
5263
newargs = []
@@ -66,6 +77,25 @@ def git_operation(self, operation, *args, **kwargs):
6677
else:
6778
return 0, command
6879

80+
# pylint: disable=unused-argument
81+
async def git_operation_async(self, operation, *args, **kwargs):
82+
command = self._git_operation_command(operation, args)
83+
if isinstance(command, list):
84+
try:
85+
process = await asyncio.create_subprocess_exec(
86+
*command,
87+
stdout=asyncio.subprocess.PIPE,
88+
stderr=asyncio.subprocess.PIPE
89+
)
90+
stdout, stderr = await process.communicate()
91+
status = process.returncode
92+
output = stdout.decode().strip() if stdout else stderr.decode().strip()
93+
return status, output
94+
except Exception as e:
95+
sys.exit(e)
96+
else:
97+
return 0, command
98+
6999
def config_get_value(self, section, name):
70100
if self._use_module:
71101
config = self.repo.config_reader()

0 commit comments

Comments
 (0)