- Timestamp:
- May 18, 2010, 11:48:05 AM (16 years ago)
- File:
-
- 1 edited
-
trunk/tools/czartool.pl (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/czartool.pl
r27913 r28000 16 16 if (!$db) {die;} 17 17 18 my @stdscienceLabels = loadLabels("stdscience"); 19 my @distributionLabels = loadLabels("distribution"); 20 showLabelDifferences(); 18 my @stdscienceLabels = `getLabels.pl -s stdscience`; 19 my @distributionLabels = `getLabels.pl -s distribution`; 21 20 22 21 checkAllLabels("new"); … … 54 53 elsif ($key eq "w") {checkAllLabels("wait");} 55 54 elsif ($key eq "l") {labelDetails();} 55 elsif ($key eq "u") {serverStatus("stdscience");} 56 56 elsif ($key =~ m/[0-9]/) {my $key2=getc; checkOneLabel($stdscienceLabels[$key.$key2]);} 57 57 printInstructions(); … … 84 84 ########################################################################### 85 85 # 86 # Display label differences between stdscience and distribution87 #88 ###########################################################################89 sub showLabelDifferences {90 91 my @diffLabels = @{getArrayDifferences(\@stdscienceLabels, \@distributionLabels)};92 93 printf("+-------------------------------------------------------+\n");94 printf("| Label differences between stdscience and distribution |\n");95 printf("+-------------------------------------------------------+\n");96 97 my $item;98 foreach $item (@diffLabels) {99 100 printf( "| %53s |\n", $item);101 }102 printf("+-------------------------------------------------------+\n");103 }104 105 ###########################################################################106 #107 86 # Compares two arrays and stores the differences 108 87 # … … 133 112 ########################################################################### 134 113 # 135 # Loads labels from a particularpantasks server136 # 137 ########################################################################### 138 sub loadLabels {114 # Prints the status of a given pantasks server 115 # 116 ########################################################################### 117 sub serverStatus { 139 118 my ($server) = @_; 140 119 141 my @cmdOut = `echo "s how.labels;quit" | pantasks_client -c ~ipp/$server/ptolemy.rc 2>&1`;120 my @cmdOut = `echo "status;quit" | pantasks_client -c ~ipp/$server/ptolemy.rc 2>&1`; 142 121 my $line; 143 my @labels;144 my $passedHeader=0;145 122 foreach $line (@cmdOut) { 146 123 147 124 chomp($line); 148 if ($line =~ m/pantasks:\s+(.*)/) { 149 150 # HACK to get around 'dummy' label in stdscience 151 if ($1 !~ m/.*dummy.*/) {push(@labels, $1);} 152 $passedHeader=1; 153 next; 154 } 155 156 if ($passedHeader){push(@labels, $line);} 157 } 158 159 return @labels; 125 126 print "$line\n"; 127 } 160 128 } 161 129 … … 176 144 foreach $server (@servers) { 177 145 146 my @results = `checkServer.pl -s $server`; 147 178 148 printf("| %12s ", $server); 179 180 my @cmdOut = `echo "status ;quit" | pantasks_client -c ~ipp/$server/ptolemy.rc 2>&1`; 181 182 my $line; 183 my $foundStatus = 0; 184 my $isRunning = 0; 185 foreach $line (@cmdOut) { 186 187 chomp($line); 188 if ($line =~ m/Scheduler is stopped/) {$isRunning = 0; $foundStatus=1;last;} 189 if ($line =~ m/Scheduler is running/) {$isRunning = 1; $foundStatus=1;last;} 190 if ($line =~ m/Task Staus/) {last;} 191 192 } 193 194 if (!$foundStatus){print "| NO ";} else {print "| yes ";} 195 if (!$isRunning){print "| NO ";} else {print "| yes ";} 196 printf("|\n"); 149 chomp($results[0]); 150 chomp($results[1]); 151 printf("| %3s | %3s |\n", $results[0], $results[1]); 197 152 } 198 153 … … 263 218 sub checkAllLabels { 264 219 my ($state) = @_; 265 266 printf("\n+------------------------------------------------------------------------------------------------------------------------------------------------------------+\n"); 267 printf("| %10s |\n", $state); 268 printf("+------------------------------------------------------------------------------------------------------------------------------------------------------------+\n"); 269 printf("| no | label | chip | cam | fake | warp | stack | diff | magic | destreak | dist |\n"); 270 printf("+-----+----------------------------------+-----------+------------+------------+------------+------------+------------+------------+------------+------------+\n"); 271 272 my $label; 220 #print time, $/; 221 printf("\n+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+\n"); 222 printf("| %10s (any faults are shown in parentheses) |\n", $state); 223 printf("+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+\n"); 224 printf("| no | label | distributing? | chip | cam | fake | warp | stack | diff | magic | destreak | dist |\n"); 225 printf("+-----+----------------------------------+---------------+------------+------------+------------+------------+------------+------------+------------+------------+------------+\n"); 226 227 my $stdsLabel; 228 my $distLabel; 273 229 my $i=0; 274 foreach $label (@stdscienceLabels) { 275 276 chomp($label); 230 my $distributing; 231 foreach $stdsLabel (@stdscienceLabels) { 232 233 $distributing = 0; 234 foreach $distLabel (@distributionLabels) { 235 chomp($stdsLabel); 236 if ($stdsLabel eq $distLabel) { $distributing = 1; last;} 237 238 239 } 240 chomp($stdsLabel); 277 241 printf("| %3d ", $i); 278 printf("| %32s ", $label); 279 printf("| %10s", getStateAndFaults($label, "chipRun", $state, "chip")); 280 printf("| %10s ", getStateAndFaults($label, "camRun", $state, "cam")); 281 printf("| %10s ", getStateAndFaults($label, "fakeRun", $state, "fake")); 282 printf("| %10s ", getStateAndFaults($label, "warpRun", $state, "warp")); 283 printf("| %10s ", getStateAndFaults($label, "stackRun", $state, "stack")); 284 printf("| %10s ", getStateAndFaults($label, "diffRun", $state, "diff")); 285 printf("| %10s ", getStateAndFaults($label, "magicRun", $state, "magic")); 286 printf("| %10s ", getStateAndFaults($label, "magicDSRun", $state, "magicDS")); 287 printf("| %10s ", getStateAndFaults($label, "distRun", $state, "dist")); 242 printf("| %32s ", $stdsLabel); 243 printf("| %10s ", $distributing ? "yes" : "NO" ); 244 printf("| %10s ", getStateAndFaults($stdsLabel, "chipRun", $state, "chip")); 245 printf("| %10s ", getStateAndFaults($stdsLabel, "camRun", $state, "cam")); 246 printf("| %10s ", getStateAndFaults($stdsLabel, "fakeRun", $state, "fake")); 247 printf("| %10s ", getStateAndFaults($stdsLabel, "warpRun", $state, "warp")); 248 printf("| %10s ", getStateAndFaults($stdsLabel, "stackRun", $state, "stack")); 249 printf("| %10s ", getStateAndFaults($stdsLabel, "diffRun", $state, "diff")); 250 printf("| %10s ", getStateAndFaults($stdsLabel, "magicRun", $state, "magic")); 251 printf("| %10s ", getStateAndFaults($stdsLabel, "magicDSRun", $state, "magicDS")); 252 printf("| %10s ", getStateAndFaults($stdsLabel, "distRun", $state, "dist")); 288 253 printf("|\n"); 289 254 $i++; 290 255 } 291 256 292 printf("+-----+----------------------------------+----------- +------------+------------+------------+------------+------------+------------+------------+------------+\n");257 printf("+-----+----------------------------------+---------------+------------+------------+------------+------------+------------+------------+------------+------------+------------+\n"); 293 258 294 259 }
Note:
See TracChangeset
for help on using the changeset viewer.
