Skip to content

Commit 3012a95

Browse files
authored
Merge pull request #97 from mvdebolskiy/rpointers-update-cime
Rpointers update cime
2 parents 8d3198c + dd1b016 commit 3012a95

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+2697
-589
lines changed

.git-blame-ignore-revs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
# Migrated code style to Black
22
eabf877cbb86b281fdd37a3fa3cc0edf9b8eb874
33
321463922724b225988e517da54a18bad90bc316
4+
6751504adf095d5d034e6406fbb0e914924aecff

.github/workflows/docs.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
runs-on: ubuntu-latest
2626
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
2727
steps:
28-
- uses: actions/checkout@v3
28+
- uses: actions/checkout@v4
2929
with:
3030
ref: 'gh-pages'
3131
fetch-depth: 0
@@ -64,17 +64,17 @@ jobs:
6464
name: Build and deploy documentation
6565
runs-on: ubuntu-latest
6666
steps:
67-
- uses: actions/checkout@v3
67+
- uses: actions/checkout@v4
6868
with:
6969
fetch-depth: 0
7070
lfs: true
7171
- name: Install python 3.x
72-
uses: actions/setup-python@v2
72+
uses: actions/setup-python@v5
7373
with:
7474
python-version: '3.x'
7575
# https://github.com/actions/cache/blob/main/examples.md#python---pip
7676
- name: Cache pip
77-
uses: actions/cache@v3
77+
uses: actions/cache@v4
7878
with:
7979
path: ~/.cache/pip
8080
key: ${{ runner.os }}-pip-${{ hashFiles('doc/requirements.txt') }}
@@ -91,7 +91,7 @@ jobs:
9191
if: |
9292
github.event_name == 'pull_request' &&
9393
github.event.pull_request.head.repo.full_name == github.repository
94-
uses: peaceiris/actions-gh-pages@v3
94+
uses: peaceiris/actions-gh-pages@v4
9595
with:
9696
github_token: ${{secrets.GITHUB_TOKEN}}
9797
publish_dir: './_build/html'

