Skip to content
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

Ltarchive updates #313

Merged
merged 3 commits into from
Nov 23, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cime_config/cesm/archive.xml
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@
<subdir>hist</subdir>
<keep_last_in_rundir>false</keep_last_in_rundir>
</file_extension>
<file_extension suffix=".h\.[\w\-]*\.nc$">
<file_extension suffix=".h\.[\w\-\.]*\.nc$">
<subdir>hist</subdir>
<keep_last_in_rundir>false</keep_last_in_rundir>
</file_extension>
Expand Down
6 changes: 0 additions & 6 deletions cime_config/cesm/machines/config_lt_archive.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,4 @@
<machine name="pleiades-san">
<lt_archive_args>--mode copy_dirs_ssh --ssh_loc lfe --rm_loc_files TRUE</lt_archive_args>
</machine>
<machine name="hobart">
<lt_archive_args></lt_archive_args>
</machine>
<machine name="yellowstone">
<lt_archive_args>--mode copy_files</lt_archive_args>
</machine>
</config_lt_archive>
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,64 @@ my $logger = Log::Log4perl::get_logger();
# global data needed by the script, stuff like the max number of threads,
# -------------------------------------------------------------------------

#-----------------------------------------------------------------------------------------------
# checkRun - check if run is complete
#-----------------------------------------------------------------------------------------------
sub checkRun
{
my $statusFile = shift;
my $runComplete = 0;

$logger->debug("In checkRun...");
#
# check if the run completed successfully
#
if( -f $statusFile )
{
open my $CASESTATUS, "<", "$statusFile" or die qq(lt_archive: unable to open $statusFile. Exiting...\n);
while( <$CASESTATUS> )
{
chomp $_;
if( /^run SUCCESSFUL/ )
{
$runComplete = 1;
}
}
close( $CASESTATUS );
}
}

#-----------------------------------------------------------------------------------------------
# checkSta - check if short term archive is complete
#-----------------------------------------------------------------------------------------------
sub checkSta
{
my $statusFile = shift;
my $staComplete = 0;

$logger->debug("In checkSta...");
#
# check if the short term archive completed successfully
#
if( -f $statusFile )
{
open my $STASTATUS, "<", "$statusFile" or die qq(lt_archive: unable to open $statusFile. Exiting...\n);
while( <$STASTATUS> )
{
chomp $_;
if( /^st_archive process complete/ )
{
$staComplete = 1;
}
}
close( $STASTATUS );
}
}


#-----------------------------------------------------------------------------------------------
# main
#-----------------------------------------------------------------------------------------------
sub main
{
$ENV{'maxthrds'} = 1;
Expand Down Expand Up @@ -71,7 +129,6 @@ sub main
$ENV{DOUT_S_ROOT} = $config{'DOUT_S_ROOT'};
$ENV{DOUT_L_MSROOT} = $config{'DOUT_L_MSROOT'};
$ENV{DOUT_L_HPSS_ACCNT} = $config{'DOUT_L_HPSS_ACCNT'};
$ENV{DOUT_L_SAVE_ALL_ON_DISK} = $config{'DOUT_L_SAVE_ALL_ON_DISK'};

my $LID = strftime("%y%m%d-%H%M%S", localtime);

Expand All @@ -93,14 +150,18 @@ sub main
resubmitCheck();
}

#-----------------------------------------------------------------------------------------------
# resubmitCheck - check if the case needs to be resubmitted
#-----------------------------------------------------------------------------------------------

