IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Aug 19, 2010, 6:50:13 PM (16 years ago)
Author:
eugene
Message:

updates from trunk

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20100621/tools/czartool/Pantasks.pm

    r28794 r28980  
    55
    66package czartool::Pantasks;
    7 
    87
    98my @servers = (
     
    2120        );
    2221
     22###########################################################################
     23#
     24# Constructor TODO put in check that we can run pantasks_client
     25#
     26###########################################################################
     27sub new {
     28    my $class = shift;
     29    my $self = {};
     30
     31    bless $self, $class;
     32    return $self;
     33}
    2334
    2435###########################################################################
     
    3546###########################################################################
    3647#
    37 # Constructor
    38 #
    39 ###########################################################################
    40 sub new {
    41     my $class = shift;
    42     my $self = {};
    43 
    44     bless $self, $class;
    45     return $self;
    46 }
    47 
    48 ###########################################################################
    49 #
    5048# Returns the correct server for this processing stage
    5149#
     
    5856}
    5957
     58###########################################################################
     59#
     60# Checks for a meaningful response from pantasks client
     61#
     62###########################################################################
     63sub outputOk {
     64    my ($self, $output) = @_;
     65
     66    if (
     67            $output =~ m/.*show\.labels.*/i ||
     68            $output =~ m/.*Connection reset by peer.*/i ||
     69            $output =~ m/.*server is busy.*/i ) {
     70
     71        print "* WARNING: pantasks returned '$output'\n";
     72        return 0;
     73    }
     74    return 1;
     75}
    6076
    6177###########################################################################
     
    7591
    7692        chomp($line);
    77         if ($line =~ m/pantasks:\s+(.*)/) {
    78 
    79             # HACK quit if we get 'show.labels: Command not found.'
    80             if ($1 =~ m/.*show\.labels.*/i) {return \@labels;};
    81             # HACK quit if we get 'Connection reset by peer'
    82             if ($1 =~ m/.*Connection reset by peer.*/i) {return \@labels;};
    83             # HACK quit if we get 'server is busy' message
    84             if ($1 =~ m/.*server is busy.*/i) {return \@labels;};
    85             # HACK to get around 'dummy' label in stdscience
    86             if ($1 !~ m/.*dummy.*/) {push(@labels, $1);};
    87             $passedHeader=1;
    88             next;
    89         }
    90 
     93        if (!$self->outputOk($line)) {return \@labels;}
     94        if ($line =~ m/pantasks:\s+/) {$passedHeader=1; next;}
    9195        if ($passedHeader) {push(@labels, $line);}
    9296    }
     
    113117        if ($line =~ m/Scheduler is running/) {${$running} = 1; ${$alive}=1;last;}
    114118        if ($line =~ m/Task Status/) {last;}
    115 
    116119    }
    117120}
     
    125128    my ($self, $server) = @_;
    126129
     130    my @cmdOut = `echo "status;quit" | pantasks_client -c ~ipp/$server/ptolemy.rc 2>&1`;
     131    my $line;
     132    my $passedHeader=0;
     133    print "\n";
     134    foreach $line (@cmdOut) {
     135
     136        if ($line =~ m/.*Task Status.*/) {$passedHeader=1;next;}
     137        if ($passedHeader){print "$line";}
     138    }
     139}
     140
     141###########################################################################
     142#
     143# Gets revert status for this stage
     144#
     145###########################################################################
     146sub getRevertStatus {
     147    my ($self, $stage, $reverting) = @_;
     148
     149    my $server = $self->getServerForThisStage($stage);
     150
     151    if ($stage eq "cam") {$stage = "camera";}
    127152
    128153    my @cmdOut = `echo "status;quit" | pantasks_client -c ~ipp/$server/ptolemy.rc 2>&1`;
    129154    my $line;
    130     my $passedHeader=0;
    131155    foreach $line (@cmdOut) {
    132156
    133157        chomp($line);
    134         if ($line =~ m/.*Task Status.*/) {$passedHeader=1;next;}
    135         if ($passedHeader){print "$line<br>";}
     158        if ($line =~ m/\s+([+-])[+-]\s+$stage\.revert.*/) {
     159
     160            if ($1 =~ m/-/) {${$reverting} = 0;}
     161            elsif ($1 =~ m/\+/) {${$reverting}=1;}
     162        }
    136163    }
    137164}
    138 
    139 
     1651;
Note: See TracChangeset for help on using the changeset viewer.