Changeset 37270
- Timestamp:
- Aug 20, 2014, 11:59:39 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tags/ipp-pv3-20140717/ippScripts/scripts/sc_retry_return.pl
r37267 r37270 34 34 # Options 35 35 my ($remote_id,$path_base,$dbname,$verbose,$no_update,$camera); 36 $force = 0;37 36 $verbose = 0; 38 37 GetOptions( … … 77 76 my $runData = ${ $rrData2 }[0]; # There should be only one 78 77 79 # my job ID : 78 # my job ID : 80 79 my $job_id = $runData->{job_id}; 81 80 print "remote job ID: $job_id\n"; … … 132 131 } while (($transfer_success != 1) && ($iter < 10)); # Try harder; 133 132 134 if (!$transfer_success) &my_die ("failed to get all return files");133 if (!$transfer_success) { &my_die ("failed to get all return files"); } 135 134 } 136 135 print STDERR "rsync of all files is complete, updating gpc1 database\n"; … … 145 144 # we just need to check for the existence of an entry: 146 145 if ($runData->{stage} == "chip") { 147 my $cmd= "$chiptool -simple -processedimfile -chip_id $stage_id -class_id $class_id";148 $cmd.= " -dbname $dbname " if defined($dbname);149 150 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf) =151 run(command => $cmd, verbose => $verbose);152 153 unless ($success) {154 $error_code = (($error_code>> 8) or $PS_EXIT_PROG_ERROR);155 &my_die("Unable to run chiptool to check on results", $remote_id,$error_code);156 }157 158 my $Nrows = @$stdout_buff;159 if ($Nrows > 0) {160 print STDERR "skip this entry: $stage_id, $class_id\n";161 next;162 }146 my $cmd1 = "$chiptool -simple -processedimfile -chip_id $stage_id -class_id $class_id"; 147 $cmd1 .= " -dbname $dbname " if defined($dbname); 148 149 my ( $success1, $error_code1, $full_buf1, $stdout_buf1, $stderr_buf1 ) = 150 run(command => $cmd1, verbose => $verbose); 151 152 unless ($success1) { 153 $error_code1 = (($error_code1 >> 8) or $PS_EXIT_PROG_ERROR); 154 &my_die("Unable to run chiptool to check on results", $remote_id, $error_code1); 155 } 156 157 my $Nrows = @$stdout_buf1; 158 if ($Nrows > 0) { 159 print STDERR "skip this entry: $stage_id, $class_id\n"; 160 next; 161 } 163 162 } else { 164 print STDERR "do not know how to handle stage $runData->{stage}\n"; 165 exit (3); 166 } 167 168 { 169 open(DBF,"$file") || warn "Missing file $file\n"; 170 my $cmd = <DBF>; 171 close(DBF); 172 173 chomp($cmd); 174 175 $cmd =~ s/-/ -/g; # This is just a safety check for missing space. 176 if ($cmd == "") { 177 print STDERR "empty dbinfo file for $stage_id, $class_id, skipping\n"; 178 next; 179 } 180 181 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 182 run(command => $cmd, verbose => $verbose); 183 unless ($success) { 184 # This shouldn't fail, but we also can't suddenly abort if something does fail. 185 # Now we're going to drop the component that owns this dbinfo, which should force a retry. 186 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 187 warn("The command that shouldn't fail has failed: $file $cmd $remote_id $error_code"); 188 if ($poll_word ne 'Completed') { # If the job claims it completed, then we're fighting the network. 189 # drop_component($remote_id,$cmd,$file); 190 print STDERR "we should drop this component: $cmd\n"; 191 } 192 } 163 print STDERR "do not know how to handle stage $runData->{stage}\n"; 164 exit (3); 165 } 166 167 open(DBF,"$file") || warn "Missing file $file\n"; 168 my $cmd = <DBF>; 169 close(DBF); 170 171 chomp($cmd); 172 173 $cmd =~ s/-/ -/g; # This is just a safety check for missing space. 174 if ($cmd == "") { 175 print STDERR "empty dbinfo file for $stage_id, $class_id, skipping\n"; 176 next; 177 } 178 179 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 180 run(command => $cmd, verbose => $verbose); 181 unless ($success) { 182 # This shouldn't fail, but we also can't suddenly abort if something does fail. 183 # Now we're going to drop the component that owns this dbinfo, which should force a retry. 184 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 185 warn("The command that shouldn't fail has failed: $file $cmd $remote_id $error_code"); 186 if ($poll_word ne 'Completed') { # If the job claims it completed, then we're fighting the network. 187 # drop_component($remote_id,$cmd,$file); 188 print STDERR "we should drop this component: $cmd\n"; 189 } 193 190 } 194 191 } … … 246 243 my $response_array = ssh_exec_command("checkjob -v $job_id"); 247 244 my $response = join "\n", @$response_array; 248 249 if ($response =~ /State: Running/) { 250 return(0,"Running");245 246 if ($response =~ /State: Running/) { 247 return(0,"Running"); 251 248 } 252 249 elsif ($response =~ /State: Completed/) { 253 return(1,"Completed");250 return(1,"Completed"); 254 251 } 255 252 elsif ($response =~ /State: Idle/) { 256 return(-2,"Idle");253 return(-2,"Idle"); 257 254 } 258 255 else { 259 my $response_word = $response;260 $response_word =~ s/.*State: //;261 $response_word =~ s/\n.*//;262 return(-1,$response_word);256 my $response_word = $response; 257 $response_word =~ s/.*State: //; 258 $response_word =~ s/\n.*//; 259 return(-1,$response_word); 263 260 } 264 261 } … … 279 276 elsif ($stage eq 'camera') { 280 277 $stage_id =~ s/^.*cm\.//; 281 $class_id = 0;278 $class_id = 0; 282 279 } 283 280 elsif ($stage eq 'warp') { 284 281 $stage_id =~ s/^.*wrp\.//; 285 $class_id = 0;282 $class_id = 0; 286 283 } 287 284 elsif ($stage eq 'stack') { 288 285 $stage_id =~ s/^.*stk\.//; 289 $class_id = 0;286 $class_id = 0; 290 287 } 291 288
Note:
See TracChangeset
for help on using the changeset viewer.
