Changeset 25793 for trunk/pstamp/scripts/pstampparse.pl
- Timestamp:
- Oct 7, 2009, 1:05:22 PM (17 years ago)
- File:
-
- 1 edited
-
trunk/pstamp/scripts/pstampparse.pl (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/pstamp/scripts/pstampparse.pl
r25776 r25793 72 72 } 73 73 74 # just deal with these arguments once and for all 75 $pstamptool .= " -dbname $dbname" if $dbname; 76 $pstamptool .= " -dbserver $dbserver" if $dbserver; 77 74 78 # list_job is a deugging mode 75 79 $no_update = 1 if $mode eq "list_job"; … … 105 109 if ($req_id and !$no_update) { 106 110 my $command = "$pstamptool -listreq -name $req_name -not_req_id $req_id"; 107 $command .= " -dbname $dbname" if $dbname;108 $command .= " -dbserver $dbserver" if $dbserver;109 111 # no verbose so that error message about request not found doesn't appear in parse_error.txt 110 112 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = … … 127 129 my $command = "$pstamptool -updatereq -req_id $req_id -name $req_name"; 128 130 $command .= " -outProduct $product"; 129 $command .= " -dbname $dbname" if $dbname;130 $command .= " -dbserver $dbserver" if $dbserver;131 131 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 132 132 run(command => $command, verbose => $verbose); … … 398 398 my $newState = "run"; 399 399 my $fault = 0; 400 401 if (($stage ne 'stack') and ($stage ne 'raw')) { 402 if (($image->{state} eq 'goto_purged') or ($image->{data_state} eq 'purged')) { 400 my $dep_id; 401 402 if ($stage ne 'raw') { 403 my $run_state = $image->{state}; 404 my $data_state = $image->{data_state}; 405 if (($run_state eq 'goto_purged') or ($data_state eq 'purged') or 406 ($run_state eq 'goto_scrubbed') or ($data_state eq 'scrubbed')) { 407 # image is gone and it's not coming back 403 408 $newState = 'stop'; 404 409 $fault = $PSTAMP_GONE; 405 } elsif (($image->{data_state} ne 'full') or ($image->{state} ne 'full' )) { 406 # XXX here is where we need to queue an update job 407 # for now just say that the image is not available 408 $newState = 'stop'; 409 $fault = $PSTAMP_NOT_AVAILABLE; 410 } elsif (($data_state ne 'full') or ($run_state ne 'full' )) { 411 my $PSTAMP_NO_UPDATE = 2048; 412 # for now just fault while I build pstampDependent 413 if ($option_mask & $PSTAMP_NO_UPDATE) { 414 $newState = 'stop'; 415 $fault = $PSTAMP_NOT_AVAILABLE; 416 } else { 417 # cause the image to be re-made 418 # set up to queue an update run 419 queue_update_run(\$newState, \$fault, \$dep_id, $image->{image_db}, 420 $run_state, $stage, $image->{stage_id}, $need_magic, $image->{label}); 421 } 410 422 } 411 423 } … … 416 428 $command .= " -fault $fault" if $fault; 417 429 $command .= " -exp_id $exp_id" if $exp_id; 418 $command .= " -dbname $dbname" if $dbname; 419 $command .= " -dbserver $dbserver" if $dbserver; 430 $command .= " -dep_id $dep_id" if $dep_id; 420 431 421 432 if ($mode eq "list_job") { … … 594 605 my $command = "$pstamptool -addjob -req_id $req_id -job_type $job_type" 595 606 . " -rownum $rownum -state stop -fault $fault"; 596 $command .= " -dbname $dbname" if $dbname;597 $command .= " -dbserver $dbserver" if $dbserver;598 607 599 608 if ($mode eq "list_job") { … … 718 727 } 719 728 729 sub queue_update_run 730 { 731 my ($r_jobState, $r_fault, $r_dep_id, $imagedb, $state, $stage, $stage_id, $need_magic, $label) = @_; 732 733 if (($state ne 'cleaned') and ($state ne 'update') and ($state ne 'goto_cleaned')) { 734 my_die("$stage $stage_id is in unexpected state $state", $PS_EXIT_PROG_ERROR); 735 } 736 737 my $dep_id; 738 my $command = "$pstamptool -getdependent -stage $stage -stage_id $stage_id -imagedb $imagedb"; 739 $command .= " -rlabel $label" if $label; 740 $command .= " -no_magic" if !$need_magic; 741 if (!$no_update) { 742 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 743 run(command => $command, verbose => $verbose); 744 unless ($success) { 745 my_die("$command failed", $PS_EXIT_UNKNOWN_ERROR); 746 } 747 my $output = join "", @$stdout_buf; 748 chomp $output; 749 $dep_id = $output; 750 my_die("pstamptool -getdependent returned invalid dep_id", $PS_EXIT_PROG_ERROR) if !$dep_id; 751 } else { 752 print STDERR "skipping $command\n"; 753 $dep_id = 42; 754 } 755 756 $$r_dep_id = $dep_id; 757 $r_fault = 0; 758 $r_jobState = 'blocked'; 759 } 760 720 761 sub my_die 721 762 {
Note:
See TracChangeset
for help on using the changeset viewer.
