Changeset 37187
- Timestamp:
- Aug 5, 2014, 5:03:52 PM (12 years ago)
- File:
-
- 1 edited
-
trunk/ippScripts/scripts/sc_remote_exec.pl (modified) (12 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippScripts/scripts/sc_remote_exec.pl
r37151 r37187 18 18 my $SEC_HOST = 'mu-fe4'; 19 19 my $IPP_PATH = '/turquoise/usr/projects/cosmo/mswarren/ipp/'; 20 #my $remote_root = '/scratch3/watersc1/'; 21 my $remote_root = '/lustre/scratch1/turquoise/watersc1/ps1/'; 22 $remote_root = '/scratch3/watersc1/'; 20 my $remote_root = '/scratch3/watersc1/'; 21 23 22 # tools 24 23 my $missing_tools; … … 31 30 exit($PS_EXIT_CONFIG_ERROR); 32 31 } 33 34 32 35 33 # Options … … 56 54 57 55 my $ipprc = PS::IPP::Config->new( $camera ) or my_die( "Unable to set up", $remote_id); 58 59 56 my $mdcParser = PS::IPP::Metadata::Config->new; # Parser for metadata config files 60 57 … … 152 149 my $poll_sleep = 60; 153 150 my $poll_response = 0; 151 my $poll_word = "nothing"; 152 154 153 if ($force) { 155 154 $poll_response = 1; 156 } 157 my $poll_word = "nothing"; 155 $poll_word = "Completed"; 156 } 157 158 158 while (($poll_count < $poll_max)&&($poll_response != 1)&&($poll_response != -1)&&($force != 1)) { 159 159 if ($verbose) { … … 171 171 warn("The job exited incorrectly: $remote_id $job_id $poll_word. Attempting to recover what we can."); 172 172 $poll_response = 1; # To fool the check later into proceding 173 # &my_die("The job exited incorrectly.",$remote_id, $PS_EXIT_PROG_ERROR);174 173 } 175 174 $poll_count++; … … 181 180 &my_die("Job hasn't completed. Ending polling.", $remote_id, 0, "run", $job_id); 182 181 } 183 # Retrieve validation summary 184 my $fault = 0; 182 185 183 186 184 # Initialize the remote side to sync things … … 193 191 #scp_get($remote_return,$ipp_return); 194 192 195 # C heck to see if we can resume. Pack the files into an array193 # Construct list of dbinfo files we'll need to execute. 196 194 my @returned_files = (); 197 195 my @dbinfo_files = (); … … 211 209 close(RETURN); 212 210 print STDERR "Expect $#dbinfo_files dbinfo files\n"; 213 # Binary search it. BUT: We're binary searching binary values. So,214 # this has to be far more careful than a fully sorted case would be.215 # Only scan the dbinfo files as those are the things that are216 # generated after the processing, and so must be the last things to217 # exist.218 211 219 212 my $first = 0; … … 222 215 my $range = 20; # How wide of a chunk to look through to catch threading drops 223 216 my $offset = 0; # Offset to start from. 224 # This doesn't work as well as I'd like, and with the rsync, it's less needed. 225 # if (( stat($dbinfo_files[$last]) )[7] != 0) { $offset = $#dbinfo_files;} 226 # else { 227 # my $count = 0; 228 # while ($first < $last - $range) { 229 230 # $mid = int(($last + $first)/2); 231 # for (my $i = 0; $i <= $range; $i++) { 232 # my $size = (stat($dbinfo_files[$mid + $i]))[7]; 233 # # print STDERR "$first $last $mid $i $size $dbinfo_files[$mid + $i]\n"; 234 # if ($size == 0) { 235 # if ($last == $mid + $i) { 236 # $first = $last - 1; 237 # } 238 # $last = $mid + $i; 239 # $i = $range + 10; 240 # } 241 # } 242 # if ($last > $mid + $range) { $first = $mid + $range; } 243 # $count++; 244 # if ($count > 200) { 245 # &my_die("The iteration loop couldn't converge after 200 rounds, suggesting something has gone wrong.", 246 # $remote_id,4,"error_run"); 247 # } 248 # } 249 # $offset = $mid - $range; # Because I want to make sure I get to the beginning of the thread group. 250 # $offset = $dbindex[$offset]; # Because we need to convert from dbinfo space to returned file space. 251 # } 252 253 # Feed teh return list into the transfer tool 217 218 # Feed the return list into the transfer tool 254 219 # If this fails, we should go to an auth wait point. 255 if ($poll_word eq 'Completed') { 220 if ($poll_word eq 'Completed') { 221 # We're complete. All files should exist on disk 256 222 my $iter = 0; 257 223 my $transfer_success = 1; … … 267 233 } 268 234 else { 235 # Just try and fetch things, because we didn't complete correctly, it seems. 269 236 my $return_push_output = ssh_exec_command("${remote_root}/sc_transfer_tool.pl --input $remote_return --offset $offset"); 270 237 my $return_push_output_print = join "\n", @{ $return_push_output }; … … 282 249 run(command => $cmd, verbose => $verbose); 283 250 unless ($success) { 251 284 252 # This shouldn't fail, but we also can't suddenly abort if something does fail. 285 253 # Now we're going to drop the component that owns this dbinfo, which should force a retry. 286 254 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 287 255 warn("The command that shouldn't fail has failed: $file $cmd $remote_id $error_code"); 288 drop_component($remote_id,$cmd,$file); 256 if ($poll_word ne 'Completed') { # If the job claims it completed, then we're fighting the network. 257 drop_component($remote_id,$cmd,$file); 258 } 289 259 } 290 260 … … 342 312 my $cmd = shift; 343 313 $cmd = "$ssh $DMZ_HOST ssh ${SEC_HOST} $cmd"; 314 print "EXEC: $cmd\n"; 344 315 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 345 316 run(command => $cmd, verbose => $verbose);
Note:
See TracChangeset
for help on using the changeset viewer.
