IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

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/czartool
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • 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";}
Note: See TracChangeset for help on using the changeset viewer.