Changeset 28021
- Timestamp:
- May 19, 2010, 11:32:02 AM (16 years ago)
- File:
-
- 1 edited
-
trunk/pstamp/scripts/pstampparse.pl (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/pstamp/scripts/pstampparse.pl
r28015 r28021 521 521 my $dep_id; 522 522 523 # XXX: this code is repeated in queueGetImageJobs we should encapsulate it in a subroutine and share it 524 if ($stage ne 'raw') { 525 # updates for stack stage not supported yet 526 my $allow_wait_for_update = ($stage ne 'stack'); 527 my $run_state = $image->{state}; 528 my $data_state = $image->{data_state}; 529 $data_state = $run_state if $stage eq 'stack'; 530 if (($run_state =~ /purged/) or ($run_state =~ /scrubbed/)) { 531 # image is gone and it's not coming back 532 $newState = 'stop'; 533 $fault = $PSTAMP_GONE; 534 } elsif (($run_state eq "error_cleaned") or ($data_state eq 'error_cleaned')) { 535 # if cleanup had an error don't get the user's hopes up 536 $newState = 'stop'; 537 $fault = $PSTAMP_NOT_AVAILABLE; 538 } elsif (($data_state ne 'full') or ($need_magic and ($image->{magicked} < 0))) { 539 if ($stage eq 'chip') { 540 my $burntool_state = $image->{burntool_state}; 541 # XXX: get value 13 from ppImage recipe 542 if ($burntool_state and (abs($burntool_state) < 13)) { 543 $newState = 'stop'; 544 $fault = $PSTAMP_NOT_AVAILABLE; 545 } 546 } 547 if (!$allow_wait_for_update) { 548 print STDERR "wait for update not supported for stage $stage yet\n"; 549 $newState = 'stop'; 550 $fault = $PSTAMP_NOT_AVAILABLE; 551 } 552 if (!$fault) { 553 # wait for update unless the customer asks us not to 554 if (($option_mask & $PSTAMP_NO_WAIT_FOR_UPDATE)) { 555 $newState = 'stop'; 556 $fault = $PSTAMP_NOT_AVAILABLE; 557 } elsif (!$image->{magicked}) { 558 $newState = 'stop'; 559 $fault = $PSTAMP_NOT_DESTREAKED; 560 } else { 561 # cause the image to be re-made 562 # set up to queue an update run 563 queue_update_run(\$newState, \$fault, \$dep_id, $image->{imagedb}, 564 $run_state, $stage, $image->{stage_id}, $image->{component}, $need_magic); 565 } 566 } 567 } 568 } 523 queueUpdatesIfNeeded($stage, $image, $option_mask, \$newState, \$fault, \$dep_id); 569 524 570 525 my $command = "$pstamptool -addjob -req_id $req_id -job_type $row->{JOB_TYPE}" … … 706 661 my $dep_id; 707 662 708 if ($stage ne 'raw') { 709 my $run_state = $image->{state}; 710 my $data_state = $image->{data_state}; 711 $data_state = $run_state if $stage eq "stack"; 712 # if (($run_state eq 'goto_purged') or ($data_state eq 'purged') or 713 # ($run_state eq 'goto_scrubbed') or ($data_state eq 'scrubbed')) { 714 if (($run_state =~ /purged/) or ($run_state =~ /scrubbed/)) { 715 # image is gone and it's not coming back 716 $newState = 'stop'; 717 $fault = $PSTAMP_GONE; 718 } elsif ($run_state eq "error_cleaned") { 719 # if cleanup had an error don't get the user's hopes up 720 $newState = 'stop'; 721 $fault = $PSTAMP_NOT_AVAILABLE; 722 } elsif (($data_state ne 'full') or ($need_magic and ($image->{magicked} < 0))) { 723 # wait for update unless the customer asks us to not to 724 if ($option_mask & $PSTAMP_NO_WAIT_FOR_UPDATE) { 725 $newState = 'stop'; 726 $fault = $PSTAMP_NOT_AVAILABLE; 727 } else { 728 # cause the image to be re-made 729 # set up to queue an update run 730 queue_update_run(\$newState, \$fault, \$dep_id, $image->{imagedb}, 731 $run_state, $stage, $image->{stage_id}, $image->{component}, $need_magic); 732 } 733 } 734 } 663 queueUpdatesIfNeeded($stage, $image, $option_mask, \$newState, \$fault, \$dep_id); 735 664 736 665 $num_jobs++; … … 871 800 } 872 801 873 sub queue_update_run802 sub get_dependent 874 803 { 875 804 my ($r_jobState, $r_fault, $r_dep_id, $imagedb, $state, $stage, $stage_id, $component, $need_magic) = @_; 876 805 877 # XXX: The update process for warp and subsequent stages requires 878 # destreaking to run because the -pending queries require it when magicked > 0 879 # queries. 880 # The case of stack-stack diffs is taken care of in pstamp_checkdependent 806 # XXX: The update process for warp and subsequent stages requires # destreaking to be performed 807 # because the -pending queries require the inputs to have magicked >= 0 808 # The case of stack-stack diffs not needing to be destreaked is taken care of in pstamp_checkdependent 881 809 $need_magic = 1 if $imagedb eq 'gpc1'; 882 810 883 if (($state ne 'cleaned') and ($state ne 'update') and ($state ne 'goto_cleaned')) { 811 # chipRun's can be in full state if destreaking is necessary 812 if (($state ne 'cleaned') and ($state ne 'update') and ($state ne 'goto_cleaned') and 813 ($stage eq 'chip' and $state eq 'full')) { 884 814 my_die("$stage $stage_id is in unexpected state $state", $PS_EXIT_PROG_ERROR); 885 815 } … … 917 847 } 918 848 849 sub queueUpdatesIfNeeded { 850 my $stage = shift; 851 my $image = shift; 852 my $option_mask = shift; 853 my $r_newState = shift; 854 my $r_fault = shift; 855 my $r_dep_id = shift; 856 857 if ($stage ne 'raw') { 858 my $run_state = $image->{state}; 859 my $data_state = $image->{data_state}; 860 $data_state = $run_state if $stage eq 'stack'; 861 if (($run_state =~ /purged/) or ($run_state =~ /scrubbed/) or ($run_state eq 'drop')) { 862 # image is gone and it's not coming back 863 $$r_newState = 'stop'; 864 $$r_fault = $PSTAMP_GONE; 865 } elsif (($run_state eq "error_cleaned") or ($data_state eq 'error_cleaned')) { 866 # if cleanup had an error don't get the user's hopes up set fault to gone 867 $$r_newState = 'stop'; 868 $$r_fault = $PSTAMP_GONE; 869 } elsif (($data_state ne 'full') or ($need_magic and ($image->{magicked} < 0))) { 870 871 if ($stage eq 'stack') { 872 print STDERR "Stamps cannot be made from cleaned stacks.\n"; 873 $$r_newState = 'stop'; 874 $$r_fault = $PSTAMP_GONE; 875 } 876 if (!$$r_fault) { 877 # wait for update unless the customer asks us not to 878 if (($option_mask & $PSTAMP_NO_WAIT_FOR_UPDATE)) { 879 $$r_newState = 'stop'; 880 $$r_fault = $PSTAMP_NOT_AVAILABLE; 881 } elsif (!$image->{magicked}) { 882 $$r_newState = 'stop'; 883 $$r_fault = $PSTAMP_NOT_DESTREAKED; 884 } else { 885 # cause the image to be re-made 886 # set up to queue an update run 887 get_dependent(\$$r_newState, \$$r_fault, $r_dep_id, $image->{imagedb}, 888 $run_state, $stage, $image->{stage_id}, $image->{component}, $need_magic); 889 } 890 } 891 } 892 } 893 } 894 919 895 sub write_params { 920 896 my $output_base = shift;
Note:
See TracChangeset
for help on using the changeset viewer.
