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

File:
1 edited

Legend:

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