Changeset 40840 for trunk/ippMonitor/czartool/czartool.pl
- Timestamp:
- Jul 23, 2019, 2:24:01 PM (7 years ago)
- File:
-
- 1 edited
-
trunk/ippMonitor/czartool/czartool.pl (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippMonitor/czartool/czartool.pl
r38206 r40840 15 15 my $save_temps = 1; 16 16 my $interval = undef; 17 my $telescope = "gpc1"; 17 18 18 19 GetOptions ( 19 20 "dbname|d=s" => \$czarDbName, 20 21 "interval|i=s" => \$interval, 22 "telescope|t=s" => \$telescope, 21 23 ); 22 23 24 24 25 my @states = ("full", "new", "drop", "wait"); … … 26 27 my $czarDb = $config->getCzarDbInstance(); 27 28 my $gpc1Db = $config->getGpc1Instance(); 29 my $gpc2Db = $config->getGpc2Instance(); 28 30 my $pantasks = new czartool::Pantasks(); 29 31 … … 55 57 sub promptPoll { 56 58 57 @stdscienceLabels = @{$pantasks->getLabels("stdscience" )};58 @distributionLabels = @{$pantasks->getLabels("distribution" )};59 # @publishingLabels = @{$pantasks->getLabels("publishing" )};59 @stdscienceLabels = @{$pantasks->getLabels("stdscience",$telescope)}; 60 @distributionLabels = @{$pantasks->getLabels("distribution",$telescope)}; 61 # @publishingLabels = @{$pantasks->getLabels("publishing", $telescope)}; 60 62 @publishingLabels = @stdscienceLabels; 61 checkAllLabels("new" );63 checkAllLabels("new", $telescope); 62 64 printInstructions(); 63 65 … … 68 70 69 71 if ($key eq "s") {checkServers();} 70 elsif ($key eq "l") {checkAllLabels("new" );}71 elsif ($key eq "u") {$pantasks->getServerCurrentStatus("stdscience" );}72 elsif ($key =~ m/[0-9]/) {my $key2=getc; checkOneLabel($stdscienceLabels[($key.$key2)-1] );}72 elsif ($key eq "l") {checkAllLabels("new", $telescope);} 73 elsif ($key eq "u") {$pantasks->getServerCurrentStatus("stdscience",$telescope);} 74 elsif ($key =~ m/[0-9]/) {my $key2=getc; checkOneLabel($stdscienceLabels[($key.$key2)-1], $telescope);} 73 75 printInstructions(); 74 76 … … 139 141 ########################################################################### 140 142 sub labelDetails { 143 my ($telescope) = @_; 141 144 142 145 print "\nPlease enter the label name, or number from table above: "; … … 144 147 chomp($input); 145 148 if ($input =~ m/^([0-9]|[1-9][0-9]|[1-9][0-9][0-9])$/) { 146 return checkOneLabel($stdscienceLabels[$input] );147 } 148 149 checkOneLabel($input );149 return checkOneLabel($stdscienceLabels[$input], $telescope); 150 } 151 152 checkOneLabel($input, $telescope); 150 153 } 151 154 … … 156 159 ########################################################################### 157 160 sub checkOneLabel { 158 my ($label ) = @_;161 my ($label, $telescope) = @_; 159 162 160 163 chomp($label); … … 188 191 foreach $stage (@stages) { 189 192 190 printf("|%14s", getStateAndFaultsString($label, $state, $stage ));193 printf("|%14s", getStateAndFaultsString($label, $state, $stage, $telescope)); 191 194 } 192 195 … … 209 212 ########################################################################### 210 213 sub checkAllLabels { 211 my ($state ) = @_;214 my ($state, $telescope) = @_; 212 215 #print time, $/; 213 216 my $stage; … … 259 262 foreach $stage (@stages) { 260 263 261 printf("|%14s", getStateAndFaultsString($stdsLabel, $state, $stage ));264 printf("|%14s", getStateAndFaultsString($stdsLabel, $state, $stage, $telescope)); 262 265 } 263 266 … … 280 283 ########################################################################### 281 284 sub getStateAndFaultsString { 282 my ($label, $state, $stage) = @_; 283 284 my $new = $gpc1Db->countExposures($label, $stage, $state); 285 286 #if ($state ne "new") {return $new;} 287 288 my $faults = $gpc1Db->countFaults($label, $stage, $state); 285 my ($label, $state, $stage, $telescope) = @_; 286 287 my $new = undef; 288 my $faults = undef; 289 290 if ($telescope eq 'gpc1') { 291 $new = $gpc1Db->countExposures($label, $stage, $state); 292 #if ($state ne "new") {return $new;} 293 294 $faults = $gpc1Db->countFaults($label, $stage, $state); 295 } 296 elsif ($telescope eq 'gpc2') { 297 $new = $gpc2Db->countExposures($label, $stage, $state); 298 #if ($state ne "new") {return $new;} 299 300 $faults = $gpc2Db->countFaults($label, $stage, $state); 301 } 302 else { 303 print "WARNING: Must specify a telescope for connecting to the right pantask\n"; 304 } 289 305 290 306 if ($faults < 1) {return $new;}
Note:
See TracChangeset
for help on using the changeset viewer.
