From d7f77bea1fce72626b6a9f2f9ba78f861047b088 Mon Sep 17 00:00:00 2001 From: Robert Jacob Date: Tue, 21 Mar 2017 14:32:39 -0500 Subject: [PATCH 1/4] Change regex for mpaso and mpascice files Change regex for matching the hist and rst files for mpaso and mpascice. Should also do this for mpasli eventually. --- cime/cime_config/acme/config_archive.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cime/cime_config/acme/config_archive.xml b/cime/cime_config/acme/config_archive.xml index a4843a2b5724..21ddac0e28a1 100644 --- a/cime/cime_config/acme/config_archive.xml +++ b/cime/cime_config/acme/config_archive.xml @@ -53,8 +53,8 @@ - \.rst.* - \.hist.* + \.rst.*\.*\.*\.nc + \.hist.*\.*\.*\.nc unset rpointer.ice @@ -76,8 +76,8 @@ - \.rst.* - \.hist.* + \.rst.*\.*\.*\.nc + \.hist.*\.*\.*\.nc unset rpointer.ocn From e962f6ca19de1ab831f1aada910979da74d899fe Mon Sep 17 00:00:00 2001 From: Robert Jacob Date: Tue, 21 Mar 2017 14:34:49 -0500 Subject: [PATCH 2/4] Add ability to handle mpas files mpas files currently don't include the casename so add logic to handle that for history and restart. Later include mpasli. --- cime/utils/python/CIME/case_st_archive.py | 45 +++++++++++++++-------- 1 file changed, 29 insertions(+), 16 deletions(-) diff --git a/cime/utils/python/CIME/case_st_archive.py b/cime/utils/python/CIME/case_st_archive.py index 24fa71d65a10..d6eec4b283d3 100755 --- a/cime/utils/python/CIME/case_st_archive.py +++ b/cime/utils/python/CIME/case_st_archive.py @@ -149,6 +149,10 @@ def _archive_history_files(case, archive, archive_entry, for i in range(ninst): if compname == 'dart': newsuffix = casename + suffix + elif compname == "mpaso": + newsuffix = compname + ".*" + suffix + elif compname == "mpascice": + newsuffix = compname + ".*" + suffix else: if ninst_string: newsuffix = casename + '.' + compname + ".*" + ninst_string[i] + suffix @@ -231,22 +235,31 @@ def _archive_restarts(case, archive, archive_entry, for suffix in archive.get_rest_file_extensions(archive_entry): for i in range(ninst): restfiles = "" - pattern = r"%s\.%s\d*.*" % (casename, compname) - if pattern != "dart": - pfile = re.compile(pattern) - files = [f for f in os.listdir(rundir) if pfile.search(f)] - if ninst_strings: - pattern = ninst_strings[i] + suffix + datename - pfile = re.compile(pattern) - restfiles = [f for f in files if pfile.search(f)] - else: - pattern = suffix + datename - pfile = re.compile(pattern) - restfiles = [f for f in files if pfile.search(f)] - else: - pattern = suffix - pfile = re.compile(pattern) - restfiles = [f for f in os.listdir(rundir) if pfile.search(f)] + if compname == "mpaso": + pattern = r"mpaso.rst\d*.*" + pfile = re.compile(pattern) + restfiles = [f for f in os.listdir(rundir) if pfile.search(f)] + elif compname == "mpascice": + pattern = r"mpascice.rst\d*.*" + pfile = re.compile(pattern) + restfiles = [f for f in os.listdir(rundir) if pfile.search(f)] + else: + pattern = r"%s\.%s\d*.*" % (casename, compname) + if pattern != "dart": + pfile = re.compile(pattern) + files = [f for f in os.listdir(rundir) if pfile.search(f)] + if ninst_strings: + pattern = ninst_strings[i] + suffix + datename + pfile = re.compile(pattern) + restfiles = [f for f in files if pfile.search(f)] + else: + pattern = suffix + datename + pfile = re.compile(pattern) + restfiles = [f for f in files if pfile.search(f)] + else: + pattern = suffix + pfile = re.compile(pattern) + restfiles = [f for f in os.listdir(rundir) if pfile.search(f)] for restfile in restfiles: restfile = os.path.basename(restfile) From 1fa61890e00b0196e16ea52841ceb01c2435ae0c Mon Sep 17 00:00:00 2001 From: Robert Jacob Date: Sun, 16 Apr 2017 23:43:10 -0500 Subject: [PATCH 3/4] Add ability to archive MPAS land ice files Add "mpasli" to the files given special handling. --- cime/utils/python/CIME/case_st_archive.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cime/utils/python/CIME/case_st_archive.py b/cime/utils/python/CIME/case_st_archive.py index d6eec4b283d3..9f60aae3b741 100755 --- a/cime/utils/python/CIME/case_st_archive.py +++ b/cime/utils/python/CIME/case_st_archive.py @@ -153,6 +153,8 @@ def _archive_history_files(case, archive, archive_entry, newsuffix = compname + ".*" + suffix elif compname == "mpascice": newsuffix = compname + ".*" + suffix + elif compname == "mpasli": + newsuffix = compname + ".*" + suffix else: if ninst_string: newsuffix = casename + '.' + compname + ".*" + ninst_string[i] + suffix @@ -243,6 +245,10 @@ def _archive_restarts(case, archive, archive_entry, pattern = r"mpascice.rst\d*.*" pfile = re.compile(pattern) restfiles = [f for f in os.listdir(rundir) if pfile.search(f)] + elif compname == "mpasli": + pattern = r"mpasli.rst\d*.*" + pfile = re.compile(pattern) + restfiles = [f for f in os.listdir(rundir) if pfile.search(f)] else: pattern = r"%s\.%s\d*.*" % (casename, compname) if pattern != "dart": From 8bbd3c4446131c8629fec646095d88891ca8b66e Mon Sep 17 00:00:00 2001 From: Jason Sarich Date: Thu, 27 Apr 2017 14:06:00 -0500 Subject: [PATCH 4/4] fix mpas pattern matching so only interim restart files are deleted --- cime/cime_config/acme/config_archive.xml | 4 +- cime/utils/python/CIME/case_st_archive.py | 58 +++++++++-------------- 2 files changed, 25 insertions(+), 37 deletions(-) diff --git a/cime/cime_config/acme/config_archive.xml b/cime/cime_config/acme/config_archive.xml index 21ddac0e28a1..4e4da13e6c3d 100644 --- a/cime/cime_config/acme/config_archive.xml +++ b/cime/cime_config/acme/config_archive.xml @@ -53,7 +53,7 @@ - \.rst.*\.*\.*\.nc + \.rst.* \.hist.*\.*\.*\.nc unset @@ -76,7 +76,7 @@ - \.rst.*\.*\.*\.nc + \.rst.* \.hist.*\.*\.*\.nc unset diff --git a/cime/utils/python/CIME/case_st_archive.py b/cime/utils/python/CIME/case_st_archive.py index 9f60aae3b741..9386668d3f7c 100755 --- a/cime/utils/python/CIME/case_st_archive.py +++ b/cime/utils/python/CIME/case_st_archive.py @@ -149,12 +149,8 @@ def _archive_history_files(case, archive, archive_entry, for i in range(ninst): if compname == 'dart': newsuffix = casename + suffix - elif compname == "mpaso": - newsuffix = compname + ".*" + suffix - elif compname == "mpascice": - newsuffix = compname + ".*" + suffix - elif compname == "mpasli": - newsuffix = compname + ".*" + suffix + elif compname.find('mpas') == 0: + newsuffix = compname + '.*' + suffix else: if ninst_string: newsuffix = casename + '.' + compname + ".*" + ninst_string[i] + suffix @@ -237,35 +233,27 @@ def _archive_restarts(case, archive, archive_entry, for suffix in archive.get_rest_file_extensions(archive_entry): for i in range(ninst): restfiles = "" - if compname == "mpaso": - pattern = r"mpaso.rst\d*.*" - pfile = re.compile(pattern) - restfiles = [f for f in os.listdir(rundir) if pfile.search(f)] - elif compname == "mpascice": - pattern = r"mpascice.rst\d*.*" - pfile = re.compile(pattern) - restfiles = [f for f in os.listdir(rundir) if pfile.search(f)] - elif compname == "mpasli": - pattern = r"mpasli.rst\d*.*" - pfile = re.compile(pattern) - restfiles = [f for f in os.listdir(rundir) if pfile.search(f)] - else: - pattern = r"%s\.%s\d*.*" % (casename, compname) - if pattern != "dart": - pfile = re.compile(pattern) - files = [f for f in os.listdir(rundir) if pfile.search(f)] - if ninst_strings: - pattern = ninst_strings[i] + suffix + datename - pfile = re.compile(pattern) - restfiles = [f for f in files if pfile.search(f)] - else: - pattern = suffix + datename - pfile = re.compile(pattern) - restfiles = [f for f in files if pfile.search(f)] - else: - pattern = suffix - pfile = re.compile(pattern) - restfiles = [f for f in os.listdir(rundir) if pfile.search(f)] + if compname.find("mpas") == 0: + pattern = compname + suffix + '_'.join(datename.rsplit('-', 1)) + pfile = re.compile(pattern) + restfiles = [f for f in os.listdir(rundir) if pfile.search(f)] + else: + pattern = r"%s\.%s\d*.*" % (casename, compname) + if pattern != "dart": + pfile = re.compile(pattern) + files = [f for f in os.listdir(rundir) if pfile.search(f)] + if ninst_strings: + pattern = ninst_strings[i] + suffix + datename + pfile = re.compile(pattern) + restfiles = [f for f in files if pfile.search(f)] + else: + pattern = suffix + datename + pfile = re.compile(pattern) + restfiles = [f for f in files if pfile.search(f)] + else: + pattern = suffix + pfile = re.compile(pattern) + restfiles = [f for f in os.listdir(rundir) if pfile.search(f)] for restfile in restfiles: restfile = os.path.basename(restfile)