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
3840# global variables
3941# -----------------
4042my ($ESMABIN , $ESMATST , $TRYAGAIN );
41- my ($auto , $autox , $codeID , $dbqueue , $debug );
43+ my ($auto , $autox , $checkinput , $ codeID , $dbqueue , $debug );
4244my ($fvroot , $fvsetupID , $fvsetupScript );
4345my ($ignoreOSdiff , $inputDir , $jobn , $nocheck , $nofilter , $noloop );
44- my ($sel , $siteID , $specified , $stage , $verbose );
46+ my ($params , $ sel , $siteID , $specified , $stage , $verbose );
4547my (%descript , %edits , %expid , %flags , %fvhome , %fvics , %fvid );
4648my (%inFile , %rawInFile , %rem_acct );
4749my (@default , @inputFiles , @nondefault );
5052# -------------
5153{
5254 init();
55+ if ($checkinput ) {
56+ call_checkinput();
57+ exit ;
58+ }
5359 intro();
5460 checkOS();
5561 getInputDir();
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# =======================================================================
7275sub 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 " \n Calling: $checkinput $params \n " ; pause();
147+ system (" $checkinput $params " );
148+ }
149+
126150# =======================================================================
127151# name - intro
128152# purpose - print introduction
@@ -1357,6 +1381,7 @@ sub usage {
13571381options
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