Changeset 29671
- Timestamp:
- Nov 4, 2010, 1:42:23 PM (16 years ago)
- Location:
- trunk
- Files:
-
- 8 added
- 6 edited
-
ippScripts/scripts/ipp_cleanup.pl (modified) (5 diffs)
-
ippTasks/science.cleanup.pro (modified) (2 diffs)
-
ippTools/share/Makefile.am (modified) (2 diffs)
-
ippTools/share/bgtool_change_chiprun_state.sql (added)
-
ippTools/share/bgtool_change_imfile_data_state.sql (added)
-
ippTools/share/bgtool_change_skyfile_data_state.sql (added)
-
ippTools/share/bgtool_change_warprun_state.sql (added)
-
ippTools/share/bgtool_pendingcleanupchipimfile.sql (added)
-
ippTools/share/bgtool_pendingcleanupchiprun.sql (added)
-
ippTools/share/bgtool_pendingcleanupwarprun.sql (added)
-
ippTools/share/bgtool_pendingcleanupwarpskyfile.sql (added)
-
ippTools/src/bgtool.c (modified) (15 diffs)
-
ippTools/src/bgtool.h (modified) (2 diffs)
-
ippTools/src/bgtoolConfig.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippScripts/scripts/ipp_cleanup.pl
r29420 r29671 18 18 19 19 # Parse the command-line arguments 20 my ($stage, $camera, $stage_id, $mode, $path_base, $dbname, $verbose, $no_op, $helplist );20 my ($stage, $camera, $stage_id, $mode, $path_base, $dbname, $verbose, $no_op, $helplist, $logfile); 21 21 GetOptions('stage=s' => \$stage, # which analysis stage to clean? 22 22 'camera|i=s' => \$camera, # user-supplied camera name … … 27 27 'verbose' => \$verbose, # Print to stdout 28 28 'no-op' => \$no_op, # pretend but don't actually inject 29 'helplist' => \$helplist # give help listing 29 'helplist' => \$helplist, # give help listing 30 'logfile=s' => \$logfile # destination for stdout and stderr 30 31 ) or pod2usage( 2 ); 31 32 … … 53 54 } 54 55 56 $ipprc->redirect_output($logfile) or 57 &my_die("Unable to redirect ouput", $stage, $stage_id, $PS_EXIT_UNKNOWN_ERROR) if $logfile; 58 55 59 # set this to 1 to enable checking for files on dead nodes 56 60 # it is off for now because the implementation is a hack 57 61 # See comments below. 58 my $check_for_gone = 0;62 my $check_for_gone = 1; 59 63 60 64 my $error_state; … … 66 70 67 71 my %stages = ( "chip" => 1, "camera" => 1, "fake" => 1, "warp" => 1, "stack" => 1, "diff" => 1, 72 "chip_bg" => 1, "warp_bg" => 1, 68 73 "detrend.processed" => 1, "detrend.resid" => 1, "detrend.process.exp" => 0, "detrend.stack.imfile" => 0, 69 74 "detrend.normstat.imfile" => 0, "detrend.norm.imfile" => 0, "detrend.norm.exp" => 0 ); … … 1648 1653 } 1649 1654 1655 if ($stage eq "chip_bg") { 1656 1657 die "--stage_id required for stage chip_bg\n" if !$stage_id; 1658 1659 &my_die("only mode goto_cleaned is supported for stage chip_bg", "chip_bg", $stage_id, $PS_EXIT_PROG_ERROR) 1660 if $mode ne 'goto_cleaned'; 1661 1662 ### select the imfiles for this entry 1663 1664 # this stage uses 'bgtool' 1665 my $bgtool = can_run('bgtool') or die "Can't find bgtool"; 1666 1667 # Get list of component imfiles 1668 # XXX may need a different my_die for each stage 1669 my $imfiles; # Array of component files 1670 my $command = "$bgtool -pendingcleanupchipimfile -chip_bg_id $stage_id"; # Command to run 1671 $command .= " -dbname $dbname" if defined $dbname; 1672 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = run(command => $command, verbose => $verbose); 1673 unless ($success) { 1674 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 1675 &my_die("Unable to perform bgtool: $error_code", "chip_bg", $stage_id, $error_code); 1676 } 1677 1678 # XXX: Is not having any files to process really a bug? 1679 if (@$stdout_buf == 0) { 1680 my $command = "$bgtool -chip_bg_id $stage_id -updatechip -set_state $error_state"; 1681 $command .= " -dbname $dbname" if defined $dbname; 1682 1683 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 1684 run(command => $command, verbose => $verbose); 1685 unless ($success) { 1686 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 1687 &my_die("Unable to perform bgtool: $error_code", "chip_bg", $stage_id, $error_code); 1688 } 1689 exit 0; 1690 } 1691 1692 # extract the metadata for the files into a hash list 1693 $imfiles = $mdcParser->parse_list(join "", @$stdout_buf) or 1694 &my_die("Unable to parse metadata config doc", "chip_bg", $stage_id, $PS_EXIT_PROG_ERROR); 1695 1696 # loop over all of the imfiles, determine the path_base and class_id for each 1697 foreach my $imfile (@$imfiles) { 1698 my $class_id = $imfile->{class_id}; 1699 my $path_base = $imfile->{path_base}; 1700 my $status = 1; 1701 $status = 0 unless defined $path_base and $path_base ne "NULL"; 1702 1703 # don't clean up unless the data needed to update is available 1704 # modes goto_purged and goto_scrubbed will remove files even if the config is non-existent 1705 # goto_scrubbed now requires the config file to not exist. 1706 if ($status) { 1707 if ($mode eq "goto_cleaned") { 1708 my $config_file = $ipprc->filename("PPBACKGROUND.CONFIG", $path_base, $class_id); 1709 1710 unless ($ipprc->file_exists($config_file)) { 1711 if (file_gone($config_file)) { 1712 print STDERR "forcing cleanup for chipRun $stage_id $class_id " 1713 . " because config file ($config_file) is gone\n"; 1714 } else { 1715 print STDERR "skipping cleanup for chipRun $stage_id $class_id " 1716 . " because config file ($config_file) is missing\n"; 1717 $status = 0; 1718 } 1719 } 1720 } 1721 elsif ($mode eq "goto_scrubbed") { 1722 my $config_file = $ipprc->filename("PPBACKGROUND.CONFIG", $path_base, $class_id); 1723 1724 if ($ipprc->file_exists($config_file)) { 1725 print STDERR "skipping scrubbed for chipBackgroundRun $stage_id $class_id " 1726 . " because config file ($config_file) is present\n"; 1727 $status = 0; 1728 } 1729 } 1730 } 1731 1732 if ($status) { 1733 # array of actual filenames to delete 1734 my @files = (); 1735 1736 # delete the image datafiles 1737 addFilename (\@files, "PPBACKGROUND.OUTPUT", $path_base, $class_id); 1738 addFilename (\@files, "PPBACKGROUND.OUTPUT.MASK", $path_base, $class_id); 1739 if ($mode eq "goto_purged") { 1740 # additional files to remove for 'purge' mode 1741 addFilename (\@files, "PPBACKGROUND.STATS", $path_base, $class_id); #clean? 1742 addFilename (\@files, "PPBACKGOROUND.CONFIG", $path_base, $class_id); 1743 } 1744 1745 # actual command to delete the files 1746 $status = &delete_files (\@files); 1747 } 1748 1749 if ($status) { 1750 my $command = "$bgtool -chip_bg_id $stage_id -class_id $class_id"; 1751 if ($mode eq "goto_cleaned") { 1752 $command .= " -tocleanedchipimfile"; 1753 } 1754 elsif ($mode eq "goto_purged") { 1755 $command .= " -topurgedchipimfile"; 1756 } 1757 elsif ($mode eq "goto_scrubbed") { 1758 $command .= " -toscrubbedchipimfile"; 1759 } 1760 1761 $command .= " -dbname $dbname" if defined $dbname; 1762 1763 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 1764 run(command => $command, verbose => $verbose); 1765 unless ($success) { 1766 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 1767 &my_die("Unable to perform chiptool: $error_code", "chip", $stage_id, $error_code); 1768 } 1769 1770 } else { 1771 1772 # if an error happens for one chip, the chipBackgroundRun will stay in goto_*, but the chips will go to error_* (matching the goto_*) 1773 my $command = "$bgtool -updatechipimfile -chip_bg_id $stage_id -class_id $class_id -set_data_state $error_state"; 1774 $command .= " -dbname $dbname" if defined $dbname; 1775 1776 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 1777 run(command => $command, verbose => $verbose); 1778 unless ($success) { 1779 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 1780 &my_die("Unable to perform bgtool: $error_code", "chip_bg", $stage_id, $error_code); 1781 } 1782 1783 # We want to flag the run as well, to avoid attempting to reprocess the same data over and over again. 1784 $command = "$bgtool -chip_bg_id $stage_id -updatechip -set_state $error_state"; 1785 $command .= " -dbname $dbname" if defined $dbname; 1786 1787 ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 1788 run(command => $command, verbose => $verbose); 1789 unless ($success) { 1790 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 1791 &my_die("Unable to perform chiptool: $error_code", "chip", $stage_id, $error_code); 1792 } 1793 1794 } 1795 } 1796 exit 0; 1797 } 1798 if ($stage eq "warp_bg") { 1799 1800 die "--stage_id required for stage warp_bg\n" if !$stage_id; 1801 1802 &my_die("only mode goto_cleaned is supported for stage warp_bg", "warp_bg", $stage_id, $PS_EXIT_PROG_ERROR) 1803 if $mode ne 'goto_cleaned'; 1804 1805 ### select the imfiles for this entry 1806 1807 # this stage uses 'bgtool' 1808 my $bgtool = can_run('bgtool') or die "Can't find bgtool"; 1809 1810 # Get list of component imfiles 1811 # XXX may need a different my_die for each stage 1812 my $imfiles; # Array of component files 1813 my $command = "$bgtool -pendingcleanupwarpskyfile -warp_bg_id $stage_id"; # Command to run 1814 $command .= " -dbname $dbname" if defined $dbname; 1815 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = run(command => $command, verbose => $verbose); 1816 unless ($success) { 1817 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 1818 &my_die("Unable to perform bgtool: $error_code", "warp_bg", $stage_id, $error_code); 1819 } 1820 1821 # XXX: Is not having any files to process really a bug? 1822 if (@$stdout_buf == 0) { 1823 my $command = "$bgtool -warp_bg_id $stage_id -updatewarp -set_state $error_state"; 1824 $command .= " -dbname $dbname" if defined $dbname; 1825 1826 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 1827 run(command => $command, verbose => $verbose); 1828 unless ($success) { 1829 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 1830 &my_die("Unable to perform bgtool: $error_code", "warp_bg", $stage_id, $error_code); 1831 } 1832 exit 0; 1833 } 1834 1835 # extract the metadata for the files into a hash list 1836 $imfiles = $mdcParser->parse_list(join "", @$stdout_buf) or 1837 &my_die("Unable to parse metadata config doc", "warp_bg", $stage_id, $PS_EXIT_PROG_ERROR); 1838 1839 # loop over all of the imfiles, determine the path_base and skycell_id for each 1840 foreach my $imfile (@$imfiles) { 1841 my $skycell_id = $imfile->{skycell_id}; 1842 my $path_base = $imfile->{path_base}; 1843 my $status = 1; 1844 $status = 0 unless defined $path_base and $path_base ne "NULL"; 1845 1846 # don't clean up unless the data needed to update is available 1847 # modes goto_purged and goto_scrubbed will remove files even if the config is non-existent 1848 # goto_scrubbed now requires the config file to not exist. 1849 if ($status) { 1850 if ($mode eq "goto_cleaned") { 1851 my $config_file = $ipprc->filename("PSWARP.CONFIG", $path_base, $skycell_id); 1852 1853 unless ($ipprc->file_exists($config_file)) { 1854 if (file_gone($config_file)) { 1855 print STDERR "forcing cleanup for warpBackgroundSkyfile $stage_id $skycell_id " 1856 . " because config file ($config_file) is gone\n"; 1857 } else { 1858 print STDERR "skipping cleanup for warpBackgroundSkyfile $stage_id $skycell_id " 1859 . " because config file ($config_file) is missing\n"; 1860 $status = 0; 1861 } 1862 } 1863 } 1864 elsif ($mode eq "goto_scrubbed") { 1865 my $config_file = $ipprc->filename("PSWARP.CONFIG", $path_base, $skycell_id); 1866 1867 if ($ipprc->file_exists($config_file)) { 1868 print STDERR "skipping scrubbed for chipBackgroundRun $stage_id $skycell_id " 1869 . " because config file ($config_file) is present\n"; 1870 $status = 0; 1871 } 1872 } 1873 } 1874 1875 if ($status) { 1876 # array of actual filenames to delete 1877 my @files = (); 1878 1879 # delete the image datafiles 1880 addFilename (\@files, "PSWARP.OUTPUT", $path_base, $skycell_id); 1881 addFilename (\@files, "PSWARP.OUTPUT.MASK", $path_base, $skycell_id); 1882 if ($mode eq "goto_purged") { 1883 # additional files to remove for 'purge' mode 1884 addFilename (\@files, "PSWARP.STATS", $path_base, $skycell_id); #clean? 1885 addFilename (\@files, "PSWARP.CONFIG", $path_base, $skycell_id); 1886 } 1887 1888 # actual command to delete the files 1889 $status = &delete_files (\@files); 1890 } 1891 1892 if ($status) { 1893 my $command = "$bgtool -warp_bg_id $stage_id -skycell_id $skycell_id"; 1894 # recall that only goto_cleaned is supported (currently) 1895 if ($mode eq "goto_cleaned") { 1896 $command .= " -tocleanedwarpskyfile"; 1897 } 1898 elsif ($mode eq "goto_purged") { 1899 $command .= " -topurgedwarpskyfile"; 1900 } 1901 elsif ($mode eq "goto_scrubbed") { 1902 $command .= " -toscrubbedwarpskyfile"; 1903 } 1904 1905 $command .= " -dbname $dbname" if defined $dbname; 1906 1907 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 1908 run(command => $command, verbose => $verbose); 1909 unless ($success) { 1910 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 1911 &my_die("Unable to perform bgtool: $error_code", "warp", $stage_id, $error_code); 1912 } 1913 1914 } else { 1915 1916 # if an error happens for one skycell, the warpBackgroundRun will stay in goto_*, but the skycells will go to error_* (matching the goto_*) 1917 my $command = "$bgtool -updatewarpskyfile -warp_bg_id $stage_id -skycell_id $skycell_id -set_data_state $error_state"; 1918 $command .= " -dbname $dbname" if defined $dbname; 1919 1920 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 1921 run(command => $command, verbose => $verbose); 1922 unless ($success) { 1923 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 1924 &my_die("Unable to perform bgtool: $error_code", "warp_bg", $stage_id, $error_code); 1925 } 1926 1927 # We want to flag the run as well, to avoid attempting to reprocess the same data over and over again. 1928 $command = "$bgtool -warp_bg_id $stage_id -updatewarp -set_state $error_state"; 1929 $command .= " -dbname $dbname" if defined $dbname; 1930 1931 ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 1932 run(command => $command, verbose => $verbose); 1933 unless ($success) { 1934 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 1935 &my_die("Unable to perform bgtool: $error_code", "warp", $stage_id, $error_code); 1936 } 1937 } 1938 } 1939 exit 0; 1940 } 1650 1941 1651 1942 die "ipp_cleanup.pl -stage $stage not yet implemented\n"; -
trunk/ippTasks/science.cleanup.pro
r29431 r29671 8 8 diff.cleanup.on 9 9 stack.cleanup.on 10 chip.bg.cleanup.on 11 warp.bg.cleanup.on 10 12 end 11 13 … … 934 936 935 937 938 book init chipBGPendingCleanup 939 940 macro chip.bg.cleanup.status 941 book listbook chipBGPendingCleanup 942 end 943 944 macro chip.bg.cleanup.reset 945 book init chipBGPendingCleanup 946 end 947 948 macro chip.bg.cleanup.on 949 task chip.bg.cleanup.load 950 active true 951 end 952 task chip.bg.cleanup.run 953 active true 954 end 955 end 956 957 macro chip.bg.cleanup.off 958 task chip.bg.cleanup.load 959 active false 960 end 961 task chip.bg.cleanup.run 962 active false 963 end 964 end 965 966 # this variable will cycle through the known database names 967 $chip_bg_cleanup_DB = 0 968 969 task chip.bg.cleanup.load 970 host local 971 972 periods -poll $LOADPOLL 973 periods -exec $LOADEXEC 974 periods -timeout 30 975 npending 1 976 active false 977 978 stdout NULL 979 stderr $LOGDIR/chip.bg.cleanup.log 980 981 task.exec 982 if ($LABEL:n == 0) break 983 $run = bgtool -pendingcleanupchiprun 984 if ($DB:n == 0) 985 option DEFAULT 986 else 987 # save the DB name for the exit tasks 988 option $DB:$chip_bg_cleanup_DB 989 $run = $run -dbname $DB:$chip_bg_cleanup_DB 990 $chip_bg_cleanup_DB ++ 991 if ($chip_bg_cleanup_DB >= $DB:n) set chip_bg_cleanup_DB = 0 992 end 993 add_poll_args run 994 add_poll_labels run 995 command $run 996 end 997 998 # success 999 task.exit 0 1000 # convert 'stdout' to book format 1001 ipptool2book stdout chipBGPendingCleanup -key chip_bg_id -uniq -setword dbname $options:0 -setword pantaskState INIT 1002 if ($VERBOSE > 2) 1003 book listbook chipBGPendingCleanup 1004 end 1005 1006 # delete existing entries in the appropriate pantaskStates 1007 process_cleanup chipBGPendingCleanup 1008 end 1009 1010 # locked list 1011 task.exit default 1012 showcommand failure 1013 end 1014 1015 task.exit crash 1016 showcommand crash 1017 end 1018 1019 # operation times out? 1020 task.exit timeout 1021 showcommand timeout 1022 end 1023 end 1024 1025 # run the ipp_cleanup.pl script on pending images 1026 task chip.bg.cleanup.run 1027 periods -poll $RUNPOLL 1028 periods -exec $RUNEXEC 1029 periods -timeout 300 1030 active false 1031 1032 task.exec 1033 book npages chipBGPendingCleanup -var N 1034 if ($N == 0) 1035 periods -exec $RUNEXEC 1036 break 1037 end 1038 if ($NETWORK == 0) break 1039 1040 # look for new images in chipBGPendingCleanup (pantaskState == INIT) 1041 book getpage chipBGPendingCleanup 0 -var pageName -key pantaskState INIT 1042 if ("$pageName" == "NULL") break 1043 1044 book setword chipBGPendingCleanup $pageName pantaskState RUN 1045 book getword chipBGPendingCleanup $pageName camera -var CAMERA 1046 book getword chipBGPendingCleanup $pageName state -var CLEANUP_MODE 1047 book getword chipBGPendingCleanup $pageName chip_bg_id -var CHIP_BG_ID 1048 book getword chipBGPendingCleanup $pageName workdir -var WORKDIR_TEMPLATE 1049 book getword chipBGPendingCleanup $pageName exp_tag -var EXP_TAG 1050 book getword chipBGPendingCleanup $pageName dbname -var DBNAME 1051 1052 # specify choice of local or remote host based on camera and chip (class_id) 1053 set.host.for.camera $CAMERA FPA 1054 set.workdir.by.camera $CAMERA FPA $WORKDIR_TEMPLATE $default_host WORKDIR 1055 sprintf logfile "%s/%s/%s.bgc.%s.cleanup.log" $WORKDIR $EXP_TAG $EXP_TAG $CHIP_BG_ID 1056 1057 stdout $LOGDIR/chip.bg.cleanup.log 1058 stderr $LOGDIR/chip.bg.cleanup.log 1059 1060 # XXX is everything listed here needed? 1061 $run = ipp_cleanup.pl --stage chip_bg --stage_id $CHIP_BG_ID --camera $CAMERA --mode $CLEANUP_MODE --logfile $logfile 1062 add_standard_args run 1063 1064 # save the pageName for future reference below 1065 options $pageName 1066 1067 # create the command line 1068 if ($VERBOSE > 1) 1069 echo command $run 1070 end 1071 periods -exec 0.05 1072 command $run 1073 end 1074 1075 # default exit status 1076 task.exit default 1077 process_exit chipBGPendingCleanup $options:0 $JOB_STATUS 1078 end 1079 1080 task.exit crash 1081 showcommand crash 1082 book setword chipBGPendingCleanup $options:0 pantaskState CRASH 1083 end 1084 1085 # operation timed out? 1086 task.exit timeout 1087 showcommand timeout 1088 book setword chipBGPendingCleanup $options:0 pantaskState TIMEOUT 1089 end 1090 end 1091 1092 book init warpBGPendingCleanup 1093 1094 macro warp.bg.cleanup.status 1095 book listbook warpBGPendingCleanup 1096 end 1097 1098 macro warp.bg.cleanup.reset 1099 book init warpBGPendingCleanup 1100 end 1101 1102 macro warp.bg.cleanup.on 1103 task warp.bg.cleanup.load 1104 active true 1105 end 1106 task warp.bg.cleanup.run 1107 active true 1108 end 1109 end 1110 1111 macro warp.bg.cleanup.off 1112 task warp.bg.cleanup.load 1113 active false 1114 end 1115 task warp.bg.cleanup.run 1116 active false 1117 end 1118 end 1119 1120 # this variable will cycle through the known database names 1121 $warp_bg_cleanup_DB = 0 1122 1123 task warp.bg.cleanup.load 1124 host local 1125 1126 periods -poll $LOADPOLL 1127 periods -exec $LOADEXEC 1128 periods -timeout 300 1129 npending 1 1130 active false 1131 1132 stdout NULL 1133 stderr $LOGDIR/warp.bg.cleanup.log 1134 1135 task.exec 1136 if ($LABEL:n == 0) break 1137 $run = bgtool -pendingcleanupwarprun 1138 if ($DB:n == 0) 1139 option DEFAULT 1140 else 1141 # save the DB name for the exit tasks 1142 option $DB:$warp_bg_cleanup_DB 1143 $run = $run -dbname $DB:$warp_bg_cleanup_DB 1144 $warp_bg_cleanup_DB ++ 1145 if ($warp_bg_cleanup_DB >= $DB:n) set warp_bg_cleanup_DB = 0 1146 end 1147 add_poll_args run 1148 add_poll_labels run 1149 command $run 1150 end 1151 1152 # success 1153 task.exit 0 1154 # convert 'stdout' to book format 1155 ipptool2book stdout warpBGPendingCleanup -key warp_bg_id -uniq -setword dbname $options:0 -setword pantaskState INIT 1156 if ($VERBOSE > 2) 1157 book listbook warpBGPendingCleanup 1158 end 1159 1160 # delete existing entries in the appropriate pantaskStates 1161 process_cleanup warpBGPendingCleanup 1162 end 1163 1164 # locked list 1165 task.exit default 1166 showcommand failure 1167 end 1168 1169 task.exit crash 1170 showcommand crash 1171 end 1172 1173 # operation times out? 1174 task.exit timeout 1175 showcommand timeout 1176 end 1177 end 1178 1179 # run the ipp_cleanup.pl script on pending images 1180 task warp.bg.cleanup.run 1181 periods -poll $RUNPOLL 1182 periods -exec $RUNEXEC 1183 periods -timeout 300 1184 active false 1185 1186 task.exec 1187 book npages warpBGPendingCleanup -var N 1188 if ($N == 0) 1189 periods -exec $RUNEXEC 1190 break 1191 end 1192 if ($NETWORK == 0) break 1193 1194 # look for new images in warpBGPendingCleanup (pantaskState == INIT) 1195 book getpage warpBGPendingCleanup 0 -var pageName -key pantaskState INIT 1196 if ("$pageName" == "NULL") break 1197 1198 book setword warpBGPendingCleanup $pageName pantaskState RUN 1199 book getword warpBGPendingCleanup $pageName camera -var CAMERA 1200 book getword warpBGPendingCleanup $pageName state -var CLEANUP_MODE 1201 book getword warpBGPendingCleanup $pageName warp_bg_id -var WARP_BG_ID 1202 book getword warpBGPendingCleanup $pageName workdir -var WORKDIR_TEMPLATE 1203 book getword warpBGPendingCleanup $pageName exp_tag -var EXP_TAG 1204 book getword warpBGPendingCleanup $pageName dbname -var DBNAME 1205 1206 # specify choice of local or remote host based on camera and warp 1207 set.workdir.by.camera $CAMERA $WARP_BG_ID $WORKDIR_TEMPLATE $default_host WORKDIR 1208 sprintf logfile "%s/%s/%s.bgw.%s.cleanup.log" $WORKDIR $EXP_TAG $EXP_TAG $WARP_BG_ID 1209 1210 stdout $LOGDIR/warp.bg.cleanup.log 1211 stderr $LOGDIR/warp.bg.cleanup.log 1212 1213 # XXX is everything listed here needed? 1214 $run = ipp_cleanup.pl --stage warp_bg --stage_id $WARP_BG_ID --camera $CAMERA --mode $CLEANUP_MODE --logfile $logfile 1215 add_standard_args run 1216 1217 # save the pageName for future reference below 1218 options $pageName 1219 1220 # create the command line 1221 if ($VERBOSE > 1) 1222 echo command $run 1223 end 1224 periods -exec 0.05 1225 command $run 1226 end 1227 1228 # default exit status 1229 task.exit default 1230 process_exit warpBGPendingCleanup $options:0 $JOB_STATUS 1231 end 1232 1233 task.exit crash 1234 showcommand crash 1235 book setword warpBGPendingCleanup $options:0 pantaskState CRASH 1236 end 1237 1238 # operation timed out? 1239 task.exit timeout 1240 showcommand timeout 1241 book setword warpBGPendingCleanup $options:0 pantaskState TIMEOUT 1242 end 1243 end -
trunk/ippTools/share/Makefile.am
r29627 r29671 21 21 bgtool_advancechip.sql \ 22 22 bgtool_advancewarp.sql \ 23 bgtool_change_chiprun_state.sql \ 24 bgtool_change_imfile_data_state.sql \ 25 bgtool_change_warprun_state.sql \ 26 bgtool_change_skyfile_data_state.sql \ 23 27 bgtool_chipinputs.sql \ 24 28 bgtool_chip.sql \ … … 29 33 bgtool_listchip.sql \ 30 34 bgtool_listwarp.sql \ 35 bgtool_pendingcleanupchiprun.sql \ 36 bgtool_pendingcleanupchipimfile.sql \ 37 bgtool_pendingcleanupwarprun.sql \ 38 bgtool_pendingcleanupwarpskyfile.sql \ 31 39 bgtool_revertchip.sql \ 32 40 bgtool_revertwarp.sql \ -
trunk/ippTools/src/bgtool.c
r29493 r29671 49 49 static bool revertwarpMode(pxConfig *config); 50 50 static bool listwarpMode(pxConfig *config); 51 static bool tocleanchipMode(pxConfig *config); 52 static bool cleanedchipMode(pxConfig *config); 53 static bool tocleanwarpMode(pxConfig *config); 54 static bool cleanedwarpMode(pxConfig *config); 51 52 static bool pendingcleanupchiprunMode(pxConfig *config); 53 static bool pendingcleanupchipimfileMode(pxConfig *config); 54 static bool tocleanedchipimfileMode(pxConfig *config); 55 static bool updatechipimfileMode(pxConfig *config); 56 57 static bool pendingcleanupwarprunMode(pxConfig *config); 58 static bool pendingcleanupwarpskyfileMode(pxConfig *config); 59 static bool tocleanedwarpskyfileMode(pxConfig *config); 60 55 61 static bool exportchipMode(pxConfig *config); 56 62 static bool importchipMode(pxConfig *config); 57 63 static bool exportwarpMode(pxConfig *config); 58 64 static bool importwarpMode(pxConfig *config); 65 66 static bool validDataState(psString data_state); 59 67 60 68 // Tables to import/export … … 112 120 MODECASE(BGTOOL_MODE_REVERTWARP, revertwarpMode); 113 121 MODECASE(BGTOOL_MODE_LISTWARP, listwarpMode); 114 MODECASE(BGTOOL_MODE_TOCLEANCHIP, tocleanchipMode); 115 MODECASE(BGTOOL_MODE_CLEANEDCHIP, cleanedchipMode); 116 MODECASE(BGTOOL_MODE_TOCLEANWARP, tocleanwarpMode); 117 MODECASE(BGTOOL_MODE_CLEANEDWARP, cleanedwarpMode); 122 MODECASE(BGTOOL_MODE_PENDINGCLEANUPCHIPRUN, pendingcleanupchiprunMode); 123 MODECASE(BGTOOL_MODE_PENDINGCLEANUPCHIPIMFILE, pendingcleanupchipimfileMode); 124 MODECASE(BGTOOL_MODE_TOCLEANEDCHIPIMFILE, tocleanedchipimfileMode); 125 MODECASE(BGTOOL_MODE_UPDATECHIPIMFILE, updatechipimfileMode); 126 MODECASE(BGTOOL_MODE_PENDINGCLEANUPWARPRUN, pendingcleanupwarprunMode); 127 MODECASE(BGTOOL_MODE_PENDINGCLEANUPWARPSKYFILE, pendingcleanupwarpskyfileMode); 128 MODECASE(BGTOOL_MODE_TOCLEANEDWARPSKYFILE, tocleanedwarpskyfileMode); 118 129 MODECASE(BGTOOL_MODE_EXPORTCHIP, exportchipMode); 119 130 MODECASE(BGTOOL_MODE_IMPORTCHIP, importchipMode); … … 914 925 return true; 915 926 } 927 916 928 static bool listchipMode(pxConfig *config) 917 929 { … … 978 990 } 979 991 980 static bool tocleanchipMode(pxConfig *config)992 static bool pendingcleanupchiprunMode(pxConfig *config) 981 993 { 982 994 PS_ASSERT_PTR_NON_NULL(config, NULL); … … 987 999 psMetadata *where = psMetadataAlloc(); 988 1000 pxAddLabelSearchArgs(config, where, "-label", "chipBackgroundRun.label", "=="); 989 990 psString query = pxDataGet("bgtool_tocleanchip.sql"); 1001 pxAddLabelSearchArgs(config, where, "-data_group", "chipBackgroundRun.data_group", "=="); 1002 1003 psString query = pxDataGet("bgtool_pendingcleanupchiprun.sql"); 991 1004 if (!query) { 992 1005 psError(psErrorCodeLast(), false, "failed to retreive SQL statement"); … … 1035 1048 return true; 1036 1049 } 1037 1038 static bool cleanedchipMode(pxConfig *config) 1039 { 1040 PS_ASSERT_PTR_NON_NULL(config, false); 1041 1042 psMetadata *where = psMetadataAlloc(); 1050 static bool pendingcleanupchipimfileMode(pxConfig *config) 1051 { 1052 PS_ASSERT_PTR_NON_NULL(config, NULL); 1053 1054 PXOPT_LOOKUP_S64(chip_bg_id, config->args, "-chip_bg_id", true, false); 1055 PXOPT_LOOKUP_U64(limit, config->args, "-limit", false, false); 1056 PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false); 1057 1058 psMetadata *where = psMetadataAlloc(); 1059 1043 1060 PXOPT_COPY_S64(config->args, where, "-chip_bg_id", "chipBackgroundRun.chip_bg_id", "=="); 1044 1061 1045 PXOPT_LOOKUP_STR(state, config->args, "-state", true, false); 1046 if (!pxIsValidCleanedState(state)) { 1047 psError(PXTOOLS_ERR_CONFIG, true, "Invalid state: %s", state); 1048 return false; 1049 } 1050 1051 if (!psListLength(where->list)) { 1052 psError(PXTOOLS_ERR_CONFIG, true, "No search restrictions set."); 1053 return false; 1054 } 1055 1056 psString query = pxDataGet("bgtool_cleanedchip.sql"); 1062 psString query = pxDataGet("bgtool_pendingcleanupchipimfile.sql"); 1057 1063 if (!query) { 1058 1064 psError(psErrorCodeLast(), false, "failed to retreive SQL statement"); … … 1060 1066 } 1061 1067 1062 {1068 if (where && psListLength(where->list)) { 1063 1069 psString whereClause = psDBGenerateWhereConditionSQL(where, NULL); 1064 1070 psStringAppend(&query, " AND %s", whereClause); … … 1067 1073 psFree(where); 1068 1074 1069 if (!p_psDBRunQueryF(config->dbh, query, state)) { 1070 psError(psErrorCodeLast(), false, "database error"); 1075 if (limit) { 1076 psString limitString = psDBGenerateLimitSQL(limit); 1077 psStringAppend(&query, " %s", limitString); 1078 psFree(limitString); 1079 } 1080 1081 if (!p_psDBRunQuery(config->dbh, query)) { 1082 psError(psErrorCodeLast(), false, "database error"); 1083 psFree(query); 1084 return false; 1085 } 1086 psFree(query); 1087 1088 psArray *output = p_psDBFetchResult(config->dbh); 1089 if (!output) { 1090 psError(psErrorCodeLast(), false, "database error"); 1091 return false; 1092 } 1093 if (!psArrayLength(output)) { 1094 psTrace("bgtool", PS_LOG_INFO, "no rows found"); 1095 psFree(output); 1096 return true; 1097 } 1098 1099 // negative simple so the default is true 1100 if (!ippdbPrintMetadatas(stdout, output, "chipBackgroundImfile", !simple)) { 1101 psError(psErrorCodeLast(), false, "failed to print array"); 1102 psFree(output); 1103 return false; 1104 } 1105 psFree(output); 1106 1107 return true; 1108 } 1109 1110 static bool change_imfile_data_state(pxConfig *config, psString data_state) 1111 { 1112 PS_ASSERT_PTR_NON_NULL(config, false); 1113 1114 // chip_id, class_id are required 1115 PXOPT_LOOKUP_S64(chip_bg_id, config->args, "-chip_bg_id", true, false); 1116 PXOPT_LOOKUP_STR(class_id, config->args, "-class_id", true, false); 1117 1118 psString query = pxDataGet("bgtool_change_imfile_data_state.sql"); 1119 1120 if (!psDBTransaction(config->dbh)) { 1121 psError(PS_ERR_UNKNOWN, false, "database error"); 1122 return false; 1123 } 1124 1125 if (!p_psDBRunQueryF(config->dbh, query, data_state, chip_bg_id, class_id)) { 1126 psFree(query); 1127 psError(PS_ERR_UNKNOWN, false, "database error"); 1128 // rollback 1129 if (!psDBRollback(config->dbh)) { 1130 psError(PS_ERR_UNKNOWN, false, "database error"); 1131 } 1132 psError(PS_ERR_UNKNOWN, false, "database error"); 1133 return false; 1134 } 1135 psFree(query); 1136 if (psDBAffectedRows(config->dbh) < 1) { 1137 psError(PS_ERR_UNKNOWN, false, "should have affected atleast 1 row"); 1138 return false; 1139 } 1140 1141 query = pxDataGet("bgtool_change_chiprun_state.sql"); 1142 if (!p_psDBRunQueryF(config->dbh, query, data_state, chip_bg_id, data_state)) { 1143 psFree(query); 1144 // rollback 1145 if (!psDBRollback(config->dbh)) { 1146 psError(PS_ERR_UNKNOWN, false, "database error"); 1147 } 1148 psError(PS_ERR_UNKNOWN, false, "database error"); 1149 return false; 1150 } 1151 psFree(query); 1152 1153 if (!psDBCommit(config->dbh)) { 1154 psError(PS_ERR_UNKNOWN, false, "database error"); 1155 return false; 1156 } 1157 1158 return true; 1159 } 1160 1161 static bool tocleanedchipimfileMode(pxConfig *config) 1162 { 1163 return change_imfile_data_state(config, "cleaned"); 1164 } 1165 1166 static bool updatechipimfileMode(pxConfig *config) 1167 { 1168 PS_ASSERT_PTR_NON_NULL(config, false); 1169 1170 // required 1171 PXOPT_LOOKUP_S64(chip_bg_id, config->args, "-chip_bg_id", true, false); 1172 PXOPT_LOOKUP_STR(class_id, config->args, "-class_id", true, false); 1173 1174 psMetadata *where = psMetadataAlloc(); 1175 1176 PXOPT_COPY_S64(config->args, where, "-chip_bg_id", "chipBackgroundImfile.chip_bg_id", "=="); 1177 PXOPT_COPY_S64(config->args, where, "-class_id", "chipBackgroundImfile.class_id", "=="); 1178 1179 // optional 1180 1181 PXOPT_LOOKUP_STR(data_state, config->args, "-set_data_state", false, false); 1182 PXOPT_LOOKUP_S16(fault, config->args, "-set_fault", false, false); 1183 if (!data_state && !fault) { 1184 psError(PS_ERR_UNKNOWN, true, "must supply either -set_fault or -set_data_state"); 1185 return false; 1186 } 1187 char *sep = ""; 1188 psString query = psStringCopy("UPDATE chipBackgroundImfile SET "); 1189 if (data_state) { 1190 if (!validDataState(data_state)) { 1191 return false; 1192 } 1193 psStringAppend(&query, "%s data_state = '%s'", sep, data_state); 1194 sep = ", "; 1195 } 1196 if (fault) { 1197 psStringAppend(&query, "%s fault = %d", sep, fault); 1198 sep = ", "; 1199 } 1200 if (psListLength(where->list)) { 1201 psString whereClause = psDBGenerateWhereConditionSQL(where, NULL); 1202 psStringAppend(&query, " WHERE %s", whereClause); 1203 psFree(whereClause); 1204 } else { 1205 psFree(where); 1206 psError(PXTOOLS_ERR_CONFIG, false, "search parameters are required"); 1207 return false; 1208 } 1209 psFree(where); 1210 if (!p_psDBRunQuery(config->dbh, query)) { 1211 psError(psErrorCodeLast(), false, "database error"); 1212 psFree(query); 1071 1213 return false; 1072 1214 } … … 1449 1591 return true; 1450 1592 } 1451 if (!ippdbPrintMetadatas(stdout, output, " chipBackgroundSkyfile", !simple)) {1593 if (!ippdbPrintMetadatas(stdout, output, "warpBackgroundSkyfile", !simple)) { 1452 1594 psError(psErrorCodeLast(), false, "failed to print array"); 1453 1595 psFree(output); … … 1814 1956 } 1815 1957 1816 static bool tocleanwarpMode(pxConfig *config)1958 static bool pendingcleanupwarprunMode(pxConfig *config) 1817 1959 { 1818 1960 PS_ASSERT_PTR_NON_NULL(config, NULL); … … 1824 1966 pxAddLabelSearchArgs(config, where, "-label", "warpBackgroundRun.label", "=="); 1825 1967 1826 psString query = pxDataGet("bgtool_ tocleanwarp.sql");1968 psString query = pxDataGet("bgtool_pendingcleanupwarprun.sql"); 1827 1969 if (!query) { 1828 1970 psError(psErrorCodeLast(), false, "failed to retreive SQL statement"); … … 1871 2013 return true; 1872 2014 } 1873 1874 static bool cleanedwarpMode(pxConfig *config) 1875 { 1876 PS_ASSERT_PTR_NON_NULL(config, false); 1877 1878 psMetadata *where = psMetadataAlloc(); 2015 static bool pendingcleanupwarpskyfileMode(pxConfig *config) 2016 { 2017 PS_ASSERT_PTR_NON_NULL(config, NULL); 2018 2019 PXOPT_LOOKUP_S64(warp_bg_id, config->args, "-warp_bg_id", true, false); 2020 PXOPT_LOOKUP_U64(limit, config->args, "-limit", false, false); 2021 PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false); 2022 2023 psMetadata *where = psMetadataAlloc(); 2024 1879 2025 PXOPT_COPY_S64(config->args, where, "-warp_bg_id", "warpBackgroundRun.warp_bg_id", "=="); 1880 2026 1881 PXOPT_LOOKUP_STR(state, config->args, "-state", true, false); 1882 if (!pxIsValidCleanedState(state)) { 1883 psError(PXTOOLS_ERR_CONFIG, true, "Invalid state: %s", state); 1884 return false; 1885 } 1886 1887 if (!psListLength(where->list)) { 1888 psError(PXTOOLS_ERR_CONFIG, true, "No search restrictions set."); 1889 return false; 1890 } 1891 1892 psString query = pxDataGet("bgtool_cleanedwarp.sql"); 2027 psString query = pxDataGet("bgtool_pendingcleanupwarpskyfile.sql"); 1893 2028 if (!query) { 1894 2029 psError(psErrorCodeLast(), false, "failed to retreive SQL statement"); … … 1896 2031 } 1897 2032 1898 {2033 if (where && psListLength(where->list)) { 1899 2034 psString whereClause = psDBGenerateWhereConditionSQL(where, NULL); 1900 2035 psStringAppend(&query, " AND %s", whereClause); … … 1903 2038 psFree(where); 1904 2039 1905 if (!p_psDBRunQueryF(config->dbh, query, state)) { 1906 psError(psErrorCodeLast(), false, "database error"); 1907 return false; 1908 } 1909 psFree(query); 1910 1911 return true; 2040 if (limit) { 2041 psString limitString = psDBGenerateLimitSQL(limit); 2042 psStringAppend(&query, " %s", limitString); 2043 psFree(limitString); 2044 } 2045 2046 if (!p_psDBRunQuery(config->dbh, query)) { 2047 psError(psErrorCodeLast(), false, "database error"); 2048 psFree(query); 2049 return false; 2050 } 2051 psFree(query); 2052 2053 psArray *output = p_psDBFetchResult(config->dbh); 2054 if (!output) { 2055 psError(psErrorCodeLast(), false, "database error"); 2056 return false; 2057 } 2058 if (!psArrayLength(output)) { 2059 psTrace("bgtool", PS_LOG_INFO, "no rows found"); 2060 psFree(output); 2061 return true; 2062 } 2063 2064 // negative simple so the default is true 2065 if (!ippdbPrintMetadatas(stdout, output, "warpBackgroundSkyfile", !simple)) { 2066 psError(psErrorCodeLast(), false, "failed to print array"); 2067 psFree(output); 2068 return false; 2069 } 2070 psFree(output); 2071 2072 return true; 2073 } 2074 2075 static bool change_skyfile_data_state(pxConfig *config, psString data_state) 2076 { 2077 PS_ASSERT_PTR_NON_NULL(config, false); 2078 2079 // warp_id, skycell_id are required 2080 PXOPT_LOOKUP_S64(warp_bg_id, config->args, "-warp_bg_id", true, false); 2081 PXOPT_LOOKUP_STR(skycell_id, config->args, "-skycell_id", true, false); 2082 2083 psString query = pxDataGet("bgtool_change_skyfile_data_state.sql"); 2084 2085 if (!psDBTransaction(config->dbh)) { 2086 psError(PS_ERR_UNKNOWN, false, "database error"); 2087 return false; 2088 } 2089 2090 if (!p_psDBRunQueryF(config->dbh, query, data_state, warp_bg_id, skycell_id)) { 2091 psFree(query); 2092 psError(PS_ERR_UNKNOWN, false, "database error"); 2093 // rollback 2094 if (!psDBRollback(config->dbh)) { 2095 psError(PS_ERR_UNKNOWN, false, "database error"); 2096 } 2097 psError(PS_ERR_UNKNOWN, false, "database error"); 2098 return false; 2099 } 2100 psFree(query); 2101 if (psDBAffectedRows(config->dbh) < 1) { 2102 psError(PS_ERR_UNKNOWN, false, "should have affected atleast 1 row"); 2103 return false; 2104 } 2105 2106 query = pxDataGet("bgtool_change_warprun_state.sql"); 2107 if (!p_psDBRunQueryF(config->dbh, query, data_state, warp_bg_id, data_state)) { 2108 psFree(query); 2109 // rollback 2110 if (!psDBRollback(config->dbh)) { 2111 psError(PS_ERR_UNKNOWN, false, "database error"); 2112 } 2113 psError(PS_ERR_UNKNOWN, false, "database error"); 2114 return false; 2115 } 2116 psFree(query); 2117 2118 if (!psDBCommit(config->dbh)) { 2119 psError(PS_ERR_UNKNOWN, false, "database error"); 2120 return false; 2121 } 2122 2123 return true; 2124 } 2125 2126 static bool tocleanedwarpskyfileMode(pxConfig *config) 2127 { 2128 return change_skyfile_data_state(config, "cleaned"); 1912 2129 } 1913 2130 … … 1935 2152 return importTables(config, infile, warpTables); 1936 2153 } 2154 2155 static bool validDataState(psString data_state) 2156 { 2157 // NOTE: can't use pxIsValidState because 2158 // update, scrubbed and purged are not supported for the backround stages (yet?) 2159 if (!strcmp(data_state, "new") || 2160 !strcmp(data_state, "full") || 2161 !strcmp(data_state, "drop") || 2162 !strcmp(data_state, "cleaned") || 2163 !strcmp(data_state, "goto_cleaned") || 2164 !strcmp(data_state, "error_cleaned")) { 2165 return true; 2166 } else { 2167 psError(PS_ERR_UNKNOWN, true, "%s is not a valid value data_state", data_state); 2168 return false; 2169 } 2170 } -
trunk/ippTools/src/bgtool.h
r28941 r29671 35 35 BGTOOL_MODE_REVERTCHIP, 36 36 BGTOOL_MODE_LISTCHIP, 37 BGTOOL_MODE_UPDATECHIPIMFILE, 37 38 // Warp stage 38 39 BGTOOL_MODE_DEFINEWARP, … … 45 46 BGTOOL_MODE_REVERTWARP, 46 47 BGTOOL_MODE_LISTWARP, 48 BGTOOL_MODE_UPDATEWARPSKYFILE, 47 49 // Cleanups 48 BGTOOL_MODE_TOCLEANCHIP, 49 BGTOOL_MODE_CLEANEDCHIP, 50 BGTOOL_MODE_TOCLEANWARP, 51 BGTOOL_MODE_CLEANEDWARP, 50 BGTOOL_MODE_PENDINGCLEANUPCHIPRUN, 51 BGTOOL_MODE_PENDINGCLEANUPCHIPIMFILE, 52 BGTOOL_MODE_TOCLEANEDCHIPIMFILE, 53 BGTOOL_MODE_PENDINGCLEANUPWARPRUN, 54 BGTOOL_MODE_PENDINGCLEANUPWARPSKYFILE, 55 BGTOOL_MODE_TOCLEANEDWARPSKYFILE, 52 56 // Exporting 53 57 BGTOOL_MODE_EXPORTCHIP, -
trunk/ippTools/src/bgtoolConfig.c
r28941 r29671 192 192 psMetadataAddU64(listchipArgs, PS_LIST_TAIL, "-limit", 0, "limit result set to N items", 0); 193 193 194 // -tocleanchip 195 psMetadata *tocleanchipArgs = psMetadataAlloc(); 196 psMetadataAddStr(tocleanchipArgs, PS_LIST_TAIL, "-label", PS_META_DUPLICATE_OK, "list blocks for specified label", NULL); 197 psMetadataAddBool(tocleanchipArgs, PS_LIST_TAIL, "-simple", 0, "use the simple output format", false); 198 psMetadataAddU64(tocleanchipArgs, PS_LIST_TAIL, "-limit", 0, "limit result set to N items", 0); 199 200 // -cleanedchip 201 psMetadata *cleanedchipArgs = psMetadataAlloc(); 202 psMetadataAddS64(cleanedchipArgs, PS_LIST_TAIL, "-chip_bg_id", 0, "search by chip_bg_id", 0); 203 psMetadataAddStr(cleanedchipArgs, PS_LIST_TAIL, "-state", 0, "cleaned state to set", NULL); 194 // -pendingcleanupchiprun 195 psMetadata *pendingcleanupchiprunArgs = psMetadataAlloc(); 196 psMetadataAddStr(pendingcleanupchiprunArgs, PS_LIST_TAIL, "-label", PS_META_DUPLICATE_OK, "list runs for specified label", NULL); 197 psMetadataAddStr(pendingcleanupchiprunArgs, PS_LIST_TAIL, "-data_group", PS_META_DUPLICATE_OK, "list runs for specified data_group", NULL); 198 psMetadataAddBool(pendingcleanupchiprunArgs, PS_LIST_TAIL, "-simple", 0, "use the simple output format", false); 199 psMetadataAddU64(pendingcleanupchiprunArgs, PS_LIST_TAIL, "-limit", 0, "limit result set to N items", 0); 200 201 // -pendingcleanupchipimfile 202 psMetadata *pendingcleanupchipimfileArgs = psMetadataAlloc(); 203 psMetadataAddS64(pendingcleanupchipimfileArgs, PS_LIST_TAIL, "-chip_bg_id", 0, "search by chip_bg_id (required)", 0); 204 psMetadataAddBool(pendingcleanupchipimfileArgs, PS_LIST_TAIL, "-simple", 0, "use the simple output format", false); 205 psMetadataAddU64(pendingcleanupchipimfileArgs, PS_LIST_TAIL, "-limit", 0, "limit result set to N items", 0); 206 207 // -tocleanedchipimfile 208 psMetadata *tocleanedchipimfileArgs = psMetadataAlloc(); 209 psMetadataAddS64(tocleanedchipimfileArgs, PS_LIST_TAIL, "-chip_bg_id", 0, "search by chip ID (required)", 0); 210 psMetadataAddStr(tocleanedchipimfileArgs, PS_LIST_TAIL, "-class_id", 0, "search by class_id", NULL); 211 psMetadataAddBool(tocleanedchipimfileArgs, PS_LIST_TAIL, "-simple", 0, "use the simple output format", false); 212 psMetadataAddU64(tocleanedchipimfileArgs, PS_LIST_TAIL, "-limit", 0, "limit result set to N items", 0); 213 214 // -updatechipimfile 215 psMetadata *updatechipimfileArgs = psMetadataAlloc(); 216 psMetadataAddS64(updatechipimfileArgs, PS_LIST_TAIL, "-chip_bg_id", 0, "search by chip ID (required)", 0); 217 psMetadataAddStr(updatechipimfileArgs, PS_LIST_TAIL, "-class_id", 0, "search by class_id (required)", NULL); 218 psMetadataAddStr(updatechipimfileArgs, PS_LIST_TAIL, "-set_data_state", 0, "new value for data_state", NULL); 219 psMetadataAddS16(updatechipimfileArgs, PS_LIST_TAIL, "-set_fault", 0, "set fault code", 0); 204 220 205 221 // -exportchip … … 361 377 psMetadataAddU64(listwarpArgs, PS_LIST_TAIL, "-limit", 0, "limit result set to N items", 0); 362 378 363 // -tocleanwarp 364 psMetadata *tocleanwarpArgs = psMetadataAlloc(); 365 psMetadataAddStr(tocleanwarpArgs, PS_LIST_TAIL, "-label", PS_META_DUPLICATE_OK, "list blocks for specified label", NULL); 366 psMetadataAddBool(tocleanwarpArgs, PS_LIST_TAIL, "-simple", 0, "use the simple output format", false); 367 psMetadataAddU64(tocleanwarpArgs, PS_LIST_TAIL, "-limit", 0, "limit result set to N items", 0); 368 369 // -cleanedwarp 370 psMetadata *cleanedwarpArgs = psMetadataAlloc(); 371 psMetadataAddS64(cleanedwarpArgs, PS_LIST_TAIL, "-warp_bg_id", 0, "search by warp_bg_id", 0); 372 psMetadataAddStr(cleanedwarpArgs, PS_LIST_TAIL, "-state", 0, "cleaned state to set", NULL); 379 // -pendingcleanupwarprun 380 psMetadata *pendingcleanupwarprunArgs = psMetadataAlloc(); 381 psMetadataAddStr(pendingcleanupwarprunArgs, PS_LIST_TAIL, "-label", PS_META_DUPLICATE_OK, "list blocks for specified label", NULL); 382 psMetadataAddStr(pendingcleanupwarprunArgs, PS_LIST_TAIL, "-data_group", PS_META_DUPLICATE_OK, "list blocks for specified data_group", NULL); 383 psMetadataAddBool(pendingcleanupwarprunArgs, PS_LIST_TAIL, "-simple", 0, "use the simple output format", false); 384 psMetadataAddU64(pendingcleanupwarprunArgs, PS_LIST_TAIL, "-limit", 0, "limit result set to N items", 0); 385 386 // -pendingcleanupwarpskyfile 387 psMetadata *pendingcleanupwarpskyfileArgs = psMetadataAlloc(); 388 psMetadataAddS64(pendingcleanupwarpskyfileArgs, PS_LIST_TAIL, "-warp_bg_id", 0, "search by warp_bg_id (required)", 0); 389 psMetadataAddBool(pendingcleanupwarpskyfileArgs, PS_LIST_TAIL, "-simple", 0, "use the simple output format", false); 390 psMetadataAddU64(pendingcleanupwarpskyfileArgs, PS_LIST_TAIL, "-limit", 0, "limit result set to N items", 0); 391 392 // -tocleanwarpskyfile 393 psMetadata *tocleanedwarpskyfileArgs = psMetadataAlloc(); 394 psMetadataAddS64(tocleanedwarpskyfileArgs, PS_LIST_TAIL, "-warp_bg_id", 0, "search by warp_bg_id (required)", 0); 395 psMetadataAddStr(tocleanedwarpskyfileArgs, PS_LIST_TAIL, "-skycell_id", 0, "search by skycell_id (required)", 0); 396 psMetadataAddStr(tocleanedwarpskyfileArgs, PS_LIST_TAIL, "-state", 0, "cleaned state to set", NULL); 397 398 // -updatewarpskyfile 399 psMetadata *updatewarpskyfileArgs = psMetadataAlloc(); 400 psMetadataAddS64(updatewarpskyfileArgs, PS_LIST_TAIL, "-warp_bg_id", 0, "search by chip ID (required)", 0); 401 psMetadataAddStr(updatewarpskyfileArgs, PS_LIST_TAIL, "-skycell_id", 0, "search by skycell_id (required)", NULL); 402 psMetadataAddStr(updatewarpskyfileArgs, PS_LIST_TAIL, "-set_state", 0, "new value for data_state", NULL); 403 psMetadataAddS16(updatewarpskyfileArgs, PS_LIST_TAIL, "-fault", 0, "set fault code", 0); 373 404 374 405 // -exportwarp … … 397 428 PXOPT_ADD_MODE("-revertchip", "", BGTOOL_MODE_REVERTCHIP, revertchipArgs); 398 429 PXOPT_ADD_MODE("-listchip", "", BGTOOL_MODE_LISTCHIP, listchipArgs); 399 PXOPT_ADD_MODE("-tocleanchip", "", BGTOOL_MODE_TOCLEANCHIP, tocleanchipArgs); 400 PXOPT_ADD_MODE("-cleanedchip", "", BGTOOL_MODE_CLEANEDCHIP, cleanedchipArgs); 430 PXOPT_ADD_MODE("-pendingcleanupchiprun", "", BGTOOL_MODE_PENDINGCLEANUPCHIPRUN, pendingcleanupchiprunArgs); 431 PXOPT_ADD_MODE("-pendingcleanupchipimfile", "", BGTOOL_MODE_PENDINGCLEANUPCHIPIMFILE, pendingcleanupchipimfileArgs); 432 PXOPT_ADD_MODE("-tocleanedchipimfile", "", BGTOOL_MODE_TOCLEANEDCHIPIMFILE, tocleanedchipimfileArgs); 433 PXOPT_ADD_MODE("-updatechipimfile", "", BGTOOL_MODE_UPDATECHIPIMFILE, updatechipimfileArgs); 401 434 PXOPT_ADD_MODE("-exportchip", "", BGTOOL_MODE_EXPORTCHIP, exportchipArgs); 402 435 PXOPT_ADD_MODE("-importchip", "", BGTOOL_MODE_IMPORTCHIP, importchipArgs); … … 411 444 PXOPT_ADD_MODE("-revertwarp", "", BGTOOL_MODE_REVERTWARP, revertwarpArgs); 412 445 PXOPT_ADD_MODE("-listwarp", "", BGTOOL_MODE_LISTWARP, listwarpArgs); 413 PXOPT_ADD_MODE("-tocleanwarp", "", BGTOOL_MODE_TOCLEANWARP, tocleanwarpArgs); 414 PXOPT_ADD_MODE("-cleanedwarp", "", BGTOOL_MODE_CLEANEDWARP, cleanedwarpArgs); 446 PXOPT_ADD_MODE("-pendingcleanupwarprun", "", BGTOOL_MODE_PENDINGCLEANUPWARPRUN, pendingcleanupwarprunArgs); 447 PXOPT_ADD_MODE("-pendingcleanupwarpskyfile", "", BGTOOL_MODE_PENDINGCLEANUPWARPSKYFILE, pendingcleanupwarpskyfileArgs); 448 PXOPT_ADD_MODE("-tocleanedwarpskyfile", "", BGTOOL_MODE_TOCLEANEDWARPSKYFILE, tocleanedwarpskyfileArgs); 449 PXOPT_ADD_MODE("-updatewarpskyfile", "", BGTOOL_MODE_UPDATEWARPSKYFILE, updatewarpskyfileArgs); 415 450 PXOPT_ADD_MODE("-exportwarp", "", BGTOOL_MODE_EXPORTWARP, exportwarpArgs); 416 451 PXOPT_ADD_MODE("-importwarp", "", BGTOOL_MODE_IMPORTWARP, importwarpArgs);
Note:
See TracChangeset
for help on using the changeset viewer.