sub resubmitCheck()
{
if($config{RESUBMIT} > 0)
{
my $submitscript = "$config{CASEROOT}/$config{CASE}.submit";
my $cwd = getcwd;
chdir $config{CASEROOT};
my $resubmitcomand = "$submitscript -resubmit -scriptname $config{'CASE'}.lt_archive";
my $resubmitcommand = "$submitscript -resubmit -scriptname $config{'CASE'}.lt_archive";
$logger->debug(" running resubmit check $resubmitcommand");
if(-e $testlog)
{
Expand Down
35 changes: 15 additions & 20 deletions driver_cpl/cime_config/config_component.xml
Original file line number Diff line number Diff line change
Expand Up @@ -432,25 +432,30 @@
We will not document this further in this guide.</desc>
</entry>

<entry id="DOUT_S_SAVE_EVERY_NTH_RESTART_FILE_SET">
<type>integer</type>
<default_value>0</default_value>
<entry id="DOUT_S_SAVE_DATES_RESTART_FILE_SET">
<type>string</type>
<default_value>all</default_value>
<group>run_data_archive</group>
<file>env_run.xml</file>
<desc>Save every Nth set of restart files and delete all others
If value is greater than 0, then only save the nth restart set in the $DOUT_S_ROOT/$CASE/rest location.
Always preserve the most recent restart set regardless.</desc>
<desc>Comma separated List with dates of the month to save restart file sets in the $DOUT_S_ROOT/$CASE/rest directory.
If one of the list elements is last, then it saves the last day of the month where the date is 28,29,30 or 31
depending on the month. For example, if the list contains 10,20,last, then the corresponding restart sets
saved in $DOUT_S_ROOT/$CASE/rest are 2016-01-10-00000, 2016-01-20-00000, 2016-01-31-00000 for January and
2016-02-10-00000, 2016-02-20-00000, 2016-02-29-00000 for February due to 2016 being a leap year.
If the list is set to none, then all restart sets are deleted.
If the list is set to all (default), then all restart sets are saved.
This variable is used by the clobber_archive script to selectively delete files in the short-term archive locations.</desc>
</entry>

<entry id="DOUT_S_SAVE_ALL_ON_DISK">
<entry id="DOUT_S_CREATE_LINKED_ARCHIVE">
<type>logical</type>
<valid_values>TRUE,FALSE</valid_values>
<default_value>TRUE</default_value>
<group>run_data_archive</group>
<file>env_run.xml</file>
<desc>logical to save contents of the short term archive on disk
If TRUE, create hardlinks from the short term archive $DOUT_S_ROOT.locked/$CASE
directory to the $DOUT_S_ROOT/$CASE directory.</desc>
<desc>Logical to save contents of the short term archive on disk.
If TRUE, create hardlinks from the short term archive $DOUT_S_ROOT/archive.locked/$CASE
directory to the $DOUT_S_ROOT/archive/$CASE directory.</desc>
</entry>

<entry id="DOUT_L_MS">
Expand All @@ -471,16 +476,6 @@
<desc></desc>
</entry>

<entry id="DOUT_L_SAVE_ALL_ON_DISK">
<type>logical</type>
<valid_values>TRUE,FALSE</valid_values>
<default_value>TRUE</default_value>
<group>run_data_archive</group>
<file>env_run.xml</file>
<desc>Save contents of short term archive on disk after the long term archiver has successfully completed
If TRUE, this keeps the output data in DOUT_S_ROOT on disk after the long term (lt_archive.sh) archiver is run.</desc>
</entry>

<!-- ===================================================================== -->
<!-- definitions machines specific -->
<!-- ===================================================================== -->
Expand Down
4 changes: 2 additions & 2 deletions scripts/Tools/case.setup
Original file line number Diff line number Diff line change
Expand Up @@ -280,12 +280,12 @@ if (! $clean ) {
$logger->info("Creating batch script case.st_archive");
$batchmaker->overrideNodeCount(1);
$batchmaker->set({job=>'st_archive'});
$batchmaker->makeBatchScript("$xmlvars{'MACHDIR'}/template.starchive", "$xmlvars{'CASEROOT'}/case.st_archive");
$batchmaker->makeBatchScript("$xmlvars{'MACHDIR'}/template.st_archive", "$xmlvars{'CASEROOT'}/case.st_archive");

$logger->info("Creating batch script case.lt_archive");
$batchmaker->overrideNodeCount(1);
$batchmaker->set({job=>'lt_archive'});
$batchmaker->makeBatchScript("$xmlvars{'MACHDIR'}/template.ltarchive", "$xmlvars{'CASEROOT'}/case.lt_archive");
$batchmaker->makeBatchScript("$xmlvars{'MACHDIR'}/template.lt_archive", "$xmlvars{'CASEROOT'}/case.lt_archive");

# Make a copy of env_mach_pes.xml in order to be able
# to check that it does not change once case.setup is invoked
Expand Down
18 changes: 3 additions & 15 deletions scripts/Tools/lt_archive.sh
Original file line number Diff line number Diff line change
Expand Up @@ -182,24 +182,14 @@ if [ "$mode" == "copy_dirs_hsi" ]; then
exit -1
fi

# Long-term archiver for HPSS (Trey White, December 6, 2011)
date

if [ ! $?DOUT_L_HPSS_ACCNT ]; then
DOUT_L_HPSS_ACCNT=0
fi

# check if files on st_archive should be saved or not
saveFlag="-dPR"
if [ $DOUT_L_SAVE_ALL_ON_DISK == "TRUE" ] ; then
saveFlag="-PR"
fi

# send files to HPSS and delete upon success
# send files to HPSS
saveFlag="-PR"
cd $DOUT_S_ROOT
hsiArgs="mkdir -p $DOUT_L_MSROOT ; chmod +t $DOUT_L_MSROOT ; cd $DOUT_L_MSROOT ; put $saveFlag *"
# echo $hsiArgs
if [ $DOUT_L_HPSS_ACCNT -gt 0 ]; then
if ! [[ "$DOUT_L_HPSS_ACCNT" =~ "0000*" ]]; then
hsi -a $DOUT_L_HPSS_ACCNT "$hsiArgs"
else
hsi "$hsiArgs"
Expand Down Expand Up @@ -317,8 +307,6 @@ if [ "$mode" == "copy_dirs_local" ]; then
rm -f ${file}
else
echo "local file and long-term archive file are NOT the same size... ${file} will remain on local disk"
#exit -1 #??? ask francis if this is right
# Not sure what to do here... maybe make the log entry and carry on...
fi
fi
done # for file
Expand Down
Loading