Skip to content

Commit 3fd2553

Browse files
committed
Update the runjob and checkinput perl scripts to set $ESMABIN equal to their directory location rather than using a hard-coded value. This will allow the scripts to work correctly if the build's install directory location is changed.
An option was added to the runjob script to call checkinput. This gives more visibility to the checkinput script.
1 parent 2bea371 commit 3fd2553

File tree

2 files changed

+62
-29
lines changed

2 files changed

+62
-29
lines changed

src/Applications/GEOSdas_App/testsuites/checkinput.pl

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,15 @@
11
#!/usr/bin/env perl
22
#=======================================================================
33
# name - checkinput.pl
4-
# purpose - make a .input file for fvsetup which is readable by runjob
4+
# purpose - check that the inputs in a *.input file match the prompts
5+
# from fvsetup
6+
# Notes:
7+
# 1. This script will create a new input file which can be compared to
8+
# the original to verify that the prompt/input matches are correct.
9+
# 2. The input files use the following name format: expid.input
10+
# 3. If no input files are specified, then this script will find all
11+
# possible input files and query the user to identify which to check.
12+
# 4. The checkinput script must be run from the build's bin directory
513
#
614
# revision history
715
# 18Jun2010 Stassi Initial version
@@ -63,8 +71,8 @@ sub init {
6371
#----------------------------------
6472
$codeID = "@GIT_TAG_OR_REV@";
6573
$fvsetupID = "@fvID@";
66-
$ESMABIN = "@ESMABIN@";
67-
$ESMATST = "@ESMATST@";
74+
$ESMABIN = "$FindBin::Bin";
75+
$ESMATST = "$FindBin::Bin/../etc/testsuites";
6876
die ">> Error << $ESMABIN is not a directory;" unless -d $ESMABIN;
6977

7078
# get runtime options

src/Applications/GEOSdas_App/testsuites/runjob.pl

Lines changed: 51 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@
44
# purpose - setup and submit jobs using pre-defined sets of inputs
55
# to the fvsetup script
66
# Notes:
7-
# 1. Each job should have an input file with the name format: expid.input
8-
# 2. This script finds all possible input files, and queries the user to
9-
# identify which job to run.
7+
# 1. This script runs a DAS job using an input file.
8+
# 2. The input files use the following name format: expid.input
9+
# 3. If no input files are specified, then this script will find all
10+
# possible input files, and query the user to identify which job to run.
11+
# 4. The runjob script must be run from the build's bin directory
1012
#
1113
# global hashes (keys are integers associated with each input file):
1214
# - %inFile ...... names of *.input files
@@ -38,10 +40,10 @@
3840
# global variables
3941
#-----------------
4042
my ($ESMABIN, $ESMATST, $TRYAGAIN);
41-
my ($auto, $autox, $codeID, $dbqueue, $debug);
43+
my ($auto, $autox, $checkinput, $codeID, $dbqueue, $debug);
4244
my ($fvroot, $fvsetupID, $fvsetupScript);
4345
my ($ignoreOSdiff, $inputDir, $jobn, $nocheck, $nofilter, $noloop);
44-
my ($sel, $siteID, $specified, $stage, $verbose);
46+
my ($params, $sel, $siteID, $specified, $stage, $verbose);
4547
my (%descript, %edits, %expid, %flags, %fvhome, %fvics, %fvid);
4648
my (%inFile, %rawInFile, %rem_acct);
4749
my (@default, @inputFiles, @nondefault);
@@ -50,6 +52,10 @@
5052
#-------------
5153
{
5254
init();
55+
if ($checkinput) {
56+
call_checkinput();
57+
exit;
58+
}
5359
intro();
5460
checkOS();
5561
getInputDir();
@@ -62,11 +68,8 @@
6268
# purpose - initialize global hashes
6369
#
6470
# Notes on where to find fvsetup -
65-
# 1. The variable, $ESMABIN, contains the directory location for the
66-
# fvsetup script. This value is hard-coded during the build.
67-
# 2. This script is fvsetupID-dependent; it may not work properly for different
68-
# versions of fvsetup which have differences in the prompts.
69-
# 3. $ESMABIN can be overwritten by using the -D flag to supply an alternate
71+
# 1. This script should be in the same directory as the fvsetup script.
72+
# 2. $ESMABIN can be overwritten by using the -D flag to supply an alternate
7073
# location for fvsetup. This should be done with great care.
7174
#=======================================================================
7275
sub init {
@@ -76,7 +79,7 @@ sub init {
7679
use Getopt::Long;
7780
use GMAO_utils ("get_siteID");
7881

79-
my ($BINDIR, $localdir, $help);
82+
my ($BINDIR, $localdir, $help, $pp);
8083

8184
$TRYAGAIN = 9999;
8285
$siteID = get_siteID();
@@ -86,26 +89,35 @@ sub init {
8689
#--------------------------------------------------------
8790
$codeID = "@GIT_TAG_OR_REV@";
8891
$fvsetupID = "@fvID@";
89-
$ESMABIN = "@ESMABIN@";
90-
$ESMATST = "@ESMATST@";
92+
$ESMABIN = "$FindBin::Bin";
93+
$ESMATST = "$FindBin::Bin/../etc/testsuites";
9194
die ">> Error << $ESMABIN is not a directory;" unless -d $ESMABIN;
9295

96+
# capture parameters to pass to checkinput
97+
#-----------------------------------------
98+
$params = "";
99+
foreach $pp (@ARGV) {
100+
$params .= "$pp " unless $pp eq "-ci" or $pp eq "-checkinput";
101+
}
102+
$params =~ s/ $//;
103+
93104
# get runtime options
94105
#--------------------
95106
Getopt::Long::Configure("no_ignore_case");
96-
GetOptions( "a|auto" => \$auto,
97-
"ax|autox" => \$autox,
98-
"nc|nocheck" => \$nocheck,
99-
"nf|nofilter" => \$nofilter,
100-
"d=s" => \$inputDir,
101-
"l|local" => \$localdir,
102-
"OSx" => \$ignoreOSdiff,
103-
"db|debug" => \$debug,
104-
"dbq|dbqueue" => \$dbqueue,
105-
"f=s" => \$fvsetupScript,
106-
"h|help" => \$help,
107-
"stage" => \$stage,
108-
"v" => \$verbose );
107+
GetOptions( "a|auto" => \$auto,
108+
"ax|autox" => \$autox,
109+
"ci|checkinput" => \$checkinput,
110+
"nc|nocheck" => \$nocheck,
111+
"nf|nofilter" => \$nofilter,
112+
"d=s" => \$inputDir,
113+
"l|local" => \$localdir,
114+
"OSx" => \$ignoreOSdiff,
115+
"db|debug" => \$debug,
116+
"dbq|dbqueue" => \$dbqueue,
117+
"f=s" => \$fvsetupScript,
118+
"h|help" => \$help,
119+
"stage" => \$stage,
120+
"v" => \$verbose );
109121
usage() if $help;
110122
$auto = 1 if $autox;
111123
$verbose = 0 unless $verbose;
@@ -123,6 +135,18 @@ sub init {
123135
die ">> Error << cannot find $fvsetupScript;\n" unless -e $fvsetupScript;
124136
}
125137

138+
#=======================================================================
139+
# name - call_checkinput
140+
# purpose - call the checkinput script
141+
#=======================================================================
142+
sub call_checkinput {
143+
my ($checkinput);
144+
$checkinput = "$ESMABIN/checkinput";
145+
die ">> Error << Cannot find script, $checkinput;" unless -x $checkinput;
146+
print "\nCalling: $checkinput $params\n"; pause();
147+
system("$checkinput $params");
148+
}
149+
126150
#=======================================================================
127151
# name - intro
128152
# purpose - print introduction
@@ -1357,6 +1381,7 @@ sub usage {
13571381
options
13581382
-auto/-a use dflt responses for queries; automatically submit job(s)
13591383
-autox/-ax use dflt responses for queries; do not submit job(s)
1384+
-checkinput/-ci check the input file (calls checkinput script)
13601385
-nocheck/-nc do not check for previous use of expid
13611386
-nofilter/-nf do not exclude *.input files if fvsetupID does not match
13621387
-d inputDir directory location of saved *.input files

0 commit comments

Comments
 (0)