IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 40840


Ignore:
Timestamp:
Jul 23, 2019, 2:24:01 PM (7 years ago)
Author:
tdeboer
Message:

updates to ippMonitor and czartool to handle gpc2 labels and improve czartool

Location:
trunk/ippMonitor
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippMonitor/Makefile.in

    r40425 r40840  
    165165$(DESTWWW)/warpFailedSkyfiles.php \
    166166$(DESTWWW)/failedWarpSkyfiles.php \
     167$(DESTWWW)/fullforceFailedSkyfile.php \
     168$(DESTWWW)/fullforceProcessedSkyfile.php \
     169$(DESTWWW)/fullforceRun.php \
     170$(DESTWWW)/fullforceSummary.php \
     171$(DESTWWW)/fullforce_failure.php \
    167172$(DESTWWW)/failedFullForceSkyfiles.php \
    168173$(DESTWWW)/diffSummary.php \
     
    172177$(DESTWWW)/diffProcessedSkyfile.php \
    173178$(DESTWWW)/diffProcessedSkyfile_Images.php \
     179$(DESTWWW)/diffFailedSkyfile.php \
    174180$(DESTWWW)/failedDiffSkyfile.php \
    175181$(DESTWWW)/stackRun.php \
  • trunk/ippMonitor/config.dat.in

    r38208 r40840  
    11
     2// host and user information for the main processing database (contains, e.g., gpc1, gpc2, etc)
    23$DBHOST    = "";
    34$DBUSER    = "";
    45$DBPASS    = "";
     6
     7
     8// location of nebulous apache interface machine
     9$NEB_SERVER = "";
     10
     11// Czartool configuration variables
     12// NOTE: These should match the configuration file used by the czartool perl modules: czartool/czarconfig.xml
     13$CZARDBNAME = "";
     14$CZARDBHOST = "";
     15
     16// location of plots produced by czarpoll.pl
     17$CZARPLOTDIR = "";
    518
    619// Temporary files belonging to DELETION_USER and older than
     
    922
    1023$DELETION_USER   = "";
    11 $DELETION_DELAY  = 15;
     24$DELETION_DELAY  =5;
    1225
    13 $REPL_HOST_IPPADMIN      = "";
    14 $REPL_USER_IPPADMIN      = "";
    15 $REPL_PASSWORD_IPPADMIN  = "";
    16 $REPL_DBNAME_IPPADMIN    = "" ;
     26$HOST_NEBULOUS  = "";
     27$USER_NEBULOUS  = "";
     28$PASSWORD_NEBULOUS  = "";
     29$DBNAME_NEBULOUS  = "";
    1730
    18 $REPL_HOST_NEBULOUS      = "";
    19 $REPL_USER_NEBULOUS      = "";
     31$REPL_HOST_NEBULOUS  = "";
     32$REPL_USER_NEBULOUS  = "";
    2033$REPL_PASSWORD_NEBULOUS  = "";
    21 $REPL_DBNAME_NEBULOUS    = "";
     34$REPL_DBNAME_NEBULOUS  = "";
    2235
    23 $REPL_HOST_PSTAMP      = "";
    24 $REPL_USER_PSTAMP      = "";
     36$REPL_HOST_NEBULOUS_SECONDARY  = "";
     37$REPL_USER_NEBULOUS_SECONDARY  = "";
     38$REPL_PASSWORD_NEBULOUS_SECONDARY  = "";
     39$REPL_DBNAME_NEBULOUS_SECONDARY  = "";
     40
     41$REPL_HOST_PSTAMP  = "";
     42$REPL_USER_PSTAMP  = "";
    2543$REPL_PASSWORD_PSTAMP  = "";
    26 $REPL_DBNAME_PSTAMP    = "";
     44$REPL_DBNAME_PSTAMP  = "";
    2745
    28 $REPL_HOST_GPC1      = "";
    29 $REPL_USER_GPC1      = "";
     46$REPL_HOST_ISP  = "";
     47$REPL_USER_ISP  = "";
     48$REPL_PASSWORD_ISP  = "";
     49$REPL_DBNAME_ISP  = "";
     50
     51$HOST_GPC1  = "";
     52$USER_GPC1  = "";
     53$PASSWORD_GPC1  = "";
     54$DBNAME_GPC1  = "";
     55
     56$REPL_HOST_GPC1  = "";
     57$REPL_USER_GPC1  = "";
    3058$REPL_PASSWORD_GPC1  = "";
    31 $REPL_DBNAME_GPC1    = "";
     59$REPL_DBNAME_GPC1  = "";
    3260
    33 $REPL_HOST_ISP      = "";
    34 $REPL_USER_ISP      = "";
    35 $REPL_PASSWORD_ISP  = "";
    36 $REPL_DBNAME_ISP    = "";
     61$REPL_HOST_GPC1_SECONDARY  = "";
     62$REPL_USER_GPC1_SECONDARY  = "";
     63$REPL_PASSWORD_GPC1_SECONDARY  = "";
     64$REPL_DBNAME_GPC1_SECONDARY  = "";
    3765
    38 $REPL_HOST_NEBULOUS_SECONDARY      = "";
    39 $REPL_USER_NEBULOUS_SECONDARY      = "";
    40 $REPL_PASSWORD_NEBULOUS_SECONDARY  = "";
    41 $REPL_DBNAME_NEBULOUS_SECONDARY    = "";
     66$REPL_HOST_DATASTORE_SECONDARY  = "";
     67$REPL_USER_DATASTORE_SECONDARY  = "";
     68$REPL_PASSWORD_DATASTORE_SECONDARY  = "";
     69$REPL_DBNAME_DATASTORE_SECONDARY  = "";
     70
     71//Important machines that should be checked for accessibiltiy
     72$HOST_GATEWAY  = "";
     73$DBNAME_GATEWAY  = "";
     74
     75$HOST_GATEWAY_SECONDARY  = "";
     76$DBNAME_GATEWAY_SECONDARY  = "";
     77
     78$HOST_APACHE1  = "";
     79$DBNAME_APACHE1  = "";
     80
     81$HOST_APACHE2  = "";
     82$DBNAME_APACHE2  = "";
     83
     84$HOST_APACHE3  = "";
     85$DBNAME_APACHE3  = "";
     86
     87$HOST_APACHE4  = "";
     88$DBNAME_APACHE4  = "";
     89
     90$HOST_APACHE5  = "";
     91$DBNAME_APACHE5  = "";
     92
     93$HOST_APACHE6  = "";
     94$DBNAME_APACHE6  = "";
     95
     96$HOST_PROXY  = "";
     97$DBNAME_PROXY  = "";
     98
     99$HOST_SVN  = "";
     100$DBNAME_SVN  = "";
     101
     102$HOST_CONFLUENCE  = "";
     103$DBNAME_CONFLUENCE  = "";
     104
     105
  • trunk/ippMonitor/czartool/czarconfig.xml.in

    r40090 r40840  
    1010    <size>8</size>
    1111    <path>PATH/TO/czartool_plots</path>
     12    <exec>PATH/TO/gnuplot</exec>
    1213  </gnuplot>
    1314
  • trunk/ippMonitor/czartool/czarpoll.pl

    r40834 r40840  
    102102    foreach $server (@servers) {
    103103
    104         my @dates = @{$pantasks->getDates($server)};
     104        my @dates = @{$pantasks->getDates($server,'gpc1')};
    105105        if (@dates) {
    106 
    107             $czarDb->updateServerDates($server, \@dates);
     106            $czarDb->updateServerDates($server, \@dates,'gpc1');
    108107        }
    109108        else {
    110 
    111             print "WARNING: No dates to update for '$server'\n";
     109            print "WARNING: No dates to update for '$server' in gpc1\n";
     110        }
     111
     112        my @dates2 = @{$pantasks->getDates($server,'gpc2')};
     113        if (@dates2) {
     114            $czarDb->updateServerDates($server, \@dates2,'gpc2');
     115        }
     116        else {
     117            print "WARNING: No dates to update for '$server' in gpc2\n";
    112118        }
    113119    }
     
    126132
    127133    print "* Updating labels\n";
    128     # my @servers = ("stdscience", "distribution", "publishing", "update");
    129134    my @servers = ("stdscience", "distribution");
    130135
    131136    my @allLabels = ();
    132 
     137    my @allLabels2 = ();
     138    my @fields = ();
     139
     140    #first grab the labels fom the relevant pantasks
    133141    my $server = undef;
    134142    foreach $server (@servers) {
    135         my @labels = @{$pantasks->getLabels($server)};
     143        my @labels = @{$pantasks->getLabels($server,'gpc1')};
    136144        push (@allLabels, @labels);
    137     }
     145
     146        my @labels2 = @{$pantasks->getLabels($server,'gpc2')};
     147        push (@allLabels2, @labels2);
     148    }
     149
     150    ## adding extra labels from external file
     151    my $filename = 'extra_labels.dat';
     152    if (open(my $fh, '<:encoding(UTF-8)', $filename)) {
     153      my $header = <$fh>;     
     154      $header = <$fh>;     
     155      while (my $row = <$fh>) {
     156          chomp $row;
     157          @fields = split(' ', $row);
     158          if ($fields[1] eq 'gpc1') {
     159              push (@allLabels, $fields[0]);
     160          }
     161          if ($fields[1] eq 'gpc2') {
     162              push (@allLabels2, $fields[0]);
     163          }
     164      }
     165    } else {
     166      warn "No extra labels found in '$filename' $!";
     167    }
     168
     169    # Now, grab the priorities for each label
     170    my @priorities = ();
     171    my $row = undef;
     172    my $label = undef;
     173    my $priority = undef;
     174    foreach $label ( @allLabels ) {
     175        $priority = $gpc1Db->getPriority($label);
     176        push(@priorities, $priority);
     177    }
     178
     179    #also grab gpc2 priorities from the gpc2 Label table
     180    my @priorities2 = ();
     181    my $priority2 = undef;
     182    foreach $label ( @allLabels2 ) {
     183        $priority2 = $gpc2Db->getPriority($label);
     184        push(@priorities2, $priority2);
     185    }
     186
     187    #sort labels by priority
     188    my @idx = sort {$priorities[$a] <=> $priorities[$b]} 0 ..$#priorities;
     189    @allLabels = @allLabels[@idx];
     190    @priorities = @priorities[@idx];
     191
     192    my @idx2 = sort {$priorities2[$a] <=> $priorities2[$b]} 0 ..$#priorities2;
     193    @allLabels2 = @allLabels2[@idx2];
     194    @priorities2 = @priorities2[@idx2];
    138195
    139196    # store them all in stdscience:
    140197    $server = "stdscience";
    141198    if (@allLabels) {
    142         $czarDb->updateCurrentLabels($server, \@allLabels);
     199        $czarDb->updateCurrentLabels($server, \@allLabels,'gpc1', \@priorities);
    143200    } else {
    144         print "WARNING: No labels to update for '$server'\n";
    145     }
     201        print "WARNING: No labels to update for gpc1 for '$server'\n";
     202    }
     203
     204    if (@allLabels2) {
     205        $czarDb->updateCurrentLabels($server, \@allLabels2,'gpc2', \@priorities2);
     206    } else {
     207        print "WARNING: No labels to update for gpc2 for '$server'\n";
     208    }
     209    return(\@allLabels,\@allLabels2);
    146210}
    147211
     
    160224    my $running = undef;
    161225    foreach $server (@{$servers}) {
    162 
    163         $pantasks->getServerStatus($server, \$alive, \$running);
    164         $czarDb->updateServerStatus($server, $alive, $running);
    165     }
     226        $pantasks->getServerStatus($server,'gpc1', \$alive, \$running);
     227        $czarDb->updateServerStatus($server,'gpc1', $alive, $running);
     228        $pantasks->getServerStatus($server,'gpc2', \$alive, \$running);
     229        $czarDb->updateServerStatus($server,'gpc2', $alive, $running);
     230   }
    166231}
    167232
     
    182247    my $str = undef;
    183248    my $labels = undef;
     249    my $labels2 = undef;
    184250    my $updateLabels = undef;
    185251    my $row = undef;
     
    187253    my $end = undef;
    188254    my $priority = undef;
     255    my $priority2 = undef;
    189256    my $newState = undef;
    190257    my $nsStatus = undef;
     
    227294
    228295                # now cleanup tables from yesterday and optimize
    229                 print "* Performing database cleanup\n";
    230                 $czarDb->cleanupDateRange($yesterday, $yesterday, $config->getCzarCleanupInterval());
    231                 print "* Optimizing the database\n";
    232                 $czarDb->optimize();
     296                #TdB20190703: The ipp113 and ipp117 instances of czarpoll use the same stage DBs in czarDB.
     297                #Therefore, it makes no sense to run the cleanup+optimising twice
     298                #print "* Performing database cleanup\n";
     299                #$czarDb->cleanupDateRange($yesterday, $yesterday, $config->getCzarCleanupInterval());
     300                #print "* Optimizing the database\n";
     301                #$czarDb->optimize();
    233302                $lastDayDailyTasks = $yesterday;
    234303            }
     
    237306        # check nightly science status
    238307        print "* Checking nightly science status\n";
    239         if (!$pantasks->getNightlyScienceStatus(\$nsStatus)) {$nsStatus = "Unknown";}
    240         $czarDb->updateNightlyScience($nsStatus);
     308        if (!$pantasks->getNightlyScienceStatus(\$nsStatus,'gpc1')) {$nsStatus = "Unknown";}
     309        $czarDb->updateNightlyScience($nsStatus,'gpc1');
     310        if (!$pantasks->getNightlyScienceStatus(\$nsStatus,'gpc2')) {$nsStatus = "Unknown";}
     311        $czarDb->updateNightlyScience($nsStatus,'gpc2');
    241312
    242313        # check nebulous
     
    252323
    253324        # check labels
    254         updateLabels();
     325        my ($labels, $labels2) = updateLabels();
     326        my @labels = @$labels;
     327        my @labels2 = @$labels2;
    255328
    256329        # servers to check
     
    265338
    266339            # deal with stdscience labels
    267             if (!$czarDb->getCurrentLabels($thisServer, \$labels)) {next;}
    268340            my $size = @{$labels};
    269341            if($size > 0) {
    270 
    271                 # get priority
    272                 foreach $row ( @{$labels} ) {
    273                     my ($label) = @{$row};
    274                     # for now use priorities from gpc1 database
    275                     $priority = $gpc1Db->getPriority($label);
    276                     $czarDb->setLabelPriority($label, $priority);
    277                 }
    278 
    279                 updateAllStages($thisServer, $newState, $labels, $begin, $end);
     342                updateAllStages($thisServer, $newState, $labels,$labels2, $begin, $end);
    280343                if ($thisServer eq "stdscience") {
    281344                    createPlots($thisServer, $plotter1, $labels, $begin, $end);
    282                     createPlots($thisServer, $plotter2, $labels, $begin, $end);
     345                    createPlots($thisServer, $plotter2, $labels2, $begin, $end);
    283346                }
    284347            }
     
    376439    #  #  $plotter->createTimeSeries($label, undef, $begin, $end, 1, 1, 1);
    377440
    378     #    #TdB 20190411: Make the all stages plots for the nightlyscience labels only
    379441    #    if ($label =~ m/nightlyscience/) {
    380442    #      $plotter->createTimeSeries($label, undef, $begin, $end, 1, 0, 1);
     
    382444    #}
    383445
    384     $allServerLabels = "all_".$server."_labels";
    385 
    386     $plotter->createTimeSeries($allServerLabels, undef, $begin, $end, 1, 0, 1);
    387 
    388     #TdB 20190411: We are turning off these plots for the time being. They take up a lot of time and are rarely looked at. If need be, can be generated on the fly using czartool.
     446    $allServerLabels = $server."_labels";
     447
     448    $plotter->createTimeSeries($allServerLabels, undef, $begin, $end, 1, 1, 1);
     449
    389450    foreach $stage (@stages) {
    390         $plotter->createTimeSeries($allServerLabels, $stage, $begin, $end, 1, 0, 1); # TODO must be a neater way...
     451        $plotter->createTimeSeries($allServerLabels, $stage, $begin, $end, 1, 0, 0); # TODO must be a neater way...
    391452    }
    392453}
     
    398459###########################################################################
    399460sub updateAllStages {
    400     my ($labelServer, $newState, $rows, $begin, $end) = @_;
     461    my ($labelServer, $newState, $rows, $rows2, $begin, $end) = @_;
    401462
    402463    print "* Updating stage data\n";
     
    419480    foreach $stage (@stages) {
    420481        $server = $pantasks->getServerForThisStage($stage);
    421         $pantasks->getRevertStatus($stage, \$reverting);
    422         $czarDb->updateRevertStatus($stage, $reverting);
     482        $pantasks->getRevertStatus($stage,'gpc1', \$reverting);
     483        $czarDb->updateRevertStatus($stage,'gpc1', $reverting);
     484
     485        $pantasks->getRevertStatus($stage,'gpc2', \$reverting);
     486        $czarDb->updateRevertStatus($stage,'gpc2', $reverting);
    423487
    424488        print "* Checking labels for $stage stage\n";
     
    427491        if (($stage eq 'summitExp')||($stage eq 'downloadExp')||($stage eq 'newExp')||($stage eq 'rawExp')) {
    428492            ($new,$full,$faults) = $gpc1Db->countRawExposures($today,$stage);
    429             $czarDb->insertNewTimeData($stage, "all_".$labelServer."_labels", 'gpc1', $new, $full, $faults);
     493            $czarDb->insertNewTimeData($stage, $labelServer."_labels", 'gpc1', $new, $full, $faults);
    430494
    431495            ($new,$full,$faults) = $gpc2Db->countRawExposures($today,$stage);
    432             $czarDb->insertNewTimeData($stage, "all_".$labelServer."_labels", 'gpc2', $new, $full, $faults);
     496            $czarDb->insertNewTimeData($stage, $labelServer."_labels", 'gpc2', $new, $full, $faults);
    433497
    434498            next;
    435499        }
    436500
    437 
     501        #count the number of exposures under each label, and their faults
    438502        $totalNew1=$totalFaults1=$totalFull1=0;
    439         $totalNew2=$totalFaults2=$totalFull2=0;
    440503        foreach $row ( @{$rows} ) {
    441             my ($label) = @{$row};
     504            my ($label) = $row;
    442505
    443506            chomp($label);
     
    447510            $full = $gpc1Db->countExposures($label, $stage, "full");
    448511            $faults = $gpc1Db->countFaults($label, $stage, $newState);
    449             #printf("%s  %s, %s, %d, %d\n", $labelServer, $label, $stage, $new, $faults);
    450512            $totalNew1 += $new;
    451513            $totalFull1 += $full;
     
    453515
    454516            $czarDb->insertNewTimeData($stage, $label, 'gpc1', $new, $full, $faults);
    455 
     517        }
     518
     519        $totalNew2=$totalFaults2=$totalFull2=0;
     520        foreach $row ( @{$rows2} ) {
     521            my ($label) = $row;
     522
     523            chomp($label);
     524
     525            # Move this to a function and pass in the database
    456526            $new = $gpc2Db->countExposures($label, $stage, $newState);
    457527            $full = $gpc2Db->countExposures($label, $stage, "full");
    458528            $faults = $gpc2Db->countFaults($label, $stage, $newState);
    459             #printf("%s  %s, %s, %d, %d\n", $labelServer, $label, $stage, $new, $faults);
    460529            $totalNew2 += $new;
    461530            $totalFull2 += $full;
     
    465534        }
    466535
    467         $czarDb->insertNewTimeData($stage, "all_".$labelServer."_labels", 'gpc1', $totalNew1, $totalFull1, $totalFaults1);
    468         $czarDb->insertNewTimeData($stage, "all_".$labelServer."_labels", 'gpc2', $totalNew2, $totalFull2, $totalFaults2);
    469     }
    470 }
    471 
     536        $czarDb->insertNewTimeData($stage, $labelServer."_labels", 'gpc1', $totalNew1, $totalFull1, $totalFaults1);
     537        $czarDb->insertNewTimeData($stage, $labelServer."_labels", 'gpc2', $totalNew2, $totalFull2, $totalFaults2);
     538    }
     539}
     540
  • trunk/ippMonitor/czartool/czartool.pl

    r38206 r40840  
    1515my $save_temps = 1;
    1616my $interval = undef;
     17my $telescope = "gpc1";
    1718
    1819GetOptions (
    1920        "dbname|d=s" => \$czarDbName,
    2021        "interval|i=s" => \$interval,
     22        "telescope|t=s" => \$telescope,
    2123        );
    22 
    2324
    2425my @states = ("full", "new", "drop", "wait");
     
    2627my $czarDb = $config->getCzarDbInstance();
    2728my $gpc1Db = $config->getGpc1Instance();
     29my $gpc2Db = $config->getGpc2Instance();
    2830my $pantasks = new czartool::Pantasks();
    2931
     
    5557sub promptPoll {
    5658
    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)};
    6062    @publishingLabels = @stdscienceLabels;
    61     checkAllLabels("new");
     63    checkAllLabels("new", $telescope);
    6264    printInstructions();
    6365
     
    6870
    6971        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);}
    7375        printInstructions();
    7476
     
    139141###########################################################################
    140142sub labelDetails {
     143    my ($telescope) = @_;
    141144
    142145    print "\nPlease enter the label name, or number from table above: ";
     
    144147    chomp($input);
    145148    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);
    150153}
    151154
     
    156159###########################################################################
    157160sub checkOneLabel {
    158     my ($label) = @_;
     161    my ($label, $telescope) = @_;
    159162
    160163    chomp($label);
     
    188191        foreach $stage (@stages) {
    189192
    190             printf("|%14s", getStateAndFaultsString($label, $state, $stage));
     193            printf("|%14s", getStateAndFaultsString($label, $state, $stage, $telescope));
    191194        }
    192195
     
    209212###########################################################################
    210213sub checkAllLabels {
    211     my ($state) = @_;
     214    my ($state, $telescope) = @_;
    212215#print time, $/;
    213216    my $stage;
     
    259262        foreach $stage (@stages) {
    260263
    261             printf("|%14s", getStateAndFaultsString($stdsLabel, $state, $stage));
     264            printf("|%14s", getStateAndFaultsString($stdsLabel, $state, $stage, $telescope));
    262265        }
    263266
     
    280283###########################################################################
    281284sub 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    }
    289305
    290306    if ($faults < 1) {return $new;}
  • trunk/ippMonitor/czartool/czartool/CzarDb.pm

    r40702 r40840  
    137137###########################################################################
    138138sub updateServerStatus {
    139     my ($self, $server, $alive, $running) = @_;
    140 
    141     my $query = $self->{_db}->prepare(<<SQL);
    142     INSERT INTO servers
    143         (server, alive, running)
     139    my ($self, $server,$telescope, $alive, $running) = @_;
     140
     141    my $query = $self->{_db}->prepare(<<SQL);
     142    INSERT INTO science_servers
     143        (server,telescope, alive, running)
    144144        VALUES
    145         ('$server', $alive, $running);
     145        ('$server','$telescope', $alive, $running);
    146146SQL
    147147
     
    173173###########################################################################
    174174sub updateRevertStatus {
    175     my ($self, $stage, $reverting) = @_;
    176 
    177     my $query = $self->{_db}->prepare(<<SQL);
    178      UPDATE reverts
     175    my ($self, $stage,$telescope, $reverting) = @_;
     176
     177    my $query = $self->{_db}->prepare(<<SQL);
     178     UPDATE science_reverts
    179179         SET reverting = $reverting
    180          WHERE stage LIKE '$stage';
    181 SQL
    182 
    183     $query->execute;
    184 }
    185 
    186 ###########################################################################
    187 #
    188 # Sets priority for this label
    189 #
    190 ###########################################################################
    191 sub setLabelPriority {
    192     my ($self, $label, $priority) = @_;
    193 
    194     my $query = $self->{_db}->prepare(<<SQL);
    195      UPDATE current_labels
    196          SET priority = $priority
    197          WHERE label LIKE '$label'
    198          AND server LIKE 'stdscience';
     180         WHERE stage LIKE '$stage' AND telescope LIKE '$telescope';
    199181SQL
    200182
     
    211193
    212194    my $query = $self->{_db}->prepare(<<SQL);
    213     DELETE FROM server_dates;
     195    DELETE FROM science_server_dates;
     196
    214197SQL
    215198
     
    223206###########################################################################
    224207sub updateServerDates {
    225     my ($self, $server, $dates) = @_;
     208    my ($self, $server, $dates,$telescope) = @_;
    226209
    227210    my $size = scalar @{$dates};
     
    233216
    234217        my $query = $self->{_db}->prepare(<<SQL);
    235         INSERT INTO server_dates
    236             (server, date)
     218        INSERT INTO science_server_dates
     219            (server, telescope, date)
    237220            VALUES
    238             ('$server', '$date');
     221            ('$server','$telescope', '$date');
    239222SQL
    240223
     
    249232###########################################################################
    250233sub updateNightlyScience {
    251     my ($self, $status) = @_;
    252 
    253     my $query = $self->{_db}->prepare(<<SQL);
    254     DELETE FROM nightlyscience;
     234    my ($self, $status,$telescope) = @_;
     235
     236    my $query = $self->{_db}->prepare(<<SQL);
     237    DELETE FROM science_nightlyscience WHERE telescope LIKE '$telescope';
    255238SQL
    256239
     
    258241
    259242    $query = $self->{_db}->prepare(<<SQL);
    260     INSERT INTO nightlyscience
    261         (status)
     243    INSERT INTO science_nightlyscience
     244        (status, telescope)
    262245        VALUES
    263         ('$status');
     246        ('$status', '$telescope');
    264247SQL
    265248
     
    269252###########################################################################
    270253#
    271 # Updates current_labels table
     254# Updates science_labels table
    272255#
    273256###########################################################################
    274257sub updateCurrentLabels {
    275     my ($self, $server, $labels) = @_;
     258    my ($self, $server, $labels, $telescope,$priorities) = @_;
    276259
    277260    my $size = scalar @{$labels};
    278261    if ($size < 1) { return; }
    279     if ($server eq 'stdscience') {
     262#    if (($server eq 'stdscience') && ($telescope eq 'gpc1')) {
    280263        ## EAM 20180510 : manually adding label used for Pole reprocessing
    281264        ## I would like to add an external file to manage these extra
    282265        ## labels, but this suffices for now
    283         push @{$labels}, 'PV3.Pole.Reprocess.20180510';
    284         push @{$labels}, 'ps_ud_QUB';
    285     }
    286 
    287     my $query = $self->{_db}->prepare(<<SQL);
    288     DELETE FROM current_labels WHERE server LIKE '$server';
     266#        push @{$labels}, 'PV3.Pole.Reprocess.20180510';
     267#       push @{$labels}, 'ps_ud_QUB';
     268#        push @{priorities}, 50000;
     269#       push @{priorities}, 415;
     270#    }
     271
     272    my $query = $self->{_db}->prepare(<<SQL);
     273    DELETE FROM science_labels WHERE server LIKE '$server' AND telescope LIKE '$telescope';
    289274SQL
    290275
     
    292277
    293278    my $label = undef;
    294 
    295     foreach $label (@{$labels}) {
     279    my $priority = undef;
     280
     281    foreach my $i (0 .. $#$labels) {
     282        $label = @{$labels}[$i];
     283        $priority = @{$priorities}[$i];
    296284
    297285        my $query = $self->{_db}->prepare(<<SQL);
    298         INSERT INTO current_labels
    299             (server, label)
     286        INSERT INTO science_labels
     287            (server, label,telescope,priority)
    300288            VALUES
    301             ('$server', '$label');
     289            ('$server', '$label','$telescope',$priority);
    302290SQL
    303291
  • trunk/ippMonitor/czartool/czartool/Pantasks.pm

    r40085 r40840  
    2424        );
    2525
    26 my $ipphome = "/data/ippc64.1/ippitc";
    27 
    2826###########################################################################
    2927#
     
    8684###########################################################################
    8785sub getNightlyScienceStatus {
    88     my ($self, $status) = @_;
     86    my ($self, $status,$telescope) = @_;
    8987
    9088    my @labels;
     89    my $ipphome;
     90
     91    if ($telescope eq 'gpc1') {
     92       $ipphome = "/data/ippc64.1/ippitc";
     93    }
     94    elsif ($telescope eq 'gpc2') {
     95       $ipphome = "/data/ippc18.0/home/ippps2";
     96    }
     97    else {
     98        print "WARNING: Must specify a telescope for connecting to the right pantask\n";
     99    }
    91100
    92101    my ($day, $month, $year) = (localtime)[3,4,5];
     
    102111        if ($line =~ m/$today\s+(.+)/) {
    103112            ${$status} = $1;
     113            if (${$status} =~ m/ $telescope/) {
     114            ${$status} = $`;
     115            }
     116
    104117            return 1;
    105118        }
     
    111124###########################################################################
    112125#
    113 # Gets labels for provided server
     126# Gets labels for provided server for gpc1
    114127#
    115128###########################################################################
    116129sub getLabels {
    117     my ($self, $server) = @_;
     130    my ($self, $server,$telescope) = @_;
    118131
    119132    my @labels;
    120 
    121     # print "stdscience : $ipphome/$server/ptolemy.rc\n";
     133    my $ipphome;
     134
     135    if ($telescope eq 'gpc1') {
     136       $ipphome = "/data/ippc64.1/ippitc";
     137    }
     138    elsif ($telescope eq 'gpc2') {
     139       $ipphome = "/data/ippc18.0/home/ippps2";
     140    }
     141    else {
     142        print "WARNING: Must specify a telescope for connecting to the right pantask\n";
     143    }
     144
    122145    my @cmdOut = `echo "show.labels;quit" | pantasks_client -c $ipphome/$server/ptolemy.rc 2>&1`;
    123146    my $line;
     
    149172###########################################################################
    150173sub getServerStatus {
    151     my ($self, $server, $alive, $running) = @_;
     174    my ($self, $server,$telescope, $alive, $running) = @_;
     175
     176    my $ipphome;
     177
     178    if ($telescope eq 'gpc1') {
     179       $ipphome = "/data/ippc64.1/ippitc";
     180    }
     181    elsif ($telescope eq 'gpc2') {
     182       $ipphome = "/data/ippc18.0/home/ippps2";
     183    }
     184    else {
     185        print "WARNING: Must specify a telescope for connecting to the right pantask\n";
     186    }
    152187
    153188    my @cmdOut = `echo "status ; quit" | pantasks_client -c $ipphome/$server/ptolemy.rc 2>&1`;
     
    170205###########################################################################
    171206sub getServerCurrentStatus {
    172     my ($self, $server) = @_;
     207    my ($self, $server,$telescope) = @_;
     208
     209    my $ipphome;
     210    if ($telescope eq 'gpc1') {
     211       $ipphome = "/data/ippc64.1/ippitc";
     212    }
     213    elsif ($telescope eq 'gpc2') {
     214       $ipphome = "/data/ippc18.0/home/ippps2";
     215    }
     216    else {
     217        print "WARNING: Must specify a telescope for connecting to the right pantask\n";
     218    }
    173219
    174220    my @cmdOut = `echo "status;quit" | pantasks_client -c $ipphome/$server/ptolemy.rc 2>&1`;
     
    189235###########################################################################
    190236sub getRevertStatus {
    191     my ($self, $stage, $reverting) = @_;
     237    my ($self, $stage,$telescope, $reverting) = @_;
     238
     239    my $ipphome;
     240    if ($telescope eq 'gpc1') {
     241       $ipphome = "/data/ippc64.1/ippitc";
     242    }
     243    elsif ($telescope eq 'gpc2') {
     244       $ipphome = "/data/ippc18.0/home/ippps2";
     245    }
     246    else {
     247        print "WARNING: Must specify a telescope for connecting to the right pantask\n";
     248    }
    192249
    193250    my $server = $self->getServerForThisStage($stage);
     
    214271###########################################################################
    215272sub getDates {
    216     my ($self, $server) = @_;
     273    my ($self, $server,$telescope) = @_;
    217274
    218275    my @dates;
    219276
    220277    my $prefix;
     278    my $ipphome;
     279
     280    if ($telescope eq 'gpc1') {
     281       $ipphome = "/data/ippc64.1/ippitc";
     282    }
     283    elsif ($telescope eq 'gpc2') {
     284       $ipphome = "/data/ippc18.0/home/ippps2";
     285    }
     286    else {
     287        print "WARNING: Must specify a telescope for connecting to the right pantask\n";
     288    }
    221289
    222290    if ($server eq "stdscience") {$prefix = "ns";}
  • trunk/ippMonitor/raw/czartool_getplot.php

    r38258 r40840  
    2222$path = $CZARPLOTDIR;
    2323
    24 if ($label == "all") $label = "all_".$mode."_labels";
     24if ($label == "all") $label = $mode."_labels";
    2525
    2626if ($type=="t" || $type=="r" || $type=="rt" || $type=="rh")
  • trunk/ippMonitor/raw/czartool_labels.php

    r40427 r40840  
    9090        # "publishing",
    9191        "registration",
    92         "replication",
    9392        "stack",
    9493        # "deepstack",
     
    139138
    140139// $labels is generated with sequential integer key values
    141 $labels = getLabels($czardb, $selectedMode);
    142 $distLabelsIndex = getLabels($czardb, "distribution");
     140$labels = getLabels($czardb, $proj, $selectedMode);
     141$distLabelsIndex = getLabels($czardb, $proj, "distribution");
    143142for ($i = 0; $i < count($distLabelsIndex); $i++) {
    144143  $distLabelsExist[$distLabelsIndex[$i]] = true;
     
    195194echo "<td style=width:100px;text-align:top;\">";
    196195 # time series plot
    197 echo "<br><img src=\"czartool_getplot.php?mode=$selectedMode&type=t&label=$selectedLabel&proj=$proj&stage=$selectedStage&plottype=$plotType\"><br>";
     196echo "<br><img src=\"czartool_getplot.php?mode=$selectedMode&type=t&label=$selectedLabel&proj=$proj&stage=$selectedStage&plottype=linear\"><br>";
     197# log time series plot
     198echo "<br><img src=\"czartool_getplot.php?mode=$selectedMode&type=t&label=$selectedLabel&proj=$proj&stage=$selectedStage&plottype=log\"><br>";
    198199 # rate time series plot
    199200echo "<br><img src=\"czartool_getplot.php?mode=$selectedMode&type=rt&label=$selectedLabel&proj=$proj&stage=$selectedStage&plottype=linear\"><br>";
    200  # rate stacked histo plot
    201 # echo "<img src=\"czartool_getplot.php?mode=$selectedMode&type=rh&label=$selectedLabel&proj=$proj&stage=$selectedStage&plottype=linear\"><br>";
    202201 # histogram plot
    203202# echo "<img src=\"czartool_getplot.php?mode=$selectedMode&type=h&label=$selectedLabel&proj=$proj&stage=$selectedStage&plottype=linear\"><br>";
     
    218217
    219218// status table at top
    220 $nsStatus = getNightlyScienceStatus($czardb);
     219$nsStatus = getNightlyScienceStatus($czardb, $proj);
    221220$plotTypeLink = ($plotType == "linear") ? "log" : "linear";
    222221$link = "czartool_labels.php?pass=" . $pass . "&proj=" . $proj . "&label=" . $selectedLabel . "&stage=" . $selectedStage . "&revertstage=" . $stage . "&plottype=$plotTypeLink";
     
    232231echo "<tr><td>Documentation</td><td><a href=\"http://svn.pan-starrs.ifa.hawaii.edu/trac/ipp/wiki/Processing\"><font color=\"blue\">here</font></a></td></tr>";
    233232echo "<tr><td>Cluster load</td><td><a href=\"http://ganglia.pan-starrs.ifa.hawaii.edu/?r=hour&s=descending&hc=6&c=IPP%2520Production\"><font color=\"blue\">here</font></a> <a href=\"http://ganglia.pan-starrs.ifa.hawaii.edu/?m=cpu_report&r=hour&s=by%2520name&c=IPP+Production&h=&sh=1&hc=8&z=small\"><font color=\"blue\">cpu_report</font></a> <a href=\"http://ganglia.pan-starrs.ifa.hawaii.edu/?m=mem_report&r=hour&s=by%2520name&c=IPP+Production&h=&sh=1&hc=8&z=small\"><font color=\"blue\">mem_report</font></a></td></tr>";
    234 echo "<tr><td>Who's using the cluster?</td><td><a href=\"http://ippmonitor.ipp.ifa.hawaii.edu/ippMonitor/clusterMonitor/index.php\"><font color=\"blue\">here</font></a></td></tr>";
    235 echo "<tr><td>Files monitor</td><td><a href=\"http://ippmonitor.ipp.ifa.hawaii.edu/diskMonitor\"><font color=\"blue\">here</font></a></td></tr>";
    236 echo "<tr><td>IPP metrics</td><td><a href=\"http://ipp0022.ifa.hawaii.edu/ps1sc/ippMetrics\"><font color=\"blue\">here</font></a></td></tr>";
    237 echo "<tr><td>Czar log pages</td><td><a href=\"http://svn.pan-starrs.ifa.hawaii.edu/trac/ipp/wiki/PS1_IPP_CzarLogs\"><font color=\"blue\">All</font></a>&nbsp;&nbsp;&nbsp;";
    238 echo "<a href=\"http://svn.pan-starrs.ifa.hawaii.edu/trac/ipp/wiki/PS1_IPP_Czarlog_".(date("Ymd")-date("w")+"1")."\">This week</a>";
    239 echo "</td></tr>";
     233echo "<tr><td>IPP metrics</td><td><a href=\"https://ps1wiki.ifa.hawaii.edu/data/metrics/index.html\"><font color=\"blue\">here</font></a></td></tr>";
     234echo "<tr><td>Czar log pages</td><td><a href=\"https://confluence.ipp.ifa.hawaii.edu/pages/viewrecentblogposts.action?key=IPPCZAR\"><font color=\"blue\">here</font></a></td></tr>";
    240235echo "<tr><td>Exposure summary</td><td><a href=\"czartool_exposures.php?pass=$pass&proj=$proj\"><font color=\"blue\">here</font></a></td></tr>";
     236echo "<tr><td>Confluence</td><td><a href=\"https://confluence.ipp.ifa.hawaii.edu/display/IPPCZAR/IPP-Czaring+Home\"><font color=\"blue\">here</font></a></td></tr>";
     237echo "<tr><td>JIRA</td><td><a href=\"https://jira.ipp.ifa.hawaii.edu/secure/Dashboard.jspa\"><font color=\"blue\">here</font></a></td></tr>";
    241238
    242239$plotTypeLink = ($plotType == "linear") ? "log" : "linear";
     
    266263      createServersTable($pass, $proj,$selectedMode,$czardb, $servers, $selectedLabel, $selectedStage, $plotType); echo "<br>";
    267264      createSummitDataTable($projectdb); echo "<br>"; // this is slow because of the join between summitExp and rawExp
    268       createDatesTable($czardb); echo "<br>";
    269 
    270       # This is awful
     265      createChunkDataTable($projectdb); echo "<br>";
     266      createDatesTable($czardb, $proj); echo "<br>";
     267
    271268      echo $table;
    272269      echo "<tr>";
    273       createTableTitle("Database replication status (update fix log <a href=\"http://svn.pan-starrs.ifa.hawaii.edu/trac/ipp/wiki/Replication_Issues\">here</a>)", 2);
     270      createTableTitle("Database status (update fix log <a href=\"http://svn.pan-starrs.ifa.hawaii.edu/trac/ipp/wiki/Replication_Issues\">here</a>)", 2);
    274271
    275272      echo "<tr>";
    276273      createTableColumnHeader("Database");
    277274      createTableColumnHeader("Status (sec behind master)");
     275      showDatabaseStatus($HOST_GPC1, $USER_GPC1, $PASSWORD_GPC1, $DBNAME_GPC1);
    278276      showReplicationsStatus($REPL_HOST_GPC1, $REPL_USER_GPC1, $REPL_PASSWORD_GPC1, $REPL_DBNAME_GPC1);
    279277      showReplicationsStatus($REPL_HOST_GPC1_SECONDARY, $REPL_USER_GPC1_SECONDARY, $REPL_PASSWORD_GPC1_SECONDARY, $REPL_DBNAME_GPC1_SECONDARY);
    280278
     279      echo "<tr>";
     280
     281      showDatabaseStatus($HOST_NEBULOUS, $USER_NEBULOUS, $PASSWORD_NEBULOUS, $DBNAME_NEBULOUS);
    281282      showReplicationsStatus($REPL_HOST_NEBULOUS, $REPL_USER_NEBULOUS, $REPL_PASSWORD_NEBULOUS, $REPL_DBNAME_NEBULOUS);
    282283      showReplicationsStatus($REPL_HOST_NEBULOUS_SECONDARY, $REPL_USER_NEBULOUS_SECONDARY, $REPL_PASSWORD_NEBULOUS_SECONDARY, $REPL_DBNAME_NEBULOUS_SECONDARY);
     284      showReplicationsStatus($REPL_HOST_DATASTORE_SECONDARY, $REPL_USER_DATASTORE_SECONDARY, $REPL_PASSWORD_DATASTORE_SECONDARY, $REPL_DBNAME_DATASTORE_SECONDARY);
    283285
    284286#     some mysql replication slaves to add when they are returned to service
    285287#     showReplicationsStatus($REPL_HOST_PSTAMP, $REPL_USER_PSTAMP, $REPL_PASSWORD_PSTAMP, $REPL_DBNAME_PSTAMP);
    286 #     showReplicationsStatus($REPL_HOST_IPPADMIN, $REPL_USER_IPPADMIN, $REPL_PASSWORD_IPPADMIN, $REPL_DBNAME_IPPADMIN);  --- this one is in GPC1
    287288#     showReplicationsStatus($REPL_HOST_ISP, $REPL_USER_ISP, $REPL_PASSWORD_ISP, $REPL_DBNAME_ISP);
    288289      echo "</table>";
     290
     291      echo $table;
     292      echo "<tr>";
     293      createTableTitle("Critical machine status", 2);
     294
     295      echo "<tr>";
     296      createTableColumnHeader("Hostname");
     297      createTableColumnHeader("Status");
     298      showPingStatus($HOST_GATEWAY, $DBNAME_GATEWAY);
     299      showPingStatus($HOST_GATEWAY_SECONDARY, $DBNAME_GATEWAY_SECONDARY);
     300
     301#      showPingStatus($HOST_APACHE1, $DBNAME_APACHE1);
     302      showPingStatus($HOST_APACHE2, $DBNAME_APACHE2);
     303      showPingStatus($HOST_APACHE3, $DBNAME_APACHE3);
     304      showPingStatus($HOST_APACHE4, $DBNAME_APACHE4);
     305      showPingStatus($HOST_APACHE5, $DBNAME_APACHE5);
     306      showPingStatus($HOST_APACHE6, $DBNAME_APACHE6);
     307      showPingStatus($HOST_PROXY, $DBNAME_PROXY);
     308      showPingStatus($HOST_SVN, $DBNAME_SVN);
     309      showPingStatus($HOST_CONFLUENCE, $DBNAME_CONFLUENCE);
     310
     311      echo "</table>";
     312
    289313echo "</table>";
    290314menu_end();
     
    401425###########################################################################
    402426#
     427# Creates a table of chunk progress
     428#
     429###########################################################################
     430function createChunkDataTable($projectdb) {
     431
     432    #First find the reference exposure ID to speed up the subsequent queries
     433    $date = gmdate("Y-m-d");
     434    $sql = "SELECT MAX(exp_id) FROM rawExp WHERE dateobs >= date_sub('$date', interval 20 day) AND dateobs <= date_sub('$date', interval 10 day)";
     435    $qry = $projectdb->query($sql);
     436    if (dberror($qry)) {
     437        print "*** WARNING: no data in period 10-20 days before requested date (query will be slower) **\n";
     438        $refExpID = 0;
     439    }
     440    $qry->fetchInto($refExpID);
     441
     442    #Find the number of chunks
     443    $query = "SELECT groupchunk.chunk,groupchunk.Nquad_firstvisit,group4.Nquad_fourvisits FROM";
     444    $query .= "   (";
     445    $query .= "     SELECT dateobs,comment,substr(comment, 1, position(' ' in comment)) AS chunk,count(distinct(comment)) AS Nquad_firstvisit";
     446    $query .= "     FROM rawExp";
     447    $query .= "     WHERE dateobs LIKE '$date%' AND exp_id > $refExpID[0]";
     448    $query .= "     AND (obs_mode LIKE '%SS%' OR obs_mode LIKE '%BRIGHT%') AND obs_mode NOT LIKE 'ENGINEERING'";
     449    $query .= "     AND comment LIKE '%visit 1%'";
     450    $query .= "     GROUP BY chunk";
     451    $query .= "   ) AS groupchunk";
     452    $query .= "   LEFT JOIN";
     453    $query .= "   (";
     454    $query .= "     SELECT groupobj.chunk,count(*) AS Nquad_fourvisits FROM ";
     455    $query .= "       (SELECT substr(comment, 1, position(' ' in comment)) AS chunk,count(distinct(comment)) AS Nvisits";
     456    $query .= "         FROM rawExp";
     457    $query .= "         WHERE dateobs LIKE '$date%' AND exp_id > $refExpID[0] AND (obs_mode LIKE '%SS%' OR obs_mode LIKE '%BRIGHT%')";
     458    $query .= "         AND obs_mode NOT LIKE 'ENGINEERING' AND comment LIKE '%visit%'";
     459    $query .= "         GROUP BY object, filter, chunk";
     460    $query .= "       ) AS groupobj";
     461    $query .= "     WHERE groupobj.Nvisits = 4 ";
     462    $query .= "     GROUP BY groupobj.chunk";
     463    $query .= "   ) AS group4";
     464    $query .= "   on groupchunk.chunk=group4.chunk ORDER BY dateobs";
     465
     466    #$sql = "SELECT DISTINCT substr(comment, 1, position(' ' in comment)) FROM rawExp WHERE dateobs LIKE '$date%' AND exp_id > $refExpID AND (obs_mode LIKE '%SS%' OR obs_mode LIKE '%BRIGHT%') AND obs_mode NOT LIKE 'ENGINEERING' AND comment LIKE '%visit 1%'";
     467
     468    $qry = $projectdb->query($query);
     469    if (dberror($qry)) {
     470        echo "<b>error reading rawExp table</b><br>\n";
     471        echo "<br><small><b> table query : $query </b></small><br>\n";
     472        menu_end();
     473    }
     474
     475    // set up the table
     476    global $table;
     477    echo $table;
     478    echo "<tr>";
     479    createTableTitle("Status of last night's chunks", 5);
     480    echo "<tr>";
     481    createTableColumnHeader("Chunk");
     482    createTableColumnHeader("Nobs_1stvisit");
     483    createTableColumnHeader("Nobs_4visits");
     484    createTableColumnHeader("Ndiffs_published");
     485    createTableColumnHeader("Completion");
     486
     487    $msg = "No science images taken since $date";
     488
     489    // list the results
     490    while ($qry->fetchInto($row)) {
     491        $Nfirstvisits = 0;
     492        $Nfourvisits = 0;
     493
     494        $chunkname = $row[0];
     495        if($row[1] > 0) $Nfirstvisits = $row[1];
     496        if($row[2] > 0) $Nfourvisits = $row[2];
     497
     498        $query2 = "     SELECT warp_id FROM ";
     499        $query2 .= "           warpRun JOIN fakeRun USING (fake_id) JOIN camRun USING (cam_id) JOIN camProcessedExp USING (cam_id) JOIN chipRun USING (chip_id) JOIN rawExp USING (exp_id)";
     500        $query2 .= "           WHERE rawExp.dateobs LIKE '$date%' AND exp_id > $refExpID[0] AND (obs_mode LIKE '%SS%' OR obs_mode LIKE '%BRIGHT%')";
     501        $query2 .= "           AND substr(comment, 1, position(' ' in comment)) LIKE '$chunkname%'";
     502        $qry2 = $projectdb->query($query2);
     503
     504        $Ndiffs = 0;
     505        while ($qry2->fetchInto($row2)) {
     506            $query3 = "     SELECT diff_id FROM ";
     507            $query3 .= "           diffRun JOIN diffInputSkyfile USING (diff_id) JOIN publishRun ON (diff_id = stage_id) JOIN warpRun ON (warp1=warp_id)";
     508            $query3 .= "           WHERE stack2 IS NULL AND publishRun.state LIKE 'full' AND warp_id='$row2[0]' GROUP BY diff_id";
     509            $qry3 = $projectdb->query($query3);
     510            while ($qry3->fetchInto($row3)) {
     511                if ($row3[0] !=0) $Ndiffs ++;
     512            }
     513
     514            $query3 = "     SELECT diff_id FROM ";
     515            $query3 .= "           diffRun JOIN diffInputSkyfile USING (diff_id) JOIN publishRun ON (diff_id = stage_id) JOIN warpRun ON (warp2=warp_id)";
     516            $query3 .= "           WHERE stack2 IS NULL AND publishRun.state LIKE 'full' AND warp_id='$row2[0]' GROUP BY diff_id";
     517            $qry3 = $projectdb->query($query3);
     518            while ($qry3->fetchInto($row3)) {
     519                if ($row3[0] !=0) $Ndiffs ++;
     520            }
     521        }
     522
     523        if ($Ndiffs != ($Nfirstvisits*4)) $complete = "chunk not done"; 
     524        if ($Ndiffs == ($Nfirstvisits*4)) $complete = "chunk done";       
     525
     526        if ($Nfirstvisits != $Nfourvisits) {
     527            $Ndiffs .= "/?  ";
     528        }
     529        if ($Nfirstvisits == $Nfourvisits) {
     530            $Ndiffs .= "/";
     531            $Ndiffs .= $Nfirstvisits*4;
     532        }
     533
     534        echo "<tr>";
     535
     536        echo "<td>$chunkname</td>";
     537        echo "<td>$Nfirstvisits</td>";
     538        echo "<td>$Nfourvisits</td>";
     539        echo "<td>$Ndiffs</td>";
     540        echo "<td>$complete</td>";
     541
     542        echo "</tr>";
     543    }
     544    echo "</table>\n";
     545
     546}
     547
     548###########################################################################
     549#
    403550# Gets labels for this server
    404551#
    405552###########################################################################
    406 function getLabels($db, $server) {
     553function getLabels($db, $proj, $server) {
    407554
    408555    # order by descending priority as set in project database
    409     $sql = "SELECT label FROM current_labels WHERE server LIKE '$server' ORDER BY priority DESC, label";
     556    $sql = "SELECT label FROM science_labels WHERE server LIKE '$server' AND telescope LIKE '$proj' ORDER BY priority DESC, label";
    410557    if ($debug) {echo "$sql<br>";}
    411558
     
    547694    foreach ($stages as &$stage) {
    548695
    549         $reverting = getRevertStatus($db, $stage);
     696        $reverting = getRevertStatus($db, $proj, $stage);
    550697        if(!$reverting) {$label =  "";}
    551698        if($reverting) {$label = "reverting";}
     
    608755#
    609756###########################################################################
    610 function setRevertStatus($db, $stage, $reverting) {
    611 
    612     $sql = "UPDATE reverts SET reverting = $reverting WHERE stage LIKE '$stage'";
     757function setRevertStatus($db, $proj, $stage, $reverting) {
     758
     759    $sql = "UPDATE science_reverts SET reverting = $reverting WHERE stage LIKE '$stage' AND telescope LIKE '$proj'";
    613760    if ($debug) {echo "$sql<br>";}
    614761
     
    622769#
    623770###########################################################################
    624 function getNightlyScienceStatus($db) {
    625 
    626     $sql = "SELECT status FROM nightlyscience";
     771function getNightlyScienceStatus($db, $proj) {
     772
     773    $sql = "SELECT status FROM science_nightlyscience WHERE telescope LIKE '$proj'";
    627774    if ($debug) {echo "$sql<br>";}
    628775
     
    639786#
    640787###########################################################################
    641 function turnRevertsOnOff($db, $stage, $mode) {
     788function turnRevertsOnOff($db, $proj, $stage, $mode) {
    642789
    643790    exec("czartool_revert.pl -t $stage -o $mode", $response, $status);
     
    646793    else if ($response[0] == "on") $currentRevertMode = 1;
    647794
    648     setRevertStatus($db, $stage, $currentRevertMode);
     795    setRevertStatus($db, $proj, $stage, $currentRevertMode);
    649796}
    650797
     
    654801#
    655802###########################################################################
    656 function getRevertStatus($db, $stage) {
     803function getRevertStatus($db, $proj, $stage) {
    657804
    658805    $anyFaults = false;
    659806
    660     $sql = "SELECT reverting FROM reverts WHERE stage LIKE '$stage'";
     807    $sql = "SELECT reverting FROM science_reverts WHERE stage LIKE '$stage' AND telescope LIKE '$proj'";
    661808    if ($debug) {echo "$sql<br>";}
    662809
     
    706853#
    707854###########################################################################
    708 function createDatesTable($db) {
     855function createDatesTable($db, $proj) {
    709856
    710857    global $table;
     
    717864    echo "</tr>\n";
    718865
    719     createServerDateRow($db, "stdscience");
    720     createServerDateRow($db, "registration");
     866    createServerDateRow($db, $proj, "stdscience");
     867    createServerDateRow($db, $proj, "registration");
    721868
    722869    echo "</table>\n";
     
    729876#
    730877###########################################################################
    731 function createServerDateRow($db, $server) {
    732 
    733     $sql = "SELECT date FROM server_dates WHERE server LIKE '$server' ORDER BY date";
     878function createServerDateRow($db, $proj, $server) {
     879
     880    $sql = "SELECT date FROM science_server_dates WHERE server LIKE '$server' AND telescope LIKE '$proj' ORDER BY date";
    734881    if ($debug) {echo "$sql<br>";}
    735882
     
    9821129}
    9831130
     1131###########################################################################
     1132#
     1133# Shows the status of the various replication mysql servers
     1134#
     1135###########################################################################
     1136function showDatabaseStatus($Host, $User, $Password, $DatabaseName) {
     1137    #print "<br>$replHost, $replUser, $replPassword, $replDatabaseName<br/>";
     1138    $db = DB::connect("mysql://$User:$Password@$Host");
     1139    if (PEAR::isError($db)) {
     1140        echo "<tr><td>$DatabaseName</td><td bgcolor=\"red\">MySQL DB connection error</td></tr>";
     1141        //die("MySQL DB connection error: Check the configuration for $DatabaseName");
     1142        //die("");
     1143        return -1;
     1144
     1145    }
     1146    $Status = ($errorStatusInMySql==0?"OK":"<font style=\"BACKGROUND-COLOR: yellow\"  color=\"red\">PROBLEM</font>");
     1147    echo "<tr><td>$DatabaseName</td><td>$Status</td></tr>";
     1148
     1149    $db->disconnect();
     1150}
     1151
     1152###########################################################################
     1153#
     1154# Shows the status of a machine using ping
     1155#
     1156###########################################################################
     1157function showPingStatus($Host, $DatabaseName) {
     1158    exec("ping -c 1 $Host", $res, $rval);
     1159    if ($rval == 0){
     1160      $PingStatus= "UP";
     1161    }else{
     1162      $PingStatus = "<font style=\"BACKGROUND-COLOR: yellow\"  color=\"red\">DOWN</font>";
     1163    }
     1164    echo "<tr><td>$DatabaseName</td><td>$PingStatus</td></tr>";
     1165}
     1166
    9841167?>
    9851168
  • trunk/ippMonitor/raw/ipp.czar.dat

    r40358 r40840  
    33menutop   | menutop      | plain   | &nbsp;   |   
    44
    5 menulink   | menuselect      | link    | czartool - old  | czartool_labels_old.php
    65menulink   | menuselect      | link    | czartool        | czartool_labels.php
    76menulink   | menuselect      | link    | mask stats                   | maskStats.php
     
    109menulink  | menuselect   | link    | Exposures Status             | exposureStatus.php
    1110menulink  | menuselect   | link    | MOPS Exposures Status        | mopsStatus.php
    12 menulink  | menuselect   | link    | GPC1 MySql ProcessList            | gpc1MysqlProcessList.php
     11menulink  | menuselect   | link    | MySql ProcessList            | gpc1MysqlProcessList.php
    1312
  • trunk/ippMonitor/raw/ipp.menu.dat

    r38221 r40840  
    2323menutop   | menutop      | link    | Stack Steps                  | ipp.stack.php
    2424menutop   | menutop      | link    | Static Sky Steps             | ipp.sky.php
     25menutop   | menutop      | link    | Full Force Steps             | ipp.ffs.php
    2526menutop   | menutop      | link    | Distribution                 | ipp.dist.php
    2627menutop   | menutop      | link    | Large Area Processing        | ipp.lap.php
  • trunk/ippMonitor/raw/ipp.sky.dat

    r38221 r40840  
    1616menulink  | menuselect   | link    | Skycal Failed                | skycal_failure.php
    1717
    18 menutop   | menutop      | plain   | &nbsp;                       |
    19 menulink  | menuselect   | link    | Static Sky Summary           | staticskySummary.php
    20 menulink  | menuselect   | link    | Static Sky Run               | staticskyRun.php
    21 menulink  | menuselect   | link    | Static Sky Input Skyfile     | staticskyInputSkyfile.php
    22 menulink  | menuselect   | link    | Static Sky Processed Skyfile | staticskyProcessedSkyfile.php
    23 menulink  | menuselect   | link    | Static Sky Failed Skyfile    | staticskyFailedSkyfile.php
    24 menulink  | menuselect   | link    | Static Sky Failed            | failedStaticsky.php
Note: See TracChangeset for help on using the changeset viewer.