- Timestamp:
- Aug 19, 2010, 6:50:13 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20100621/tools/czartool/Pantasks.pm
r28794 r28980 5 5 6 6 package czartool::Pantasks; 7 8 7 9 8 my @servers = ( … … 21 20 ); 22 21 22 ########################################################################### 23 # 24 # Constructor TODO put in check that we can run pantasks_client 25 # 26 ########################################################################### 27 sub new { 28 my $class = shift; 29 my $self = {}; 30 31 bless $self, $class; 32 return $self; 33 } 23 34 24 35 ########################################################################### … … 35 46 ########################################################################### 36 47 # 37 # Constructor38 #39 ###########################################################################40 sub new {41 my $class = shift;42 my $self = {};43 44 bless $self, $class;45 return $self;46 }47 48 ###########################################################################49 #50 48 # Returns the correct server for this processing stage 51 49 # … … 58 56 } 59 57 58 ########################################################################### 59 # 60 # Checks for a meaningful response from pantasks client 61 # 62 ########################################################################### 63 sub 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 } 60 76 61 77 ########################################################################### … … 75 91 76 92 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;} 91 95 if ($passedHeader) {push(@labels, $line);} 92 96 } … … 113 117 if ($line =~ m/Scheduler is running/) {${$running} = 1; ${$alive}=1;last;} 114 118 if ($line =~ m/Task Status/) {last;} 115 116 119 } 117 120 } … … 125 128 my ($self, $server) = @_; 126 129 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 ########################################################################### 146 sub getRevertStatus { 147 my ($self, $stage, $reverting) = @_; 148 149 my $server = $self->getServerForThisStage($stage); 150 151 if ($stage eq "cam") {$stage = "camera";} 127 152 128 153 my @cmdOut = `echo "status;quit" | pantasks_client -c ~ipp/$server/ptolemy.rc 2>&1`; 129 154 my $line; 130 my $passedHeader=0;131 155 foreach $line (@cmdOut) { 132 156 133 157 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 } 136 163 } 137 164 } 138 139 165 1;
Note:
See TracChangeset
for help on using the changeset viewer.
