Changeset 40055
- Timestamp:
- May 24, 2017, 2:55:55 PM (9 years ago)
- Location:
- trunk/ippMonitor/czartool
- Files:
-
- 6 edited
-
czarDbSchema.sql (modified) (2 diffs)
-
czarpoll.pl (modified) (5 diffs)
-
czartool/CzarDb.pm (modified) (1 diff)
-
czartool/Gpc1Db.pm (modified) (4 diffs)
-
czartool/Pantasks.pm (modified) (7 diffs)
-
czartool/Plotter.pm (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippMonitor/czartool/czarDbSchema.sql
r38261 r40055 520 520 ) ENGINE=InnoDB DEFAULT CHARSET=latin1; 521 521 SET character_set_client = @saved_cs_client; 522 523 524 -- 525 -- Table structure for table `summitExp` 526 -- 527 528 DROP TABLE IF EXISTS `summitExp`; 529 SET @saved_cs_client = @@character_set_client; 530 SET character_set_client = utf8; 531 CREATE TABLE `summitExp` ( 532 `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP, 533 `label` varchar(128) default 'NONE', 534 `dbname` varchar(128) default 'NONE', 535 `pending` bigint(20) NOT NULL, 536 `faults` bigint(20) NOT NULL, 537 `processed` bigint(20) NOT NULL default '0', 538 KEY `summitExpIndex` (`timestamp`,`label`, `dbname`) 539 ) ENGINE=InnoDB DEFAULT CHARSET=latin1; 540 SET character_set_client = @saved_cs_client; 541 542 -- 543 -- Table structure for table `downloadExp` 544 -- 545 546 DROP TABLE IF EXISTS `downloadExp`; 547 SET @saved_cs_client = @@character_set_client; 548 SET character_set_client = utf8; 549 CREATE TABLE `downloadExp` ( 550 `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP, 551 `label` varchar(128) default 'NONE', 552 `dbname` varchar(128) default 'NONE', 553 `pending` bigint(20) NOT NULL, 554 `faults` bigint(20) NOT NULL, 555 `processed` bigint(20) NOT NULL default '0', 556 KEY `downloadExpIndex` (`timestamp`,`label`, `dbname`) 557 ) ENGINE=InnoDB DEFAULT CHARSET=latin1; 558 SET character_set_client = @saved_cs_client; 559 560 -- 561 -- Table structure for table `newExp` 562 -- 563 564 DROP TABLE IF EXISTS `newExp`; 565 SET @saved_cs_client = @@character_set_client; 566 SET character_set_client = utf8; 567 CREATE TABLE `newExp` ( 568 `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP, 569 `label` varchar(128) default 'NONE', 570 `dbname` varchar(128) default 'NONE', 571 `pending` bigint(20) NOT NULL, 572 `faults` bigint(20) NOT NULL, 573 `processed` bigint(20) NOT NULL default '0', 574 KEY `newExpIndex` (`timestamp`,`label`, `dbname`) 575 ) ENGINE=InnoDB DEFAULT CHARSET=latin1; 576 SET character_set_client = @saved_cs_client; 577 578 -- 579 -- Table structure for table `rawExp` 580 -- 581 582 DROP TABLE IF EXISTS `rawExp`; 583 SET @saved_cs_client = @@character_set_client; 584 SET character_set_client = utf8; 585 CREATE TABLE `rawExp` ( 586 `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP, 587 `label` varchar(128) default 'NONE', 588 `dbname` varchar(128) default 'NONE', 589 `pending` bigint(20) NOT NULL, 590 `faults` bigint(20) NOT NULL, 591 `processed` bigint(20) NOT NULL default '0', 592 KEY `rawExpIndex` (`timestamp`,`label`, `dbname`) 593 ) ENGINE=InnoDB DEFAULT CHARSET=latin1; 594 SET character_set_client = @saved_cs_client; 595 596 597 522 598 /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; 523 599 … … 529 605 /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; 530 606 /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; 607 -
trunk/ippMonitor/czartool/czarpoll.pl
r40008 r40055 63 63 "fullforce", 64 64 "dist", 65 "pub"); 65 "pub", 66 "summitExp", 67 "downloadExp", 68 "newExp", 69 "rawExp"); 70 71 66 72 67 73 my @ippToPspsStages = ( … … 274 280 } 275 281 282 my @trashFiles = </tmp/czarplot_gnuplot_*>; 283 if ($#trashFiles != -1) { 284 print "* WARNING: Cleaning " . ($#trashFiles + 1) . " files that were not auto cleaned.\n"; 285 foreach my $tFile (@trashFiles) { 286 unlink($tFile); 287 } 288 } 289 276 290 my $iterationTime = time() - $iterationStartTime; 277 291 … … 350 364 # skip update labels for now. The plots are not relevant. 351 365 next if $label =~ 'ps_ud'; 366 # Skip individual label tables for raw-like stages. 367 # if ($stage =~ /Exp/) { next; } 352 368 353 369 $plotter->createTimeSeries($label, undef, $begin, $end, 1, 1, 1); … … 390 406 391 407 foreach $stage (@stages) { 392 393 408 $server = $pantasks->getServerForThisStage($stage); 394 409 $pantasks->getRevertStatus($stage, \$reverting); … … 396 411 397 412 print "* Checking labels for $stage stage\n"; 413 414 # These have no labels to check, so just get them out of the way fast 415 if (($stage eq 'summitExp')||($stage eq 'downloadExp')||($stage eq 'newExp')||($stage eq 'rawExp')) { 416 ($new,$full,$faults) = $gpc1Db->countRawExposures($today,$stage); 417 $czarDb->insertNewTimeData($stage, "all_".$labelServer."_labels", 'gpc1', $new, $full, $faults); 418 419 ($new,$full,$faults) = $gpc2Db->countRawExposures($today,$stage); 420 $czarDb->insertNewTimeData($stage, "all_".$labelServer."_labels", 'gpc2', $new, $full, $faults); 421 422 next; 423 } 424 398 425 399 426 $totalNew1=$totalFaults1=$totalFull1=0; -
trunk/ippMonitor/czartool/czartool/CzarDb.pm
r39805 r40055 17 17 "dist", 18 18 "pub", 19 "chipbackground"); # TODO put elsewhere 19 "chipbackground", 20 "summitExp", 21 "downloadExp", 22 "newExp", 23 "rawExp"); # TODO put elsewhere 20 24 21 25 my @ippToPspsStages = ( -
trunk/ippMonitor/czartool/czartool/Gpc1Db.pm
r38258 r40055 7 7 use warnings; 8 8 use strict; 9 use POSIX qw/strftime/; 9 10 10 11 use czartool::MySQLDb; … … 34 35 elsif ($stage eq "pub") {${$joinTable}="publishDone";} 35 36 elsif ($stage eq "chipbackground") {${$id}="chip_bg_id"; ${$joinTable}="chipBackgroundImfile";} 37 elsif ($stage eq 'summitExp') { ${$id} = 'summit_id'; ${$joinTable} = 'summitImfile'; } 38 elsif ($stage eq 'downloadExp') { ${$id} = 'summit_id'; ${$joinTable} = 'pzDownloadImfile'; } 39 elsif ($stage eq 'newExp') { ${$id} = 'exp_id'; ${$joinTable} = 'newImfile'; } 40 elsif ($stage eq 'rawExp') { ${$id} = 'exp_id'; ${$joinTable} = 'rawImfile'; } 41 36 42 else { 37 43 print "* ERROR: could not find joinTable and ID for '$stage' stage\n"; … … 63 69 elsif ($stage eq "pub" ) {return "publishRun";} 64 70 elsif ($stage eq "chipbackground" ) {return "chipBackgroundRun";} 65 71 elsif ($stage eq 'summitExp' ) { return 'summitExp'; } 72 elsif ($stage eq 'downloadExp' ) { return 'pzDownloadExp'; } 73 elsif ($stage eq 'newExp' ) { return 'newExp'; } 74 elsif ($stage eq 'rawExp' ) { return 'rawExp'; } 66 75 return "ERROR"; 67 76 } … … 95 104 return scalar $query->fetchrow_array(); 96 105 } 106 107 ### 108 # General purpose way to get early stage results. These all have different join requirements than the later stages. 109 # 110 sub countRawExposures { 111 my ($self, $date, $stage) = @_; 112 113 my $query; 114 # Ignore the date input, because it's localtime, and not UTC, but dateobs is entirely UTC. 115 $date = strftime('%Y-%m-%d', gmtime); 116 117 if ($stage eq 'summitExp') { 118 # summitExp is populated directly, and contains the fault information 119 $query = $self->{_db}->prepare(<<SQL); 120 SELECT summit_id,"full",fault 121 FROM summitExp 122 WHERE dateobs > '${date}T00:00:00' 123 AND dateobs < '${date}T23:59:59' 124 SQL 125 } 126 elsif ($stage eq 'downloadExp') { 127 # pzDownloadExp has the state, but the faults are in pzDownloadImfile. dateobs needs to be grabbed from summitExp still. 128 $query = $self->{_db}->prepare(<<SQL); 129 SELECT summit_id,pzDownloadExp.state,sum(pzDownloadImfile.fault) 130 FROM summitExp JOIN pzDownloadExp USING(summit_id) JOIN pzDownloadImfile USING(summit_id) 131 WHERE dateobs > '${date}T00:00:00' 132 AND dateobs < '${date}T23:59:59' 133 GROUP BY summit_id 134 SQL 135 } 136 elsif ($stage eq 'newExp') { 137 # This could skip pzDownloadExp. This could probably skip everything, as this is autopopulated when the exposure completes downloading. 138 $query = $self->{_db}->prepare(<<SQL); 139 SELECT exp_id,newExp.state,0 140 FROM summitExp JOIN pzDownloadExp USING(summit_id) 141 JOIN newExp USING(summit_id) 142 WHERE dateobs > '${date}T00:00:00' 143 AND dateobs < '${date}T23:59:59' 144 GROUP BY exp_id 145 SQL 146 } 147 elsif ($stage eq 'rawExp') { 148 # The rawExp entry doesn't exist until all the rawImfiles are populated, 149 $query = $self->{_db}->prepare(<<SQL); 150 SELECT rawExp.exp_id,rawExp.state,sum(rawImfile.fault) 151 FROM summitExp 152 JOIN newExp USING(summit_id) JOIN newImfile ON (newExp.exp_id = newImfile.exp_id) 153 LEFT JOIN rawImfile ON (newImfile.exp_id = rawImfile.exp_id AND newImfile.tmp_class_id = rawImfile.tmp_class_id) 154 LEFT JOIN rawExp ON (rawImfile.exp_id = rawExp.exp_id) 155 WHERE summitExp.dateobs > '${date}T00:00:00' 156 AND summitExp.dateobs < '${date}T23:59:59' 157 GROUP BY exp_id 158 SQL 159 } 160 $query->execute; 161 my $result = $query->fetchall_arrayref(); 162 163 my ($new,$full,$faults) = (0,0,0); 164 165 foreach my $row (@{ $result }) { 166 my ($id,$state,$fault) = @{ $row }; 167 unless (defined($fault)) { $fault = 0; } 168 if ($fault eq '') { $fault = 0; } 169 if ($fault != 0) { $faults ++ ; next; } 170 unless (defined($state)) { $new++; next; } 171 if (($state eq 'new' )||($state eq 'run' )||($state eq 'reg' )) { $new ++; next; } 172 if (($state eq 'stop')||($state eq 'full')||($state eq 'drop')) { $full ++; next; } 173 174 # Shouldn't get here. 175 print STDERR "countRawExposures recieved bad line: STAGE: $stage ID: $id STATE: $state FAULT: $fault\n"; 176 } 177 178 return($new,$full,$faults); 179 } 180 97 181 98 182 ########################################################################### -
trunk/ippMonitor/czartool/czartool/Pantasks.pm
r39805 r40055 24 24 ); 25 25 26 my $ipphome = "/data/ippc64.1/ippitc"; 27 26 28 ########################################################################### 27 29 # … … 92 94 my $today = sprintf("%04d-%02d-%02d", $year+1900, $month+1, $day); 93 95 94 my @cmdOut = `echo "ns.show.dates;quit" | pantasks_client -c ~ipp/stdscience/ptolemy.rc 2>&1`; 96 print "stdscience : $ipphome/stdscience/ptolemy.rc\n"; 97 my @cmdOut = `echo "ns.show.dates;quit" | pantasks_client -c $ipphome/stdscience/ptolemy.rc 2>&1`; 95 98 my $line; 96 99 foreach $line (@cmdOut) { … … 117 120 my @labels; 118 121 119 my @cmdOut = `echo "show.labels;quit" | pantasks_client -c ~ipp/$server/ptolemy.rc 2>&1`; 122 print "stdscience : $ipphome/stdscience/ptolemy.rc\n"; 123 my @cmdOut = `echo "show.labels;quit" | pantasks_client -c $ipphome/$server/ptolemy.rc 2>&1`; 120 124 my $line; 121 125 my $passedHeader=0; 122 126 foreach $line (@cmdOut) { 123 127 print "labels: $line"; 124 128 chomp($line); 125 129 if (!$self->outputOk($line)) {return \@labels;} … … 145 149 my ($self, $server, $alive, $running) = @_; 146 150 147 my @cmdOut = `echo "status ; quit" | pantasks_client -c ~ipp/$server/ptolemy.rc 2>&1`;151 my @cmdOut = `echo "status ; quit" | pantasks_client -c $ipphome/$server/ptolemy.rc 2>&1`; 148 152 my $line; 149 153 ${$alive} = 0; … … 166 170 my ($self, $server) = @_; 167 171 168 my @cmdOut = `echo "status;quit" | pantasks_client -c ~ipp/$server/ptolemy.rc 2>&1`;172 my @cmdOut = `echo "status;quit" | pantasks_client -c $ipphome/$server/ptolemy.rc 2>&1`; 169 173 my $line; 170 174 my $passedHeader=0; … … 189 193 if ($stage eq "cam") {$stage = "camera";} 190 194 191 my @cmdOut = `echo "status;quit" | pantasks_client -c ~ipp/$server/ptolemy.rc 2>&1`;195 my @cmdOut = `echo "status;quit" | pantasks_client -c $ipphome/$server/ptolemy.rc 2>&1`; 192 196 my $line; 193 197 foreach $line (@cmdOut) { … … 217 221 elsif ($server eq "registration") {$prefix = "register";} 218 222 219 my @cmdOut = `echo "$prefix.show.dates;quit" | pantasks_client -c ~ipp/$server/ptolemy.rc 2>&1`;223 my @cmdOut = `echo "$prefix.show.dates;quit" | pantasks_client -c $ipphome/$server/ptolemy.rc 2>&1`; 220 224 my $line; 221 225 my $passedHeader=0; -
trunk/ippMonitor/czartool/czartool/Plotter.pm
r38258 r40055 20 20 "fullforce", 21 21 "dist", 22 "pub" 22 "pub", 23 'summitExp', 24 'downloadExp', 25 'newExp', 26 'rawExp' 23 27 ); 24 28 … … 245 249 246 250 # now delete temp dat files 247 foreach my $stage (keys %gnuplotFiles) {unlink($gnuplotFiles{$stage});} 251 foreach my $stage (keys %gnuplotFiles) { 252 unlink($gnuplotFiles{$stage}); 253 } 248 254 249 255 return 1; … … 442 448 use FileHandle; 443 449 GP->autoflush(1); 444 445 if ($self->{_outputFormat} ne "X11") {print GP "set output \"$outputFile\";";} 450 451 452 if ($self->{_outputFormat} ne "X11") {print GP "set output \"$outputFile\";"; } 446 453 print GP 447 454 "set term $self->{_outputFormat};" . … … 573 580 use FileHandle; 574 581 GP->autoflush(1); 575 576 582 if ($self->{_outputFormat} ne "X11") {print GP "set output \"$outputFile\";";} 577 583 print GP … … 616 622 617 623 # now delete temp dat files 618 foreach my $stage (keys %$gnuplotFiles) {unlink($gnuplotFiles->{$stage});} 624 625 foreach my $stage (keys %$gnuplotFiles) { 626 my $ff = $gnuplotFiles->{$stage}; 627 unlink($gnuplotFiles->{$stage}); 628 } 619 629 } 620 630
Note:
See TracChangeset
for help on using the changeset viewer.
