File indexing completed on 2023-03-17 10:39:31
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 BEGIN {
0016 use File::Basename;
0017 unshift(@INC, dirname($0)."/mpslib");
0018 }
0019 use Mpslib;
0020
0021 @MODSTATES = ();
0022 @MODJOBS = ();
0023 $refresh = "no";
0024 $retryMerge = 0;
0025 $force = 0;
0026
0027
0028 while (@ARGV) {
0029 $arg = shift(ARGV);
0030 if ($arg =~ /\A-/) {
0031 if ($arg =~ "h") {
0032 $helpwanted = 1;
0033 }
0034 elsif ($arg =~ "m") {
0035 $retryMerge = 1;
0036 print "option sets retryMerge to $retryMerge\n";
0037 }
0038 elsif ($arg =~ "d") {
0039 $localdir = 1;
0040 }
0041 elsif ($arg =~ "r") {
0042 $refresh = "yes";
0043 print "refresh set to $refresh\n";
0044 }
0045 elsif ($arg =~ "u") {
0046 $updateDb = 1;
0047 }
0048 elsif ($arg =~ "f") {
0049 $force = 1;
0050 }
0051 $optionstring = "$optionstring$arg";
0052 }
0053 else {
0054 $i = $i + 1;
0055
0056 if (($arg =~ ) eq 1) {
0057 print "Parameter $arg interpreted as job number\n";
0058 push @MODJOBS,$arg;
0059 }
0060 elsif (($arg =~ ) eq 1) {
0061 print "Parameter $arg interpreted as job state\n";
0062 push @MODSTATES,$arg;
0063 }
0064 else {
0065 print "Parameter $arg not recognized\n";
0066 }
0067 }
0068 }
0069
0070 read_db();
0071
0072
0073 $nDone = 0;
0074
0075 if ($retryMerge != 1) {
0076
0077
0078 for ($i=0; $i<$nJobs; ++$i) {
0079 if (@JOBSTATUS[$i] =~ /ABEND/i
0080 or @JOBSTATUS[$i] =~ /FAIL/i
0081 or @JOBSTATUS[$i] =~ /TIMEL/i
0082 or $force == 1) {
0083 my $cutstatus = $JOBSTATUS[$i];
0084 $cutstatus =~ s/DISABLED//gi;
0085 $stateText = "^$cutstatus\$";
0086 $theNum = $i + 1;
0087 $jobText = "^$theNum\$";
0088 if ( ( (grep /$stateText/,@MODSTATES) > 0) || (grep /$jobText/,@MODJOBS) > 0) {
0089 reSchedule($i,$refresh);
0090 ++$nDone;
0091 }
0092 }
0093 }
0094 }
0095 else {
0096
0097 $i = $nJobs;
0098 while ( $i < @JOBDIR ) {
0099 if (@JOBSTATUS[$i] eq "ABEND"
0100 or @JOBSTATUS[$i] eq "FAIL"
0101 or @JOBSTATUS[$i] eq "TIMEL"
0102 or $force == 1) {
0103 reScheduleM($i,$refresh);
0104 ++$nDone;
0105 }
0106 ++$i;
0107 }
0108 }
0109
0110 print "$nDone jobs have been rescheduled\n";
0111
0112
0113 write_db();
0114
0115
0116 sub reSchedule() {
0117 my $disabled = "";
0118 $disabled = "DISABLED" if($JOBSTATUS[$_[0]] =~ /DISABLED/ig);
0119 @JOBSTATUS[$_[0]] = $disabled."SETUP";
0120 @JOBID[$_[0]] = 0;
0121 @JOBHOST[$_[0]] = "";
0122 ++@JOBNTRY[$_[0]];
0123 if ($_[1] eq "yes") {
0124
0125 $thePwd = `pwd`;
0126 chomp $thePwd;
0127 $theJobData = "$thePwd/jobData";
0128 $theJobDir = sprintf "job%03d",$_[0]+1;
0129 $theIsn = sprintf "%03d",$i;
0130 print "mps_split.pl $infiList $i $nJobs >jobData/$theJobDir/theSplit\n";
0131 system "mps_split.pl $infiList $i $nJobs >jobData/$theJobDir/theSplit";
0132 print "mps_splice.py $cfgTemplate jobData/$theJobDir/theSplit jobData/$theJobDir/the.py $theIsn\n";
0133 system "mps_splice.py $cfgTemplate jobData/$theJobDir/theSplit jobData/$theJobDir/the.py $theIsn";
0134
0135 print "mps_script.pl $batchScript jobData/$theJobDir/theScript.sh $theJobData/$theJobDir the.py jobData/$theJobDir/theSplit $theIsn\n";
0136 system "mps_script.pl $batchScript jobData/$theJobDir/theScript.sh $theJobData/$theJobDir the.py jobData/$theJobDir/theSplit $theIsn";
0137 }
0138 print "ReSchedule @JOBDIR[$_[0]]\n";
0139 }
0140
0141 sub reScheduleM() {
0142 @JOBSTATUS[$_[0]] = "SETUP";
0143 @JOBID[$_[0]] = 0;
0144 @JOBHOST[$_[0]] = "";
0145 ++@JOBNTRY[$_[0]];
0146 if ($_[1] eq "yes") {
0147
0148 $thePwd = `pwd`;
0149 chomp $thePwd;
0150 $theJobData = "$thePwd/jobData";
0151 $theJobDir = @JOBDIR[$_[0]];
0152 $batchScriptMerge = $batchScript . "merge";
0153 print "mps_merge.py $cfgTemplate jobData/$theJobDir/alignment_merge.py $theJobData/$theJobDir $nJobs\n";
0154 system "mps_merge.py $cfgTemplate jobData/$theJobDir/alignment_merge.py $theJobData/$theJobDir $nJobs";
0155
0156 print "mps_scriptm.pl $batchScriptMerge jobData/$theJobDir/theScript.sh $theJobData/$theJobDir alignment_merge.py $nJobs\n";
0157 system "mps_scriptm.pl $batchScriptMerge jobData/$theJobDir/theScript.sh $theJobData/$theJobDir alignment_merge.py $nJobs";
0158 }
0159 print "ReSchedule @JOBDIR[$_[0]]\n";
0160 }