Changeset 33098 for branches/meh_branches/ppsub_test/pstamp/scripts
- Timestamp:
- Jan 11, 2012, 11:19:21 PM (15 years ago)
- Location:
- branches/meh_branches/ppsub_test
- Files:
-
- 9 edited
-
. (modified) (1 prop)
-
pstamp/scripts (modified) (1 prop)
-
pstamp/scripts/pstamp_checkdependent.pl (modified) (10 diffs)
-
pstamp/scripts/pstamp_cleanup.pl (modified) (2 diffs)
-
pstamp/scripts/pstamp_get_image_job.pl (modified) (7 diffs)
-
pstamp/scripts/pstamp_job_run.pl (modified) (5 diffs)
-
pstamp/scripts/pstamp_parser_run.pl (modified) (2 diffs)
-
pstamp/scripts/pstamp_server_status (modified) (1 diff)
-
pstamp/scripts/pstampparse.pl (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/meh_branches/ppsub_test
- Property svn:mergeinfo changed
-
branches/meh_branches/ppsub_test/pstamp/scripts
- Property svn:mergeinfo set to
-
branches/meh_branches/ppsub_test/pstamp/scripts/pstamp_checkdependent.pl
r30879 r33098 117 117 } 118 118 } 119 120 # magic is no longer rquired 121 $need_magic = 0; 122 $magic_ok = 1; 119 123 my $status = 0; 120 if ((($it->{state} eq 'full') or ($it->{state} eq 'update')) and ($it->{data_state} eq 'full') 121 and (!$need_magic or $magic_ok or $it->{magicked} > 0)) { 124 if ((($it->{state} eq 'full') or ($it->{state} eq 'update')) and ($it->{data_state} eq 'full')) { 122 125 123 126 # This Dependency is satisfied. All done. Release the pstampJobs … … 197 200 } 198 201 202 if (0) { 199 203 if (!$job_fault and ($stage eq 'chip')) { 200 204 # what about "error_cleaned" ? … … 210 214 } 211 215 } 216 } 212 217 213 218 if ($job_fault >= $PSTAMP_FIRST_ERROR_CODE) { … … 240 245 my $state = $chip->{state}; 241 246 my $data_state = $chip->{data_state}; 247 my $fault = $chip->{fault}; 242 248 if (($state =~ /error/) or ($state =~ /purged/) or ($state =~ /scrubbed/) or ($state eq 'drop') or 243 ($data_state =~ /error/) or ($data_state =~ /purged/) or ($data_state =~ /scrubbed/) or ($data_state eq 'drop')) { 244 245 print "chipRun state is $chip->{chip_id} has state: $state data_state: $data_state cannot update\n"; 249 ($data_state =~ /error/) or ($data_state =~ /purged/) or ($data_state =~ /scrubbed/) or ($data_state eq 'drop') or 250 ($fault eq $PSTAMP_GONE)) { 251 252 print "chipRun state is $chip->{chip_id} has state: $state data_state: $data_state fault: $fault cannot update\n"; 246 253 my $error_code; 247 254 if (($state eq 'error_cleaned') or ($data_state ='error_cleaned')) { … … 253 260 # caller will fault the jobs 254 261 return $error_code; 255 } elsif ($chip->{dsRun_state} eq 'failed_revert') {256 # XXX: revert failures are rarely fixed. give up but say it's just not available not GONE257 print "magicDSRun.state = $dsRun_state for chipRun $stage_id is in state failed_revert cannot update\n";258 return $PSTAMP_NOT_AVAILABLE;259 262 } elsif (($chip->{data_state} ne 'update') and ($chip->{data_state} ne 'full')) { 260 263 … … 282 285 } elsif ($fault_count > $max_fault_count) { 283 286 print "$stage $stage_id has faulted $fault_count times. Giving up\n"; 284 $fault = $PSTAMP_GONE; 285 faultComponent('chip', $chip->{chip_id}, $chip->{class_id}, $PSTAMP_GONE); 286 return $PSTAMP_GONE; 287 # XXX: stop faulting chips for now 288 # $fault = $PSTAMP_GONE; 289 # faultComponent('chip', $chip->{chip_id}, $chip->{class_id}, $PSTAMP_GONE); 290 $fault = $PSTAMP_NOT_AVAILABLE; 291 return $fault; 287 292 } 288 293 # fault the dependent 289 294 my_die("chip $chip->{chip_id} $chip->{class_id} faulted: $chip->{fault}", $chip->{fault}); 290 } elsif ($chip->{dsFile_fault} eq $PSTAMP_GONE) { 291 print STDERR "magicDSFile $chip->{magic_ds_id} $chip->{chip_id} $chip->{class_id} is GONE"; 292 return $PSTAMP_GONE; 293 } elsif ($chip->{dsFile_fault} and ($chip->{dsFile_data_state} eq 'update')) { 294 # fault the dependent 295 my_die("magicDSFile $chip->{magic_ds_id} $chip->{chip_id} $chip->{class_id} faulted: $chip->{dsFile_fault}", $chip->{dsFile_fault}); 296 } 297 } 298 299 my $status = 0; 300 if (!$queued_update) { 301 $status = check_states_magicDSRun('chip', $chip_id, \@chips, $rlabel, $need_magic, $raw_all_magicked, $magic_ds_id, $dsRun_state); 302 } 303 304 return $status; 295 } 296 } 297 298 return 0; 305 299 } 306 300 … … 321 315 # The update system currently requires that data that has been magicked be destreaked 322 316 # at chip stage so it needs magic even if the customer doesn't. 317 if (0) { 323 318 if ($metadata->{magicked} != 0) { 324 319 $need_magic = 1; 325 320 } 326 321 } 327 322 if (($state =~ /error/) or ($state =~ /purged/) or ($state =~ /scrubbed/) or ($state eq 'drop') or 328 323 ($data_state =~ /error/) or ($data_state =~ /purged/) or ($data_state =~ /scrubbed/) or ($data_state eq 'drop')) { … … 369 364 # if chip has been magicked before require it to be magicked again 370 365 # because the warp pending query requires it. 366 if (0) { 371 367 if ($chip->{magicked} < 0) { 372 368 print "Input has been destreaked so we must destreak before warping\n"; 373 369 $need_magic = 1 374 370 } 371 } 375 372 376 373 if ($need_magic and ($chip->{magicked} eq 0)) { … … 421 418 my $metadata = shift; 422 419 my $rlabel = shift; # if defined a new label for the chipRun 423 my $need_magic = shift;420 my $need_magic = 0; 424 421 425 422 my $diff_id = $metadata->{diff_id}; … … 427 424 my $skycell = $metadata; 428 425 my $skycell_id = $skycell->{skycell_id}; 429 430 # The update system currently requires that data that has been magicked be destreaked431 # at chip stage so it needs magic even if the customer doesn't.432 if ($metadata->{magicked} != 0) {433 $need_magic = 1;434 }435 426 436 427 if ($diff_mode == $IPP_DIFF_MODE_WARP_STACK ) { -
branches/meh_branches/ppsub_test/pstamp/scripts/pstamp_cleanup.pl
r27874 r33098 23 23 24 24 use PS::IPP::Config qw( :standard ); 25 use PS::IPP::PStamp::Job qw( :standard ); 25 26 26 27 my $req_id; … … 95 96 } 96 97 98 { 99 my $command = "$pstamptool -listfile -req_id $req_id"; 100 $command .= " -dbname $dbname" if $dbname; 101 $command .= " -dbserver $dbserver" if $dbserver; 102 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 103 run(command => $command, verbose => $verbose); 104 unless ($success) { 105 die("Unable to perform $command error code: $error_code"); 106 } 107 my $output = join "", @$stdout_buf; 108 if ($output) { 109 my $files = parse_md_fast($mdcParser, $output); 110 foreach my $file (@$files) { 111 $ipprc->file_delete($file->{path}); 112 } 113 } 114 } 115 97 116 # now go find the workdir for this request 98 117 # XXX: we finally *have* to store this in the database -
branches/meh_branches/ppsub_test/pstamp/scripts/pstamp_get_image_job.pl
r30663 r33098 25 25 26 26 my $output_base; 27 my $bundleroot; 27 28 28 29 my $verbose; 29 my $i pprc;30 my $imagedbname; 30 31 my $dbname; 31 32 my $dbserver; … … 41 42 'rownum=s' => \$rownum, 42 43 'output_base=s' => \$output_base, 44 'bundleroot=s' => \$bundleroot, 45 'imagedbname=s' => \$imagedbname, 43 46 'dbname=s' => \$dbname, 44 47 'dbserver=s' => \$dbserver, … … 52 55 53 56 my_die( $err, $PS_EXIT_PROG_ERROR) if $err; 57 58 my $ipprc = PS::IPP::Config->new(); 54 59 55 60 my $params_file = $output_base . ".mdc"; … … 91 96 my $missing_tools; 92 97 my $dist_bundle = can_run('dist_bundle.pl') or (warn "Can't find dist_bundle.pl" and $missing_tools = 1); 98 my $pstamptool = can_run('pstamptool') or (warn "Can't find pstamptool" and $missing_tools = 1); 93 99 if ($missing_tools) { 94 100 warn("Can't find required tools."); … … 96 102 } 97 103 104 $pstamptool .= " -dbname $dbname" if $dbname; 105 $pstamptool .= " -dbserver $dbserver" if $dbserver; 106 98 107 my $outdir = dirname($output_base); 99 108 my $basename = basename($path_base); 100 my $outroot = $output_base ."_" . $basename;101 109 my $results_file = $output_base . ".bundle_results"; 110 my $outroot; 111 if ($bundleroot) { 112 my (undef, undef, undef, $mday, $month, $year) = gmtime(time()); 113 $month += 1; 114 $year += 1900; 115 116 # This will generate an outroot like: 117 # neb://any/pstamp/bundles/2011/11/22/14026916_1_1_o5739g0358o.353654.wrp.215092.skycell.2083.025 118 119 $outroot = $bundleroot . sprintf("/%4d/%02d/%02d/${job_id}_", $year, $month, $mday) . basename($output_base) . "_". $basename; 120 } else { 121 $outroot = $output_base ."_" . $basename; 122 } 102 123 103 124 { … … 105 126 $command .= " --results_file $results_file"; 106 127 $command .= " --component $component --path_base $path_base --outroot $outroot"; 107 # XXX: we need to do some work if we want to support muggle bundles 108 # $command .= " --no_magic if $no_magic"; 109 $command .= " --magicked" if $magicked; 110 $command .= " --dbname $dbname" if $dbname; 128 # DING DONG .... 129 $command .= " --no_magic"; 130 $command .= " --dbname $imagedbname" if $imagedbname; 111 131 $command .= " --verbose" if $verbose; 112 132 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = … … 147 167 } 148 168 169 if ($bundleroot) { 170 { 171 # delete any existing pstampFile in case this job has faulted and 172 # been reverted 173 my $command = "$pstamptool -deletefile -job_id $job_id"; 174 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 175 run(command => $command, verbose => $verbose); 176 unless ($success) { 177 my_die("Unable to perform $command: $error_code", $error_code >> 8); 178 } 179 } 180 my $linkname = "$outdir/$file_name"; 181 if (-l $linkname or -e $linkname) { 182 unlink $linkname or my_die("Failed to unlink existing symlink: $linkname", $PS_EXIT_UNKNOWN_ERROR); 183 } 184 my $bundle_name = dirname($outroot) . "/$file_name"; 185 my $resolved = $ipprc->file_resolve($bundle_name); 186 if (!$resolved) { 187 my_die("failed to resolve $bundle_name", $PS_EXIT_UNKNOWN_ERROR); 188 } 189 symlink $resolved, $linkname or my_die("failed to create symlink to $resolved in $outdir", 190 $PS_EXIT_UNKNOWN_ERROR); 191 192 my $command = "$pstamptool -addfile -job_id $job_id -path $bundle_name"; 193 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 194 run(command => $command, verbose => $verbose); 195 unless ($success) { 196 my_die("Unable to perform $command: $error_code", $error_code >> 8); 197 } 198 } 199 200 149 201 print REGLIST "$file_name|$bytes|$md5sum|tgz|\n"; 150 202 -
branches/meh_branches/ppsub_test/pstamp/scripts/pstamp_job_run.pl
r31508 r33098 59 59 $options = 1 if !$options; 60 60 61 # We don't need to muggle anymore. Ignore those options 62 $options &= ~($PSTAMP_REQUEST_UNCENSORED | $PSTAMP_REQUIRE_UNCENSORED); 61 63 62 64 my $ipprc = PS::IPP::Config->new(); # IPP Configuration … … 88 90 my $mdcParser = PS::IPP::Metadata::Config->new; # Parser for metadata config files 89 91 92 my $params = read_params_file($outputBase); 93 90 94 my $jobStatus; 91 95 if ($jobType eq "stamp") { 92 my $params = read_params_file($outputBase);93 96 94 97 my $argString; … … 107 110 $nan_masked = 0; 108 111 $muggle = 1; 112 } 113 114 if ($stage eq "raw") { 115 $options &= ~($PSTAMP_SELECT_MASK | $PSTAMP_SELECT_VARIANCE); 109 116 } 110 117 … … 214 221 } 215 222 223 # MAGIC IS DEAD 224 $nan_masked = 0; 225 216 226 my $command = "$ppstamp $outputBase $argString $fileArgs"; 217 227 $command .= " -dbname $dbname" if $dbname; … … 272 282 } elsif ($jobType eq "get_image") { 273 283 274 my $uri = ""; 284 my $pstamp_bundle_root = metadataLookupStr($ipprc->{_siteConfig}, "PSTAMP_BUNDLE_ROOT"); 285 my $imagedb = $params->{imagedb}; 286 275 287 my $command = "$pstamp_get_image_job --job_id $job_id --output_base $outputBase --rownum $rownum"; 288 $command .= " --bundleroot $pstamp_bundle_root" if $pstamp_bundle_root; 289 $command .= " --imagedb $imagedb" if $imagedb; 276 290 $command .= " --dbname $dbname" if $dbname; 277 291 $command .= " --dbserver $dbserver" if $dbserver; -
branches/meh_branches/ppsub_test/pstamp/scripts/pstamp_parser_run.pl
r30317 r33098 55 55 } 56 56 57 $need_magic = 0; 58 57 59 my $missing_tools; 58 60 … … 89 91 # outdir is where all of the files generated for this request are placed 90 92 # NOTE: this location needs to be kept in sync with the web interface ( request.php ) 91 my $datestr = strftime "%Y %m%d", gmtime;93 my $datestr = strftime "%Y/%m/%d", gmtime; 92 94 my $datedir = "$pstamp_workdir/$datestr"; 93 95 if (! -e $datedir ) { 94 mkdir $datedir or my_die( "failed to create working directory $datedir for request id $req_id", $req_id, 95 $PS_EXIT_CONFIG_ERROR); 96 my $rc = system "mkdir -p $datedir"; 97 if ($rc) { 98 my $status = $rc >> 8; 99 $status = $PS_EXIT_CONFIG_ERROR if !$status; 100 my_die( "failed to create working directory $datedir for request id $req_id", $req_id, 101 $status); 102 } 96 103 } 97 104 -
branches/meh_branches/ppsub_test/pstamp/scripts/pstamp_server_status
r30517 r33098 71 71 $error_code = (($error_code >> 8) or 1); 72 72 if ($error_code == 12) { 73 #print "Postage Stamp Server is not running\n";74 print "Postage Stamp Server will be down for maintenance it will back shortly.\n";73 print "Postage Stamp Server is not running\n"; 74 #print "Postage Stamp Server will be down for maintenance it will back shortly.\n"; 75 75 exit 0; 76 76 } else { -
branches/meh_branches/ppsub_test/pstamp/scripts/pstampparse.pl
r31507 r33098 148 148 } elsif ($lcname =~ /qub/) { 149 149 $label = "QUB"; 150 $label_changed = 1; 151 } elsif ($lcname =~ /pypstamp/) { 152 $label = "PY"; 150 153 $label_changed = 1; 151 154 } … … 251 254 # If we encounter an error for a particular row add a job with the proper fault code. 252 255 256 my $stage = $row->{IMG_TYPE}; 257 253 258 my $rownum = $row->{ROWNUM}; 254 259 if (!validID($rownum)) { … … 272 277 } 273 278 if ($job_type eq 'get_image') { 274 unless ($req_type eq 'byid' or $req_type eq 'byexp' ) {275 print STDERR "REQ_TYPE must be 'byid' or 'byexp' for JOB_TYPE 'get_image'\n";279 unless ($req_type eq 'byid' or $req_type eq 'byexp' or ($req_type eq 'byskycell' and $stage eq 'stack')) { 280 print STDERR "REQ_TYPE must be 'byid' or 'byexp' or byskcyell for stacks for JOB_TYPE 'get_image'\n"; 276 281 insertFakeJobForRow($row, 1, $PSTAMP_INVALID_REQUEST); 277 282 return 0; … … 334 339 } 335 340 336 my $stage = $row->{IMG_TYPE};337 341 if (!check_image_type($stage)) { 338 342 print STDERR "invalid IMG_TYPE for row $rownum\n"; … … 460 464 my $numRows = scalar @$rowList; 461 465 466 if (($req_type eq 'byskycell') or ($req_type eq 'bycoord')) { 467 # avoid error from print below if $id isn't needed 468 $id = "" if !$id; 469 } 462 470 print "Collected $numRows rows beginning with row $rownum. $req_type $stage $id $tess_id $component\n"; 463 471
Note:
See TracChangeset
for help on using the changeset viewer.
