Skip to content

Commit

Permalink
Merge pull request #24 from sholly/batchfixes
Browse files Browse the repository at this point in the history
Batchfixes - ready for beta testing
  • Loading branch information
jedwards4b committed Jun 12, 2015
2 parents dbb4158 + cd700de commit 4fc908d
Show file tree
Hide file tree
Showing 7 changed files with 193 additions and 35 deletions.
40 changes: 22 additions & 18 deletions machines/template.cesmrun
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,12 @@ sub getOptions()
{
%opts = (
debug => undef,
#sta_ok => undef,
);

GetOptions(
"debug" => \$opts{'debug'},
#"sta_ok" => \$opts{'sta_ok'},
);
}

Expand All @@ -93,6 +95,14 @@ sub doPreRunChecks()
$machroot = $config{'CCSM_MACHDIR'};
$mpilib = $config{'MPILIB'};
$scriptsroot = $config{'SCRIPTSROOT'};
if($config{'DOUT_S'} eq 'TRUE' && ! defined $ENV{'sta_ok'} )
{
print "You are not calling the CESM run script via the CESM submit script. \n";
print "As a result, short-term archiving will not be called automatically. \n";
print "Please submit your CESM run by running the submit script like so: \n";
print "./$case.submit\n";
exit(1);
}

# Change to the case root
chdir($config{'CASEROOT'});
Expand All @@ -108,7 +118,15 @@ sub doPreRunChecks()
scriptsroot => $config{'SCRIPTSROOT'}, caseroot => $config{'CASEROOT'});
$moduleloader->loadModules();

$ENV{'MP_MPILIB'} = $buildenv->getresolved('MPILIB');
my $mpilib = $buildenv->getresolved('MPILIB');
if($mpilib =~ /mpi-serial/)
{
delete $ENV{'MP_MPILIB'};
}
else
{
$ENV{'MP_MPILIB'} = $buildenv->getresolved('MPILIB');
}
$config{'MPILIB'} = $buildenv->getresolved('MPILIB');

print "build complete? $config{'BUILD_COMPLETE'}\n";
Expand Down Expand Up @@ -252,7 +270,7 @@ sub checkInputData()
my $rcbasename = basename($rcfile);
if(! -f "$config{'RUNDIR'}/$rcbasename")
{
symlink($rcfile, $config{'RUNDIR'}) or warn "could not symlink $rcfile to $config{'RUNDIR'}, $!";
symlink($rcfile, "$config{'RUNDIR'}/$rcbasename") or warn "could not symlink $rcfile to $config{'RUNDIR'}/$rcbasename, $!";
}
}

Expand Down Expand Up @@ -416,33 +434,19 @@ sub appendCaseStatus
# check to see if we need to do resubmission from this particular job,
sub resubmitCheck()
{
#if($config{'RESUBMIT'} > 0 && defined $ENV{'islastjob'} && $ENV{'islastjob'} eq 'TRUE')
#{
# my $batchutils = new Batch::BatchUtils(machine => $config{'MACH'}, machroot => $config{'CCSM_MACHDIR'},
# caseroot => $config{'CASEROOT'}, caseconfig => \%config);
# $batchutils->doResubmit();
#}

my $islastjob = 'FALSE';
my $resubmit = $config{'RESUBMIT'};

if(defined $ENV{'islastjob'} && $ENV{'islastjob'} eq 'TRUE')
{
$islastjob = 'TRUE';
}
#if($config{'CONTINUE_RUN'} eq 'TRUE' && $config{'RESUBMIT'} > 0 && defined $ENV{'islastjob'} && $ENV{'islastjob'} eq 'TRUE')
#{
# my $batchutils = Batch::BatchUtilsFactory::getBatchUtils( case => $config{'CASE'}, caseconfig => \%config, caseroot => $config{'CASEROOT'},
# ccsmroot => $config{'CIMEROOT'}, compiler => $config{'COMPILER'}, machine => $config{'MACH'},
# machroot => $config{'CCSM_MACHDIR'}, mpilib => $config{'MPILIB'},
# scriptsroot => $config{'SCRIPTSROOT'} );
# $batchutils->doResubmit($ENV{'islastjob'}, $config{'RESUBMIT'}, $scriptname);
#}

my $batchutils = Batch::BatchUtilsFactory::getBatchUtils( case => $config{'CASE'}, caseconfig => \%config, caseroot => $config{'CASEROOT'},
ccsmroot => $config{'CIMEROOT'}, compiler => $config{'COMPILER'}, machine => $config{'MACH'},
machroot => $config{'CCSM_MACHDIR'}, mpilib => $config{'MPILIB'},
scriptsroot => $config{'SCRIPTSROOT'} );
$batchutils->doResubmit($ENV{'islastjob'}, $config{'RESUBMIT'}, $scriptname);
$batchutils->doResubmit($ENV{'islastjob'}, $config{'RESUBMIT'}, $scriptname, "sta_ok");
}
sub Debug
{
Expand Down
2 changes: 1 addition & 1 deletion machines/template.starchive
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ sub resubmitCheck()
ccsmroot => $config{'CIMEROOT'}, compiler => $config{'COMPILER'}, machine => $config{'MACH'},
machroot => $config{'CCSM_MACHDIR'}, mpilib => $config{'MPILIB'},
scriptsroot => $config{'SCRIPTSROOT'} );
$batchutils->doResubmit($ENV{'islastjob'}, $config{'RESUBMIT'}, $scriptname);
$batchutils->doResubmit($ENV{'islastjob'}, $config{'RESUBMIT'}, $scriptname, "sta_ok");
}
}

Expand Down
8 changes: 8 additions & 0 deletions scripts/Testing/Testcases/SSP_script
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,14 @@ if ($status != 0) then
exit -1
endif

# Run the short-term archiver.. this is a short-term hack until
# a better solution can be found.
./$CASE.st_archive
if($status != 0) then
echo " ERROR: $CASE.st_archive failed ">>& $TESTSTATUS_LOG
exit -1
endif

# must look in short term archiving directory for cpl log files
set CplLogFile = `ls -1t $DOUT_S_ROOT_LOCKED/cpl/logs/cpl.log* | head -1`
if ( $?CplLogFile ) then
Expand Down
2 changes: 1 addition & 1 deletion scripts/Testing/Testcases/config_tests.xml
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@
STOP_OPTION="ndays"
RUN_TYPE="startup"
STOP_N="4"
DOUT_S="TRUE" />
DOUT_S="FALSE" />

<ccsmtest NAME="STA"
DESC="Short-term archiving restart test"
Expand Down
4 changes: 2 additions & 2 deletions scripts/Tools/cesm_submit
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ sub main
ccsmroot => $cimeroot, compiler => $compiler, machine => $machine,
machroot => $machroot, mpilib => $mpilib, scriptsroot => $scriptsroot );

$batchutils->dependencyCheck();
$batchutils->submitJobs();
$batchutils->dependencyCheck("sta_ok");
$batchutils->submitJobs("sta_ok");
}

main(@ARGV) unless caller();
Loading

0 comments on commit 4fc908d

Please sign in to comment.