Skip to content

Commit

Permalink
Merge branch 'jgfouca/update_to_cime_5.3.0.34' into next (PR #1788)
Browse files Browse the repository at this point in the history
Merge #4 for this PR.

* jgfouca/update_to_cime_5.3.0.34:
  Fix jenkins script mistake made during conflict resolution.
  • Loading branch information
jgfouca committed Oct 4, 2017
2 parents 1102686 + 22fe660 commit 808389a
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions cime/scripts/lib/CIME/case_st_archive.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,18 +72,18 @@ def _get_file_date(filename):
# TODO: Add these to config_archive.xml, instead of here
# Note these must be in order of most specific to least
# so that lesser specificities aren't used to parse greater ones
re_formats = ["[0-9]{4}-[0-9]{1,2}-[0-9]{1,2}_[0-9]{1,2}\.[0-9]{1,2}\.[0-9]{1,2}", # yyyy-mm-dd_hh.MM.ss
"[0-9]{4}-[0-9]{1,2}-[0-9]{1,2}[\-_][0-9]{1,5}", # yyyy-mm-dd_sssss
"[0-9]{4}-[0-9]{1,2}-[0-9]{1,2}", # yyyy-mm-dd
"[0-9]{4}[\-\.][0-9]{1,2}", # yyyy-mm
re_formats = [r"[0-9]{4}-[0-9]{1,2}-[0-9]{1,2}_[0-9]{1,2}\.[0-9]{1,2}\.[0-9]{1,2}", # yyyy-mm-dd_hh.MM.ss
r"[0-9]{4}-[0-9]{1,2}-[0-9]{1,2}[\-_][0-9]{1,5}", # yyyy-mm-dd_sssss
r"[0-9]{4}-[0-9]{1,2}-[0-9]{1,2}", # yyyy-mm-dd
r"[0-9]{4}[\-\.][0-9]{1,2}", # yyyy-mm
]

for re_str in re_formats:
match = re.search(re_str, filename)
if match is None:
continue
date_str = match.group()
date_tuple = [int(unit) for unit in re.split("-|_|\.", date_str)]
date_tuple = [int(unit) for unit in re.split(r"-|_|\.", date_str)]
year = date_tuple[0]
month = date_tuple[1]
day = 1
Expand Down Expand Up @@ -193,9 +193,6 @@ def _archive_rpointer_files(casename, ninst_strings, rundir, save_interim_restar
archive_entry, archive_restdir, datename, datename_is_last):
###############################################################################

# archive the rpointer files associated with datename
compclass = archive.get_entry_info(archive_entry)[1]

if datename_is_last:
# Copy of all rpointer files for latest restart date
rpointers = glob.glob(os.path.join(rundir, 'rpointer.*'))
Expand Down Expand Up @@ -590,7 +587,7 @@ def restore_from_archive(case, rest_dir=None):
shutil.copy(item, rundir)

###############################################################################
def archive_last_restarts(case, archive_restdir, link_to_restart_files=False):
def archive_last_restarts(case, archive_restdir, last_date=None, link_to_restart_files=False):
###############################################################################
"""
Convenience function for archiving just the last set of restart
Expand Down Expand Up @@ -618,6 +615,7 @@ def archive_last_restarts(case, archive_restdir, link_to_restart_files=False):
archive=archive,
datename=last_datename,
datename_is_last=True,
last_date=last_date,
archive_restdir=archive_restdir,
archive_file_fn=archive_file_fn,
link_to_last_restart_files=link_to_restart_files)
Expand Down

0 comments on commit 808389a

Please sign in to comment.