Skip to content

Commit 4fc908d

Browse files
committed
Merge pull request #24 from sholly/batchfixes
Batchfixes - ready for beta testing
2 parents dbb4158 + cd700de commit 4fc908d

File tree

7 files changed

+193
-35
lines changed

7 files changed

+193
-35
lines changed

machines/template.cesmrun

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,12 @@ sub getOptions()
6969
{
7070
%opts = (
7171
debug => undef,
72+
#sta_ok => undef,
7273
);
7374

7475
GetOptions(
7576
"debug" => \$opts{'debug'},
77+
#"sta_ok" => \$opts{'sta_ok'},
7678
);
7779
}
7880

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

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

111-
$ENV{'MP_MPILIB'} = $buildenv->getresolved('MPILIB');
121+
my $mpilib = $buildenv->getresolved('MPILIB');
122+
if($mpilib =~ /mpi-serial/)
123+
{
124+
delete $ENV{'MP_MPILIB'};
125+
}
126+
else
127+
{
128+
$ENV{'MP_MPILIB'} = $buildenv->getresolved('MPILIB');
129+
}
112130
$config{'MPILIB'} = $buildenv->getresolved('MPILIB');
113131

114132
print "build complete? $config{'BUILD_COMPLETE'}\n";
@@ -252,7 +270,7 @@ sub checkInputData()
252270
my $rcbasename = basename($rcfile);
253271
if(! -f "$config{'RUNDIR'}/$rcbasename")
254272
{
255-
symlink($rcfile, $config{'RUNDIR'}) or warn "could not symlink $rcfile to $config{'RUNDIR'}, $!";
273+
symlink($rcfile, "$config{'RUNDIR'}/$rcbasename") or warn "could not symlink $rcfile to $config{'RUNDIR'}/$rcbasename, $!";
256274
}
257275
}
258276

@@ -416,33 +434,19 @@ sub appendCaseStatus
416434
# check to see if we need to do resubmission from this particular job,
417435
sub resubmitCheck()
418436
{
419-
#if($config{'RESUBMIT'} > 0 && defined $ENV{'islastjob'} && $ENV{'islastjob'} eq 'TRUE')
420-
#{
421-
# my $batchutils = new Batch::BatchUtils(machine => $config{'MACH'}, machroot => $config{'CCSM_MACHDIR'},
422-
# caseroot => $config{'CASEROOT'}, caseconfig => \%config);
423-
# $batchutils->doResubmit();
424-
#}
425-
426437
my $islastjob = 'FALSE';
427438
my $resubmit = $config{'RESUBMIT'};
428439

429440
if(defined $ENV{'islastjob'} && $ENV{'islastjob'} eq 'TRUE')
430441
{
431442
$islastjob = 'TRUE';
432443
}
433-
#if($config{'CONTINUE_RUN'} eq 'TRUE' && $config{'RESUBMIT'} > 0 && defined $ENV{'islastjob'} && $ENV{'islastjob'} eq 'TRUE')
434-
#{
435-
# my $batchutils = Batch::BatchUtilsFactory::getBatchUtils( case => $config{'CASE'}, caseconfig => \%config, caseroot => $config{'CASEROOT'},
436-
# ccsmroot => $config{'CIMEROOT'}, compiler => $config{'COMPILER'}, machine => $config{'MACH'},
437-
# machroot => $config{'CCSM_MACHDIR'}, mpilib => $config{'MPILIB'},
438-
# scriptsroot => $config{'SCRIPTSROOT'} );
439-
# $batchutils->doResubmit($ENV{'islastjob'}, $config{'RESUBMIT'}, $scriptname);
440-
#}
444+
441445
my $batchutils = Batch::BatchUtilsFactory::getBatchUtils( case => $config{'CASE'}, caseconfig => \%config, caseroot => $config{'CASEROOT'},
442446
ccsmroot => $config{'CIMEROOT'}, compiler => $config{'COMPILER'}, machine => $config{'MACH'},
443447
machroot => $config{'CCSM_MACHDIR'}, mpilib => $config{'MPILIB'},
444448
scriptsroot => $config{'SCRIPTSROOT'} );
445-
$batchutils->doResubmit($ENV{'islastjob'}, $config{'RESUBMIT'}, $scriptname);
449+
$batchutils->doResubmit($ENV{'islastjob'}, $config{'RESUBMIT'}, $scriptname, "sta_ok");
446450
}
447451
sub Debug
448452
{

machines/template.starchive

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ sub resubmitCheck()
5858
ccsmroot => $config{'CIMEROOT'}, compiler => $config{'COMPILER'}, machine => $config{'MACH'},
5959
machroot => $config{'CCSM_MACHDIR'}, mpilib => $config{'MPILIB'},
6060
scriptsroot => $config{'SCRIPTSROOT'} );
61-
$batchutils->doResubmit($ENV{'islastjob'}, $config{'RESUBMIT'}, $scriptname);
61+
$batchutils->doResubmit($ENV{'islastjob'}, $config{'RESUBMIT'}, $scriptname, "sta_ok");
6262
}
6363
}
6464

scripts/Testing/Testcases/SSP_script

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,14 @@ if ($status != 0) then
6060
exit -1
6161
endif
6262

63+
# Run the short-term archiver.. this is a short-term hack until
64+
# a better solution can be found.
65+
./$CASE.st_archive
66+
if($status != 0) then
67+
echo " ERROR: $CASE.st_archive failed ">>& $TESTSTATUS_LOG
68+
exit -1
69+
endif
70+
6371
# must look in short term archiving directory for cpl log files
6472
set CplLogFile = `ls -1t $DOUT_S_ROOT_LOCKED/cpl/logs/cpl.log* | head -1`
6573
if ( $?CplLogFile ) then

scripts/Testing/Testcases/config_tests.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@
174174
STOP_OPTION="ndays"
175175
RUN_TYPE="startup"
176176
STOP_N="4"
177-
DOUT_S="TRUE" />
177+
DOUT_S="FALSE" />
178178

179179
<ccsmtest NAME="STA"
180180
DESC="Short-term archiving restart test"

scripts/Tools/cesm_submit

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ sub main
4343
ccsmroot => $cimeroot, compiler => $compiler, machine => $machine,
4444
machroot => $machroot, mpilib => $mpilib, scriptsroot => $scriptsroot );
4545

46-
$batchutils->dependencyCheck();
47-
$batchutils->submitJobs();
46+
$batchutils->dependencyCheck("sta_ok");
47+
$batchutils->submitJobs("sta_ok");
4848
}
4949

5050
main(@ARGV) unless caller();

0 commit comments

Comments
 (0)