Changeset 25801 for trunk/ippScripts/scripts/ipp_cleanup.pl
- Timestamp:
- Oct 7, 2009, 4:26:32 PM (17 years ago)
- File:
-
- 1 edited
-
trunk/ippScripts/scripts/ipp_cleanup.pl (modified) (17 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippScripts/scripts/ipp_cleanup.pl
r25781 r25801 187 187 &my_die("Unable to perform chiptool: $error_code", "chip", $stage_id, $error_code); 188 188 } 189 190 # Tell magicdstool that we've cleaned up this data, so it needs to do the same if it needs to do the same. 191 my $magicdstool = can_run('magicdstool') or die "Can't find magicdstool"; 192 $command = "$magicdstool -dbname gpc1 -stage $stage -stage_id $stage_id -updaterun -set_state goto_purged"; 193 ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 194 run(command => $command, verbose => $verbose); 195 unless ($success) { 196 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 197 &my_die("Unable to perform magicdstool: $error_code", "$stage", $stage_id, $error_code); 198 } 199 189 200 } else { 190 201 … … 209 220 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 210 221 &my_die("Unable to perform chiptool: $error_code", "chip", $stage_id, $error_code); 211 212 } 222 } 223 213 224 } 214 225 } … … 295 306 &my_die("Unable to perform camtool: $error_code", "camera", $stage_id, $error_code); 296 307 } 308 309 # Tell magicdstool that we've cleaned up this data, so it needs to do the same if it needs to do the same. 310 my $magicdstool = can_run('magicdstool') or die "Can't find magicdstool"; 311 $command = "$magicdstool -dbname gpc1 -stage $stage -stage_id $stage_id -updaterun -set_state goto_purged"; 312 ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 313 run(command => $command, verbose => $verbose); 314 unless ($success) { 315 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 316 &my_die("Unable to perform magicdstool: $error_code", "$stage", $stage_id, $error_code); 317 } 318 297 319 } else { 298 320 # since 'camera' has only a single imfile, we can just update the run … … 308 330 exit $PS_EXIT_UNKNOWN_ERROR; 309 331 } 332 333 310 334 exit 0; 311 335 } … … 418 442 } 419 443 444 # Tell magicdstool that we've cleaned up this data, so it needs to do the same if it needs to do the same. 445 my $magicdstool = can_run('magicdstool') or die "Can't find magicdstool"; 446 $command = "$magicdstool -dbname gpc1 -stage $stage -stage_id $stage_id -updaterun -set_state goto_purged"; 447 ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 448 run(command => $command, verbose => $verbose); 449 unless ($success) { 450 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 451 &my_die("Unable to perform magicdstool: $error_code", "$stage", $stage_id, $error_code); 452 } 420 453 421 454 } else { … … 438 471 ### added for cleanup, based on warp stage entry 439 472 if ($stage eq 'stack') { 440 441 473 die "--stage_id required for stage stack\n" if !$stage_id; 442 443 474 # this stage uses 'stacktool' 444 475 my $stacktool = can_run('stacktool') or die "Can't find stacktool"; … … 457 488 # No skycells were found for some reason. 458 489 # Not technically an "error," but a "you told me to do X, and I can't. Please fix this yourself." 459 my $command = "$stacktool -updaterun -stack_id $stage_id -s et_state $error_state";490 my $command = "$stacktool -updaterun -stack_id $stage_id -state $error_state"; 460 491 $command .= " -dbname $dbname" if defined $dbname; 461 492 … … 464 495 unless ($success) { 465 496 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 466 &my_die("Unable to perform warptool: $error_code", "warp", $stage_id, $error_code);497 &my_die("Unable to perform stacktool: $error_code", "stack", $stage_id, $error_code); 467 498 } 468 499 … … 482 513 483 514 my $status = 1; 484 if ($mode eq "goto_cleaned") { 485 my $config_file = $ipprc->filename("PPSTACK.CONFIG", $path_base, $skycell_id); 486 487 unless ($ipprc->file_exists($config_file)) { 488 print STDERR "skipping cleanup for stackRun $stage_id $skycell_id" . 489 " because config file is missing\n"; 490 $status = 0; 491 } 492 } 493 elsif ($mode eq "goto_scrubbed") { 494 my $config_file = $ipprc->filename("PPSTACK.CONFIG", $path_base, $skycell_id); 495 496 if ($ipprc->file_exists($config_file)) { 497 print STDERR "skipping scrubbed for stackRun $stage_id $skycell_id" . 498 " because config file is present\n"; 499 $status = 0; 500 } 501 } 515 if ((!exists($skyfile->{path_base}))|| 516 (!defined($path_base))) { 517 $status = 0; 518 } 519 if ($status) { 520 if ($mode eq "goto_cleaned") { 521 my $config_file = $ipprc->filename("PPSTACK.CONFIG", $path_base, $skycell_id); 522 523 unless ($ipprc->file_exists($config_file)) { 524 print STDERR "skipping cleanup for stackRun $stage_id $skycell_id" . 525 " because config file is missing\n"; 526 $status = 0; 527 } 528 } 529 elsif ($mode eq "goto_scrubbed") { 530 my $config_file = $ipprc->filename("PPSTACK.CONFIG", $path_base, $skycell_id); 531 532 if ($ipprc->file_exists($config_file)) { 533 print STDERR "skipping scrubbed for stackRun $stage_id $skycell_id" . 534 " because config file is present\n"; 535 $status = 0; 536 } 537 } 538 } 539 502 540 if ($status) { 503 541 my @files = (); … … 539 577 &my_die("Unable to perform stacktool: $error_code", "stack", $stage_id, $error_code); 540 578 } 579 580 # Tell magicdstool that we've cleaned up this data, so it needs to do the same if it needs to do the same. 581 my $magicdstool = can_run('magicdstool') or die "Can't find magicdstool"; 582 $command = "$magicdstool -dbname gpc1 -stage $stage -stage_id $stage_id -updaterun -set_state goto_purged"; 583 ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 584 run(command => $command, verbose => $verbose); 585 unless ($success) { 586 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 587 &my_die("Unable to perform magicdstool: $error_code", "$stage", $stage_id, $error_code); 588 } 589 541 590 } else { 542 591 my $command = "$stacktool -updaterun -stack_id $stage_id -state $error_state"; … … 549 598 &my_die("Unable to perform stacktool: $error_code", "stack", $stage_id, $error_code); 550 599 } 551 exit $PS_EXIT_UNKNOWN_ERROR;600 # exit $PS_EXIT_UNKNOWN_ERROR; 552 601 } 553 602 } … … 575 624 # No skycells were found for some reason. 576 625 # Not technically an "error," but a "you told me to do X, and I can't. Please fix this yourself." 577 my $command = "$difftool -updaterun -diff_id $stage_id -s et_state $error_state";626 my $command = "$difftool -updaterun -diff_id $stage_id -state $error_state"; 578 627 $command .= " -dbname $dbname" if defined $dbname; 579 628 … … 582 631 unless ($success) { 583 632 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 584 &my_die("Unable to perform warptool: $error_code", "warp", $stage_id, $error_code);633 &my_die("Unable to perform difftool: $error_code", "diff", $stage_id, $error_code); 585 634 } 586 635 … … 600 649 601 650 my $status = 1; 602 if ($mode eq "goto_cleaned") { 603 my $config_file = $ipprc->filename("PPSUB.CONFIG", $path_base, $skycell_id); 604 605 unless ($ipprc->file_exists($config_file)) { 606 print STDERR "skipping cleanup for diffRun $stage_id $skycell_id" . 607 " because config file ($config_file) is missing\n"; 608 $status = 0; 609 } 610 } 611 elsif ($mode eq "goto_scrubbed") { 612 my $config_file = $ipprc->filename("PPSUB.CONFIG", $path_base, $skycell_id); 613 614 if ($ipprc->file_exists($config_file)) { 615 print STDERR "skipping scrubbed for diffRun $stage_id $skycell_id" . 616 " because config file ($config_file) is present\n"; 617 $status = 0; 651 if ((!exists($skyfile->{path_base}))|| 652 (!defined($path_base))) { 653 $status = 0; 654 } 655 if ($status) { 656 657 if ($mode eq "goto_cleaned") { 658 my $config_file = $ipprc->filename("PPSUB.CONFIG", $path_base, $skycell_id); 659 660 unless ($ipprc->file_exists($config_file)) { 661 print STDERR "skipping cleanup for diffRun $stage_id $skycell_id" . 662 " because config file ($config_file) is missing\n"; 663 $status = 0; 664 } 665 } 666 elsif ($mode eq "goto_scrubbed") { 667 my $config_file = $ipprc->filename("PPSUB.CONFIG", $path_base, $skycell_id); 668 669 if ($ipprc->file_exists($config_file)) { 670 print STDERR "skipping scrubbed for diffRun $stage_id $skycell_id" . 671 " because config file ($config_file) is present\n"; 672 $status = 0; 673 } 618 674 } 619 675 } … … 653 709 # print STDERR "MY STATUS: $status\n"; 654 710 if ($status) { 655 my $command = "$difftool -diff_id $stage_id ";656 657 if ($mode eq "goto_purged") { 658 $command .= " - updaterun -state purged";711 my $command = "$difftool -diff_id $stage_id -skycell_id $skycell_id"; 712 713 if ($mode eq "goto_purged") { 714 $command .= " -topurgedskyfile"; 659 715 } 660 716 elsif ($mode eq "goto_cleaned") { 661 $command .= " - updaterun -state cleaned";717 $command .= " -tocleanedskyfile"; 662 718 } 663 719 elsif ($mode eq "goto_scrubbed") { 664 $command .= " - updaterun -state scrubbed";720 $command .= " -toscrubbedskyfile"; 665 721 } 666 722 … … 673 729 &my_die("Unable to perform difftool: $error_code", "diff", $stage_id, $error_code); 674 730 } 731 732 # Tell magicdstool that we've cleaned up this data, so it needs to do the same if it needs to do the same. 733 my $magicdstool = can_run('magicdstool') or die "Can't find magicdstool"; 734 $command = "$magicdstool -dbname gpc1 -stage $stage -stage_id $stage_id -updaterun -set_state goto_purged"; 735 ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 736 run(command => $command, verbose => $verbose); 737 unless ($success) { 738 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 739 &my_die("Unable to perform magicdstool: $error_code", "$stage", $stage_id, $error_code); 740 } 741 675 742 } else { 676 743 my $command = "$difftool -updaterun -diff_id $stage_id -state $error_state"; … … 684 751 &my_die("Unable to perform difftool: $error_code", "diff", $stage_id, $error_code); 685 752 } 686 exit $PS_EXIT_UNKNOWN_ERROR;753 # exit $PS_EXIT_UNKNOWN_ERROR; 687 754 } 688 755 }
Note:
See TracChangeset
for help on using the changeset viewer.
