- Timestamp:
- Oct 18, 2009, 10:23:28 AM (17 years ago)
- Location:
- branches/eam_branches/20090820
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
ippScripts/scripts/ipp_cleanup.pl (modified) (21 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/20090820
-
branches/eam_branches/20090820/ippScripts/scripts/ipp_cleanup.pl
r25766 r25870 91 91 92 92 # if there are no chipProcessedImfiles (@$stdout_buf == 0), the reset the state to 'new' 93 # XXX Why? This could just mean there's nothing to cleanup, or that we're trying to rerun an errored run. 93 94 if (@$stdout_buf == 0) { 94 my $command = "$chiptool -chip_id $stage_id -updaterun -set_state new";95 my $command = "$chiptool -chip_id $stage_id -updaterun -set_state $error_state"; 95 96 $command .= " -dbname $dbname" if defined $dbname; 96 97 … … 123 124 my $config_file = $ipprc->filename("PPIMAGE.CONFIG", $path_base, $class_id); 124 125 125 # if (!$config_file or ! -e $config_file) {126 126 unless ($ipprc->file_exists($config_file)) { 127 127 print STDERR "skipping cleanup for chipRun $stage_id $class_id " … … 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_cleaned"; 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 … … 199 210 &my_die("Unable to perform chiptool: $error_code", "chip", $stage_id, $error_code); 200 211 } 212 213 # We want to flag the run as well, to avoid attempting to reprocess the same data over and over again. 214 $command = "$chiptool -chip_id $stage_id -updaterun -set_state $error_state"; 215 $command .= " -dbname $dbname" if defined $dbname; 216 217 ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 218 run(command => $command, verbose => $verbose); 219 unless ($success) { 220 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 221 &my_die("Unable to perform chiptool: $error_code", "chip", $stage_id, $error_code); 222 } 223 201 224 } 202 225 } … … 283 306 &my_die("Unable to perform camtool: $error_code", "camera", $stage_id, $error_code); 284 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_cleaned"; 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 285 319 } else { 286 320 # since 'camera' has only a single imfile, we can just update the run … … 296 330 exit $PS_EXIT_UNKNOWN_ERROR; 297 331 } 332 333 298 334 exit 0; 299 335 } … … 314 350 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 315 351 &my_die("Unable to perform warptool: $error_code", "warp", $stage_id, $error_code); 352 } 353 354 if (@$stdout_buf == 0) { 355 # No skycells were found for some reason. 356 # Not technically an "error," but a "you told me to do X, and I can't. Please fix this yourself." 357 my $command = "$warptool -updaterun -warp_id $stage_id -set_state $error_state"; 358 $command .= " -dbname $dbname" if defined $dbname; 359 360 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 361 run(command => $command, verbose => $verbose); 362 unless ($success) { 363 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 364 &my_die("Unable to perform warptool: $error_code", "warp", $stage_id, $error_code); 365 } 366 367 exit(0); 316 368 } 317 369 my $metadata = $mdcParser->parse(join "", @$stdout_buf) or … … 389 441 &my_die("Unable to perform warptool: $error_code", "warp", $stage_id, $error_code); 390 442 } 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_cleaned"; 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 } 453 391 454 } else { 392 455 my $command = "$warptool -updateskyfile -warp_id $stage_id -skycell_id $skycell_id -set_state $error_state"; … … 399 462 &my_die("Unable to perform warptool: $error_code", "warp", $stage_id, $error_code); 400 463 } 401 exit $PS_EXIT_UNKNOWN_ERROR; 464 465 # exit $PS_EXIT_UNKNOWN_ERROR; 402 466 } 403 467 } … … 407 471 ### added for cleanup, based on warp stage entry 408 472 if ($stage eq 'stack') { 409 410 473 die "--stage_id required for stage stack\n" if !$stage_id; 411 412 474 # this stage uses 'stacktool' 413 475 my $stacktool = can_run('stacktool') or die "Can't find stacktool"; … … 422 484 &my_die("Unable to perform stacktool: $error_code", "stack", $stage_id, $error_code); 423 485 } 486 487 if (@$stdout_buf == 0) { 488 # No skycells were found for some reason. 489 # Not technically an "error," but a "you told me to do X, and I can't. Please fix this yourself." 490 my $command = "$stacktool -updaterun -stack_id $stage_id -set_state $error_state"; 491 $command .= " -dbname $dbname" if defined $dbname; 492 493 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 494 run(command => $command, verbose => $verbose); 495 unless ($success) { 496 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 497 &my_die("Unable to perform stacktool: $error_code", "stack", $stage_id, $error_code); 498 } 499 500 exit(0); 501 } 502 424 503 my $metadata = $mdcParser->parse(join "", @{ $stdout_buf }) or 425 504 &my_die("Unable to parse metadata config doc", "stack", $stage_id, $PS_EXIT_PROG_ERROR); … … 434 513 435 514 my $status = 1; 436 if ($mode eq "goto_cleaned") { 437 my $config_file = $ipprc->filename("PPSTACK.CONFIG", $path_base, $skycell_id); 438 439 unless ($ipprc->file_exists($config_file)) { 440 print STDERR "skipping cleanup for stackRun $stage_id $skycell_id" . 441 " because config file is missing\n"; 442 $status = 0; 443 } 444 } 445 elsif ($mode eq "goto_scrubbed") { 446 my $config_file = $ipprc->filename("PPSTACK.CONFIG", $path_base, $skycell_id); 447 448 if ($ipprc->file_exists($config_file)) { 449 print STDERR "skipping scrubbed for stackRun $stage_id $skycell_id" . 450 " because config file is present\n"; 451 $status = 0; 452 } 453 } 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 454 540 if ($status) { 455 541 my @files = (); … … 475 561 my $command = "$stacktool -stack_id $stage_id"; 476 562 if ($mode eq "goto_purged") { 477 $command .= " -updaterun -s tate purged";563 $command .= " -updaterun -set_state purged"; 478 564 } 479 565 elsif ($mode eq "goto_cleaned") { 480 $command .= " -updaterun -s tate cleaned";566 $command .= " -updaterun -set_state cleaned"; 481 567 } 482 568 elsif ($mode eq "goto_scrubbed") { 483 $command .= " -updaterun -s tate scrubbed";569 $command .= " -updaterun -set_state scrubbed"; 484 570 } 485 571 $command .= " -dbname $dbname" if defined $dbname; … … 491 577 &my_die("Unable to perform stacktool: $error_code", "stack", $stage_id, $error_code); 492 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_cleaned"; 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 493 590 } else { 494 my $command = "$stacktool -updaterun -stack_id $stage_id -s tate $error_state";591 my $command = "$stacktool -updaterun -stack_id $stage_id -set_state $error_state"; 495 592 $command .= " -dbname $dbname" if defined $dbname; 496 593 … … 501 598 &my_die("Unable to perform stacktool: $error_code", "stack", $stage_id, $error_code); 502 599 } 503 exit $PS_EXIT_UNKNOWN_ERROR;600 # exit $PS_EXIT_UNKNOWN_ERROR; 504 601 } 505 602 } … … 523 620 &my_die("Unable to perform difftool: $error_code", "diff", $stage_id, $error_code); 524 621 } 622 623 if (@$stdout_buf == 0) { 624 # No skycells were found for some reason. 625 # Not technically an "error," but a "you told me to do X, and I can't. Please fix this yourself." 626 my $command = "$difftool -updaterun -diff_id $stage_id -set_state $error_state"; 627 $command .= " -dbname $dbname" if defined $dbname; 628 629 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 630 run(command => $command, verbose => $verbose); 631 unless ($success) { 632 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 633 &my_die("Unable to perform difftool: $error_code", "diff", $stage_id, $error_code); 634 } 635 636 exit(0); 637 } 638 525 639 my $metadata = $mdcParser->parse(join "", @{ $stdout_buf }) or 526 640 &my_die("Unable to parse metadata config doc", "diff", $stage_id, $PS_EXIT_PROG_ERROR); … … 535 649 536 650 my $status = 1; 537 if ($mode eq "goto_cleaned") { 538 my $config_file = $ipprc->filename("PPSUB.CONFIG", $path_base, $skycell_id); 539 540 unless ($ipprc->file_exists($config_file)) { 541 print STDERR "skipping cleanup for diffRun $stage_id $skycell_id" . 542 " because config file ($config_file) is missing\n"; 543 $status = 0; 544 } 545 } 546 elsif ($mode eq "goto_scrubbed") { 547 my $config_file = $ipprc->filename("PPSUB.CONFIG", $path_base, $skycell_id); 548 549 if ($ipprc->file_exists($config_file)) { 550 print STDERR "skipping scrubbed for diffRun $stage_id $skycell_id" . 551 " because config file ($config_file) is present\n"; 552 $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 } 553 674 } 554 675 } … … 588 709 # print STDERR "MY STATUS: $status\n"; 589 710 if ($status) { 590 my $command = "$difftool -diff_id $stage_id ";591 592 if ($mode eq "goto_purged") { 593 $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"; 594 715 } 595 716 elsif ($mode eq "goto_cleaned") { 596 $command .= " - updaterun -state cleaned";717 $command .= " -tocleanedskyfile"; 597 718 } 598 719 elsif ($mode eq "goto_scrubbed") { 599 $command .= " - updaterun -state scrubbed";720 $command .= " -toscrubbedskyfile"; 600 721 } 601 722 … … 608 729 &my_die("Unable to perform difftool: $error_code", "diff", $stage_id, $error_code); 609 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_cleaned"; 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 610 742 } else { 611 my $command = "$difftool -updaterun -diff_id $stage_id -s tate $error_state";743 my $command = "$difftool -updaterun -diff_id $stage_id -set_state $error_state"; 612 744 613 745 $command .= " -dbname $dbname" if defined $dbname; … … 619 751 &my_die("Unable to perform difftool: $error_code", "diff", $stage_id, $error_code); 620 752 } 621 exit $PS_EXIT_UNKNOWN_ERROR;753 # exit $PS_EXIT_UNKNOWN_ERROR; 622 754 } 623 755 } … … 646 778 # if there are no fakeProcessedImfiles (@$stdout_buf == 0), the reset the state to 'new' 647 779 if (@$stdout_buf == 0) { 648 my $command = "$faketool -fake_id $stage_id -updaterun -set_state new";780 my $command = "$faketool -fake_id $stage_id -updaterun -set_state $error_state"; 649 781 $command .= " -dbname $dbname" if defined $dbname; 650 782
Note:
See TracChangeset
for help on using the changeset viewer.
