Changeset 37288
- Timestamp:
- Aug 22, 2014, 11:04:42 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tags/ipp-pv3-20140717/ippScripts/scripts/sc_remote_poll.pl
r37286 r37288 67 67 defined($job_id); 68 68 69 my $ipprc = PS::IPP::Config->new( $camera ) or my_die( "Unable to set up", $remote_id);69 my $ipprc = PS::IPP::Config->new( $camera ) or &my_die( "Unable to set up", $remote_id); 70 70 my $mdcParser = PS::IPP::Metadata::Config->new; # Parser for metadata config files 71 71 … … 87 87 unless ($success) { 88 88 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 89 &my_die("Unable to run remotetool to determine remote run status", $remote_id, $error_code);89 &my_die("Unable to run remotetool to determine remote run status", $remote_id, $error_code); 90 90 } 91 91 … … 94 94 95 95 my $metadata = parse_md_list($MDlist); 96 $runData = $ rrData2->[0]; # There should be only one97 } 98 99 # Poll the job status?96 $runData = $metadata->[0]; # There should be only one 97 } 98 99 # STEP 3: Poll the job status 100 100 my $poll_response = 0; 101 101 my $poll_word = "nothing"; … … 114 114 } 115 115 116 # Initialize the remote side to sync things 117 my $uri_return = $path_base . ".return"; 118 my ($ipp_return, $remote_return) = uri_convert($uri_return); 116 my $remote_path = uri_local_to_remote($path_base); 119 117 120 118 # transfer tool should check the existence of files on the remote end … … 128 126 $iter++; 129 127 check_ssh_connection(); 130 my $return_push_output = ssh_exec_command("${remote_root}/sc_transfer_tool.pl --input $remote_ return--offset $offset");128 my $return_push_output = ssh_exec_command("${remote_root}/sc_transfer_tool.pl --input $remote_path --offset $offset"); 131 129 my $return_push_output_print = join "\n", @{ $return_push_output }; 132 130 if ($return_push_output_print =~ /exited with value 255/) { $transfer_success = 0; } … … 134 132 } while (($transfer_success != 1) && ($iter < 10)); # Try harder; 135 133 136 if (!$transfer_success) { &my_die ("failed to get all return files"); } 137 } 138 print STDERR "rsync of all files is complete, updating gpc1 database\n"; 134 if (!$transfer_success) { &my_die ("failed to get all return files", $remote_id, 23); } 135 } 136 print STDERR "rsync of all files is complete, checking the results\n"; 137 138 # grab the .stats file 139 140 my $uri_stats = $path_base . ".stats"; 141 my $disk_stats = $ipprc->file_resolve($uri_stats); 142 my $remote_stats = uri_local_to_remote($uri_stats); 143 144 scp_get($remote_stats,$disk_stats); 145 146 # check for PASS / PART / FAIL : if dbinfo is PASS, go ahead and execute that. 147 148 my $Npass = 0; 149 my $Npart = 0; 150 my $Nfail = 0; 151 my @dbinfo_files = (); 152 open (STATFILE, "$disk_stats") || &my_die("Couldn't open file? $disk_stats", $remote_id, $PS_EXIT_SYS_ERROR); 153 while (my $line = <RETURN>) { 154 chomp $line; 155 unless ($_ =~ /dbinfo/) { next; } 156 157 my @words = split (" ", $line); 158 if ($words[1] eq "PASS") { 159 push @dbinfo_files, $words[0]; 160 $Npass ++; 161 } elsif ($words[1] eq "FAIL") { 162 $Nfail ++; 163 } elsif ($words[1] eq "PART") { 164 $Npart ++; 165 } 166 } 167 close(RETURN); 168 print STDERR "dbinfo files: $Npass PASS, $Nfail FAIL, $Npart PART\n"; 139 169 140 170 foreach my $file (@dbinfo_files) { … … 143 173 close(DBF); 144 174 chomp($cmd); 145 # print STDERR "$file $cmd\n"; 175 146 176 $cmd =~ s/-/ -/g; # This is just a safety check for missing space. 177 178 if ($cmd == "") { 179 print STDERR "problem: empty dbinfo file\n"; 180 next; 181 } 182 147 183 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 148 184 run(command => $cmd, verbose => $verbose); 149 185 unless ($success) { 150 151 186 # This shouldn't fail, but we also can't suddenly abort if something does fail. 152 187 # Now we're going to drop the component that owns this dbinfo, which should force a retry. … … 154 189 warn("The command that shouldn't fail has failed: $file $cmd $remote_id $error_code"); 155 190 if ($poll_word ne 'Completed') { # If the job claims it completed, then we're fighting the network. 156 drop_component($remote_id,$cmd,$file);191 fail_component($remote_id, $cmd, $file); 157 192 } 158 193 } … … 161 196 162 197 # We're done, so set the state and exit. 163 &my_die("Finished",$remote_id,0,"full"); 164 198 &my_die("Finished", $remote_id, 0, "full"); 165 199 166 200 # END PROGRAM 167 168 201 169 202 sub check_ssh_connection { … … 289 322 290 323 return($local_uri); 324 } 325 326 sub fail_component { 327 my $remote_id = shift; 328 my $cmd = shift; 329 my $file = shift; 330 331 # Steal the stage_id from the filename. This isn't something I'm happy about. 332 my $stage = $runData->{stage}; 333 my $stage_id = $file; 334 if ($stage eq 'chip') { 335 $stage_id =~ s/^.*ch\.//; 336 } 337 elsif ($stage eq 'camera') { 338 $stage_id =~ s/^.*cm\.//; 339 } 340 elsif ($stage eq 'warp') { 341 $stage_id =~ s/^.*wrp\.//; 342 } 343 elsif ($stage eq 'stack') { 344 $stage_id =~ s/^.*stk\.//; 345 } 346 $stage_id =~ s/\..*$//; 347 348 print STDERR "failed component: $remote_id, $stage_id\n"; 349 350 # Drop this from the database 351 ## my $drop_cmd = "$remotetool -dropcomponent -remote_id $remote_id -stage_id $stage_id "; 352 ## $drop_cmd .= " -dbname $dbname " if defined($dbname); 353 ## system($drop_cmd); 291 354 } 292 355 … … 329 392 my $exit_code = shift; 330 393 my $exit_state = shift; 331 my $jobid = shift; 394 332 395 $exit_code = $PS_EXIT_PROG_ERROR unless defined $exit_code; 333 396
Note:
See TracChangeset
for help on using the changeset viewer.
