Changeset 31429
- Timestamp:
- May 3, 2011, 7:28:38 PM (15 years ago)
- Location:
- branches/czw_branch/20110406
- Files:
-
- 4 edited
-
ippScripts/scripts/diff_skycell.pl (modified) (2 diffs)
-
ippScripts/scripts/lap_science.pl (modified) (10 diffs)
-
ippTools/share/laptool_inactiveexp.sql (modified) (3 diffs)
-
ippTools/src/laptool.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/czw_branch/20110406/ippScripts/scripts/diff_skycell.pl
r31302 r31429 31 31 my $ppSub = can_run('ppSub') or (warn "Can't find ppSub" and $missing_tools = 1); 32 32 my $ppStatsFromMetadata = can_run('ppStatsFromMetadata') or (warn "Can't find ppStatsFromMetadata" and $missing_tools = 1); 33 my $nebInsert = can_run('neb-insert') or (warn "Can't find neb-insert" and $missing_tools = 1); 33 34 if ($missing_tools) { 34 35 warn("Can't find required tools."); … … 383 384 } 384 385 } 386 if ($reduction eq 'NOCONVDIFF') { 387 my $refConv = prepare_output("PPSUB.REF.CONV", $outroot, 0); 388 my $templateFile = $ipprc->file_resolve($template,0); 389 $command = "$nebInsert $refConv $templateFile"; 390 ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 391 run(command => $command, verbose => $verbose); 392 unless ($success) { 393 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 394 &my_die("Unable to perform neb-insert: $error_code", $diff_id, $skycell_id, $error_code); 395 } 396 } 397 398 385 399 } elsif ($run_state eq 'update') { 386 400 &my_die("Update resulted in poor quality image: $quality", $diff_id, $skycell_id, $PS_EXIT_SYS_ERROR); -
branches/czw_branch/20110406/ippScripts/scripts/lap_science.pl
r31428 r31429 82 82 } 83 83 if (defined($cleanup_mode)) { 84 unless (($lapRunInfo{state} eq ' done')||84 unless (($lapRunInfo{state} eq 'full')|| 85 85 ($lapRunInfo{state} eq 'drop')) { 86 86 &my_die("Cannot run cleanup_mode if lapRun != done!", $lap_id); … … 356 356 $complete_qstacks++; 357 357 } 358 elsif (($stack->{quick_state})&&($stack->{quick_state} eq 'new')&& 359 ($stack->{quick_fault} >= 4)&&($stack->{quick_fault} != 32767)) { 360 printf STDERR "Faulted quick stack: $stack->{quick_stack_id} $stack->{quick_fault}\n"; 361 $complete_qstacks++;# This is not the best solution, but if they continually fail, there's not much we can do. 362 } 358 363 if (($stack->{final_state})&& 359 364 ($stack->{final_state} eq 'full')) { 360 365 $complete_fstacks++; 361 366 } 367 elsif (($stack->{final_state})&&($stack->{final_state} eq 'new')&& 368 ($stack->{final_fault} >= 4)&&($stack->{final_fault} != 32767)) { 369 printf STDERR "Faulted final stack: $stack->{final_stack_id} $stack->{final_fault}\n"; 370 $complete_fstacks++; # This is not the best solution, but if they continually fail, there's not much we can do. 371 } 372 362 373 } 363 374 if (($complete_qstacks > 0)&& … … 433 444 $exposure = remake_this_exposure($exposure); 434 445 } 435 if ($companion) { # Validate that there are no problems with the companion exposure 436 if ($companion->{cam_quality}) { # Maybe other things here? 437 $exposure->{private} = 1; 438 $exposure->{data_state} = 'drop'; 439 &update_this_exposure($exposure); 440 $needs_qstack = 1; 446 if ($exposure->{cam_quality}) { 447 $needs_qstack = 1; 448 $needs_something_private = 1; 449 if ($companion) { 450 $companion->{private} = 1; 451 $companion->{pairwise} = 0; 452 &update_this_exposure($companion); 441 453 } 442 } 443 if (($exposure->{warpRun_state})&& # This exposure has a warp 444 (($exposure->{warpRun_state} eq 'full')|| # This exposure's warp is either done or impossible. 445 ($exposure->{data_state} eq 'drop'))) { 454 $exposure->{private} = 1; 455 $exposure->{pairwise} = 0; 456 $exposure->{data_state} = 'drop'; 457 &update_this_exposure($exposure); 458 459 } 460 # if ($companion) { # Validate that there are no problems with the companion exposure 461 # if ($companion->{cam_quality}) { # Maybe other things here? 462 # $exposure->{private} = 1; 463 # $exposure->{data_state} = 'drop'; 464 # &update_this_exposure($exposure); 465 # $needs_qstack = 1; 466 # } 467 # } 468 if ((($exposure->{warpRun_state})&& # This exposure has a warp 469 ($exposure->{warpRun_state} eq 'full'))|| # This exposure's warp is either done or impossible. 470 ($exposure->{data_state} eq 'drop')) { 446 471 $can_qstack ++; 447 472 $can_diff ++; … … 535 560 my $data_group = "${label}.${date}"; 536 561 537 my $command = "$stacktool -pretend"; 562 my $command = "$stacktool "; 563 $command .= " -pretend " if defined $debug; 538 564 $command .= " -dbname $dbname " if defined $dbname; 539 565 $command .= " -definebyquery -select_label $label -select_skycell_id ${proj_cell}.% -select_filter $filter "; … … 567 593 my $sass_id = $stack->{sass_id}; 568 594 unless (defined($sass_id)) { 569 &my_die("Unable to parse metadata from laptool", $lap_id, ""); 570 } 595 &my_die("Unable to parse metadata from stacktool for sass_id", $lap_id, ""); 596 } 597 598 print "QUICK_SASS_ID: $sass_id\n"; 571 599 $command = "$laptool -updaterun -lap_id $lap_id -set_quick_sass_id $sass_id"; 572 600 $command .= " -dbname $dbname " if defined $dbname; … … 635 663 my $sass_id = $stack->{sass_id}; 636 664 unless (defined($sass_id)) { 637 &my_die("Unable to parse metadata from laptool", $lap_id, "");665 &my_die("Unable to parse metadata from stacktool for sass_id", $lap_id, ""); 638 666 } 639 667 print "FINAL_SASS_ID: $sass_id\n"; … … 667 695 next; 668 696 } 669 if ($exposure->{diff_id}&&S64_IS_NOT_NULL($exposure->{diff_id})) { # Not sure how this would happen, but still. 697 if ($exposure->{diff_id}&&S64_IS_NOT_NULL($exposure->{diff_id})) { # Not sure how this would happen, but still. ## This happens when we inherit a complete exposure. 670 698 next; 671 699 } … … 705 733 } 706 734 else { # warp-qstack 707 $command .= " -definewarpstack -set_reduction WARPQSTACK-available -good_frac 0.2 ";735 $command .= " -definewarpstack -set_reduction NOCONVDIFF -available -good_frac 0.2 "; 708 736 $command .= " -warp_id $exposure->{warp_id} -stack_label ${label}.quick "; 709 737 $already_queued{$exposure->{warp_id}} = 1; … … 716 744 &my_die("unable to perform difftool: $error_code", $exposure->{lap_id}, $exposure->{proj_cell}); 717 745 } 718 746 747 my $diffs = $mdcParser->parse_list(join "", @$stdout_buf) or 748 &my_die("Unable to parse metadata from laptool", $lap_id, ""); 749 750 my $diff = ${ $diffs }[0]; 751 my $diff_id = $diff->{diff_id}; 752 unless (defined($diff_id)) { 753 $exposure->{data_state} = 'drop'; 754 &update_this_exposure($exposure); 755 } 719 756 720 757 } … … 735 772 ################################################################################ 736 773 737 # sub cleanup_exposures { 738 # my $command = "$laptool -inactive "; 739 # $command .= " -dbname $dbname " if defined $dbname; 740 741 # my ($success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 742 # run(command => $command, verbose => $verbose); 743 # unless ($success) { 744 # $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 745 # &my_die("Unable to perform laptool: $error_code", "none", "none"); 746 # } 747 # if (@$stdout_buf == 0) { 748 # # Nothing to do. 749 # return(0); 750 # } 751 752 # my $exposures = $mdcParser->parse_list(join "", @$stdout_buf) or 753 # &my_die("Unable to parse metadata from laptool", $lap_id); 754 755 # foreach my $exposure (@$exposures) { 756 # foreach my $clean_mode (@clean_modes) { 757 # $command = $clean_mode->{COMMAND}; 758 # $clean_id = $clean_mode->{CLEAN_ID}; 759 # $clean_state = $clean_mode->{CLEAN_STATE}; 760 # if (($exposure->{$clean_id} != 0)&& 761 # (($exposure->{$clean_state} eq 'full')|| 762 # ($exposure->{$clean_state} eq 'drop'))) { 763 764 # $command =~ s/\@DBNAME\@/$dbname/g; 765 # $command =~ s/\@CHIP_ID\@/$exposure->{chip_id}/; 766 # $command =~ s/\@CHIP_STATE\@/$exposure->{chip_state}/; 767 # $command =~ s/\@CHIP_LABEL\@/$exposure->{chip_label}/; 768 769 # $command =~ s/\@WARP_ID\@/$exposure->{chip_id}/; 770 # $command =~ s/\@WARP_STATE\@/$exposure->{chip_state}/; 771 # $command =~ s/\@WARP_LABEL\@/$exposure->{chip_label}/; 772 773 # $command =~ s/\@DIFF_ID\@/$exposure->{diff_id}/; 774 # $command =~ s/\@DIFF_STATE\@/$exposure->{diff_state}/; 775 # $command =~ s/\@DIFF_LABEL\@/$exposure->{diff_label}/; 776 777 # $command =~ s/\@MAGICDS_ID\@/$exposure->{magicDS_id}/; 778 # $command =~ s/\@MAGICDS_STATE\@/$exposure->{magicDS_state}/; 779 # $command =~ s/\@MAGICDS_LABEL\@/$exposure->{magicDS_label}/; 780 781 # ($success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 782 # run(command => $command, verbose => $verbose); 783 # unless ($success) { 784 # $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 785 # &my_die("Unable to perform laptool: $error_code", "none", "none"); 786 # } 787 # } 788 # } 789 # $exposure->{data_state} = 'cleaned'; 790 # update_this_exposure($exposure); 791 # } 792 # } 774 sub cleanup_mode { 775 my $lap_id = shift; 776 my $command = "$laptool -inactiveexp -lap_id $lap_id "; 777 $command .= " -dbname $dbname " if defined $dbname; 778 779 my ($success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 780 run(command => $command, verbose => $verbose); 781 unless ($success) { 782 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 783 &my_die("Unable to perform laptool: $error_code", "none", "none"); 784 } 785 if (@$stdout_buf == 0) { 786 # Nothing to do. 787 return(0); 788 } 789 790 my $exposures = $mdcParser->parse_list(join "", @$stdout_buf) or 791 &my_die("Unable to parse metadata from laptool", $lap_id); 792 793 my @clean_modes = ( 794 'chiptool -dbname @DBNAME@ -updaterun -set_state goto_cleaned -state full -set_label goto_cleaned -label @LABEL@ -chip_id @CHIP_ID@', 795 'warptool -dbname @DBNAME@ -updaterun -set_state goto_cleaned -state full -set_label goto_cleaned -label @LABEL@ -warp_id @WARP_ID@', 796 'difftool -dbname @DBNAME@ -updaterun -set_state goto_cleaned -state full -set_label goto_cleaned -label @LABEL@ -diff_id @DIFF_ID@', 797 'magicdstool -dbname @DBNAME@ -updaterun -set_state goto_cleaned -state full -set_label goto_cleaned -stage chip -stage_id @CHIP_ID@', 798 'magicdstool -dbname @DBNAME@ -updaterun -set_state goto_cleaned -state full -set_label goto_cleaned -stage warp -stage_id @WARP_ID@', 799 'magicdstool -dbname @DBNAME@ -updaterun -set_state goto_cleaned -state full -set_label goto_cleaned -stage diff -stage_id @DIFF_ID@'); 800 foreach my $exposure (@$exposures) { 801 if ($exposure->{is_in_use}) { 802 next; 803 } 804 foreach my $clean_mode (@clean_modes) { 805 my $command = $clean_mode; 806 $command =~ s/\@DBNAME\@/$dbname/g; 807 $command =~ s/\@CHIP_ID\@/$exposure->{chip_id}/; 808 $command =~ s/\@WARP_ID\@/$exposure->{warp_id}/; 809 $command =~ s/\@DIFF_ID\@/$exposure->{diff_id}/; 810 $command =~ s/\@LABEL\@/$exposure->{label}/; 811 812 ($success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 813 run(command => $command, verbose => $verbose); 814 unless ($success) { 815 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 816 &my_die("Unable to perform laptool: $error_code", "none", "none"); 817 } 818 } 819 $exposure->{data_state} = 'cleaned'; 820 update_this_exposure($exposure); 821 } 822 } 793 823 794 824 -
branches/czw_branch/20110406/ippTools/share/laptool_inactiveexp.sql
r31409 r31429 1 1 SELECT DISTINCT 2 D.*,diffRun.state AS diff_state, CONVERT(sum(others.active),SIGNED) AS is_in_use FROM (2 D.*,diffRun.state AS diff_state,coalesce(CONVERT(sum(others.active),SIGNED),0) AS is_in_use FROM ( 3 3 SELECT DISTINCT 4 4 W.*,IFNULL(diff1.diff_id,diff2.diff_id) AS diff_id FROM ( … … 27 27 WHERE lapExp.active = FALSE 28 28 AND @WHERE@ 29 AND (warpSkyfile.quality IS NULL OR 30 (warpSkyfile.quality != 8007 -- known cases where quality != 0, but everything's fine. 31 AND warpSkyfile.quality != 3006 -- known cases where quality != 0, but everything's fine. 32 )) 29 33 GROUP BY lap_id,exp_id 30 34 ) AS W … … 34 38 ) AS D 35 39 LEFT JOIN diffRun USING(diff_id) 36 JOIN lapExp AS others ON (D.chip_id = others.chip_id AND D.lap_id != others.lap_id)40 LEFT JOIN lapExp AS others ON (D.chip_id = others.chip_id AND D.lap_id != others.lap_id) 37 41 GROUP BY lap_id,exp_id -
branches/czw_branch/20110406/ippTools/src/laptool.c
r31428 r31429 473 473 } 474 474 } 475 476 475 } 477 476 … … 690 689 PXOPT_LOOKUP_S64(set_chip_id, config->args, "-set_chip_id", false, false); 691 690 PXOPT_LOOKUP_S64(set_pair_id, config->args, "-set_pair_id", false, false); 691 PXOPT_LOOKUP_STR(set_data_state, config->args, "-set_data_state", false, false); 692 692 PXOPT_LOOKUP_BOOL(private, config->args, "-private", false); 693 693 PXOPT_LOOKUP_BOOL(public, config->args, "-public", false); … … 711 711 PXOPT_COPY_S64(config->args, where, "-exp_id", "exp_id", "=="); 712 712 PXOPT_COPY_S64(config->args, where, "-chip_id", "chip_id", "=="); 713 PXOPT_COPY_STR(config->args, where, "-set_data_state", "data_state", "=="); 713 714 714 715 715 psMetadata *values = psMetadataAlloc(); … … 738 738 psMetadataAddBool(values, PS_LIST_TAIL, "pairwise", 0, "==", false); 739 739 } 740 740 if (set_data_state) { 741 PXOPT_COPY_STR(config->args, values, "-set_data_state", "data_state", "=="); 742 } 741 743 long rows = psDBUpdateRows(config->dbh,"lapExp",where,values); 742 744 if (rows) { … … 755 757 { 756 758 PS_ASSERT_PTR_NON_NULL(config, false); 757 759 PXOPT_LOOKUP_S64(lap_id, config->args, "-lap_id", true, false); 760 758 761 psMetadata *where = psMetadataAlloc(); 759 762 PXOPT_COPY_S64(config->args, where, "-lap_id", "lap_id", "==");
Note:
See TracChangeset
for help on using the changeset viewer.