.github/workflows/testing.yml

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -76,15 +76,14 @@ jobs:
7676
timeout-minutes: 2
7777
steps:
7878
- name: Checkout code
79-
uses: actions/checkout@v3
79+
uses: actions/checkout@v4
8080
- name: Set up python
81-
uses: actions/setup-python@v2
81+
uses: actions/setup-python@v5
8282
with:
83-
python-version: 3.9
83+
python-version: '3.10'
8484
- name: Runs pre-commit
8585
run: |
8686
pip install pre-commit
87-
8887
pre-commit run -a
8988
9089
# Runs unit testing under different python versions.
@@ -98,11 +97,12 @@ jobs:
9897
username: ${{ github.actor }}
9998
password: ${{ secrets.GITHUB_TOKEN }}
10099
strategy:
100+
fail-fast: false
101101
matrix:
102-
python-version: ['3.8', '3.9', '3.10']
102+
python-version: ["3.8", "3.10", "3.12"]
103103
steps:
104104
- name: Checkout code
105-
uses: actions/checkout@v3
105+
uses: actions/checkout@v4
106106
- name: Run tests
107107
shell: bash
108108
env:
@@ -118,6 +118,8 @@ jobs:
118118
# from 'entrypoint.sh', create and activate new environment
119119
create_environment ${{ matrix.python-version }}
120120
121+
pip install -r test-requirements.txt
122+
121123
# GitHub runner home is different than container
122124
cp -rf /root/.cime /github/home/
123125
@@ -151,7 +153,7 @@ jobs:
151153
- name: Checkout code
152154
uses: actions/checkout@v3
153155
- name: Cache inputdata
154-
uses: actions/cache@v2
156+
uses: actions/cache@v3
155157
with:
156158
path: /storage/inputdata
157159
key: inputdata-2
@@ -162,6 +164,8 @@ jobs:
162164
CIME_DRIVER: ${{ matrix.driver }}
163165
CIME_TEST_PLATFORM: ubuntu-latest
164166
run: |
167+
pip install -r test-requirements.txt
168+
165169
export CIME_REMOTE=https://github.com/${{ github.event.pull_request.head.repo.full_name || github.repository }}
166170
export CIME_BRANCH=${GITHUB_HEAD_REF:-${GITHUB_REF##*/}}
167171
@@ -195,7 +199,7 @@ jobs:
195199
# https://docs.github.com/en/actions/managing-workflow-runs/downloading-workflow-artifacts
196200
- name: Upload testing logs
197201
if: ${{ failure() }}
198-
uses: actions/upload-artifact@v3
202+
uses: actions/upload-artifact@v4
199203
with:
200204
name: testing-logs-${{ github.run_number }}-${{ matrix.model }}-${{ matrix.driver }}
201205
path: /testing-logs-${{ github.run_number}}-${{ matrix.model }}-${{ matrix.driver }}.tar.gz

CIME/SystemTests/eri.py

Lines changed: 33 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""
22
CIME ERI test This class inherits from SystemTestsCommon
33
"""
4+
45
from CIME.XML.standard_module_setup import *
56
from CIME.utils import safe_copy
67
from CIME.SystemTests.system_tests_common import SystemTestsCommon
@@ -34,8 +35,8 @@ def _helper(dout_sr, refdate, refsec, rundir):
3435
os.mkdir(rundir)
3536
elif os.path.exists(dst):
3637
os.remove(dst)
37-
38-
os.symlink(item, dst)
38+
if not "rpointer" in item:
39+
os.symlink(item, dst)
3940

4041
for item in glob.glob("{}/*rpointer*".format(rest_path)):
4142
safe_copy(item, rundir)
@@ -83,7 +84,7 @@ def run_phase(self):
8384
start_1 = run_startdate
8485

8586
stop_n2 = stop_n - stop_n1
86-
rest_n2 = int(stop_n2 / 2 + 1)
87+
8788
hist_n = stop_n2
8889

8990
start_1_year, start_1_month, start_1_day = [
@@ -93,10 +94,28 @@ def run_phase(self):
9394
start_2 = "{:04d}-{:02d}-{:02d}".format(
9495
start_2_year, start_1_month, start_1_day
9596
)
97+
rest_n2 = self._set_restart_interval(
98+
stop_n=stop_n2,
99+
stop_option=stop_option,
100+
startdate=start_2,
101+
starttime=start_tod,
102+
)
96103

97104
stop_n3 = stop_n2 - rest_n2
98-
rest_n3 = int(stop_n3 / 2 + 1)
99105

106+
ninst = self._case.get_value("NINST")
107+
drvrest = "rpointer.cpl"
108+
if ninst is not None and ninst > 1:
109+
drvrest += "_0001"
110+
drvrest += self._rest_time
111+
self._set_drv_restart_pointer(drvrest)
112+
113+
rest_n3 = self._set_restart_interval(
114+
stop_n=stop_n3,
115+
stop_option=stop_option,
116+
startdate=start_2,
117+
starttime=start_tod,
118+
)
100119
stop_n4 = stop_n3 - rest_n3
101120

102121
expect(stop_n4 >= 1 and stop_n1 >= 1, "Run length too short")
@@ -223,8 +242,10 @@ def run_phase(self):
223242
self._case.set_value("GET_REFCASE", False)
224243
self._case.set_value("CONTINUE_RUN", False)
225244
self._case.set_value("STOP_N", stop_n3)
226-
self._case.set_value("REST_OPTION", stop_option)
227-
self._case.set_value("REST_N", rest_n3)
245+
self._set_restart_interval(
246+
stop_n=stop_n3, startdate=refdate_3, starttime=refsec_3
247+
)
248+
228249
self._case.set_value("HIST_OPTION", stop_option)
229250
self._case.set_value("HIST_N", stop_n2)
230251
self._case.set_value("DOUT_S", False)
@@ -266,6 +287,12 @@ def run_phase(self):
266287
self._case.set_value("DOUT_S", False)
267288
self._case.set_value("HIST_OPTION", stop_option)
268289
self._case.set_value("HIST_N", hist_n)
290+
drvrest = "rpointer.cpl"
291+
if ninst is not None and ninst > 1:
292+
drvrest += "_0001"
293+
drvrest += self._rest_time
294+
295+
self._set_drv_restart_pointer(drvrest)
269296
self._case.flush()
270297

271298
# do the restart run (short term archiving is off)

CIME/SystemTests/err.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import glob, os
66
from CIME.XML.standard_module_setup import *
77
from CIME.SystemTests.restart_tests import RestartTest
8-
from CIME.utils import ls_sorted_by_mtime, safe_copy
8+
from CIME.utils import safe_copy
99

1010
logger = logging.getLogger(__name__)
1111

@@ -35,12 +35,11 @@ def _case_two_setup(self):
3535

3636
def _case_two_custom_prerun_action(self):
3737
dout_s_root = self._case1.get_value("DOUT_S_ROOT")
38-
rest_root = os.path.abspath(os.path.join(dout_s_root, "rest"))
39-
restart_list = ls_sorted_by_mtime(rest_root)
40-
expect(len(restart_list) >= 1, "No restart files found in {}".format(rest_root))
41-
self._case.restore_from_archive(
42-
rest_dir=os.path.join(rest_root, restart_list[0])
43-
)
38+
self._drv_restart_pointer = self._case2.get_value("DRV_RESTART_POINTER")
39+
resttime = self._drv_restart_pointer[-16:]
40+
rest_root = os.path.abspath(os.path.join(dout_s_root, "rest", resttime))
41+
expect(os.path.isdir(rest_root), "None such directory {}".format(rest_root))
42+
self._case.restore_from_archive(rest_dir=rest_root)
4443

4544
def _case_two_custom_postrun_action(self):
4645
# Link back to original case1 name

CIME/SystemTests/ers.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ def __init__(self, case, **kwargs):
1717

1818
def _ers_first_phase(self):
1919
self._rest_n = self._set_restart_interval()
20+
# set_restart_interval can change case settings that buildnmls may depend on
21+
# so ensure buildnmls will not be skipped during case_run
22+
self._skip_pnl = False
2023
self.run_indv()
2124

2225
def _ers_second_phase(self):
@@ -36,7 +39,13 @@ def _ers_second_phase(self):
3639
pfile,
3740
os.path.join(os.path.dirname(pfile), "run1." + os.path.basename(pfile)),
3841
)
42+
ninst = self._case.get_value("NINST")
43+
drvrest = "rpointer.cpl"
44+
if ninst is not None and ninst > 1:
45+
drvrest += "_0001"
46+
drvrest += self._rest_time
3947

48+
self._set_drv_restart_pointer(drvrest)
4049
self._case.set_value("HIST_N", stop_n)
4150
self._case.set_value("STOP_N", stop_new)
4251
self._case.set_value("CONTINUE_RUN", True)

0 commit comments

Comments
 (0)