Changeset 36122
- Timestamp:
- Sep 17, 2013, 11:22:17 AM (13 years ago)
- Location:
- tags/ipp-20130712
- Files:
-
- 36 edited
- 23 copied
-
Ohana/src/getstar/src/dvoImagesAtCoords.c (modified) (4 diffs, 1 prop)
-
PS-IPP-PStamp (modified) (1 prop)
-
PS-IPP-PStamp/lib/PS/IPP/PStamp/Job.pm (modified) (5 diffs)
-
PS-IPP-PStamp/lib/PS/IPP/PStamp/RequestFile.pm (modified) (6 diffs)
-
ippTools (modified) (1 prop)
-
ippTools/share/Makefile.am (modified) (5 diffs)
-
ippTools/share/camtool_pendingexp.sql (modified) (1 prop)
-
ippTools/share/disttool_definebyquery_sky.sql (modified) (1 diff)
-
ippTools/share/disttool_definebyquery_skycal.sql (copied) (copied from trunk/ippTools/share/disttool_definebyquery_skycal.sql )
-
ippTools/share/disttool_pending_skycal.sql (copied) (copied from trunk/ippTools/share/disttool_pending_skycal.sql )
-
ippTools/share/disttool_toadvance.sql (modified) (1 diff)
-
ippTools/share/releasetool_listrelexp.sql (modified) (1 prop)
-
ippTools/share/releasetool_stacksummary.sql (copied) (copied from trunk/ippTools/share/releasetool_stacksummary.sql )
-
ippTools/share/releasetool_summary.sql (copied) (copied from trunk/ippTools/share/releasetool_summary.sql )
-
ippTools/share/stacktool_summary.sql (copied) (copied from trunk/ippTools/share/stacktool_summary.sql )
-
ippTools/share/stacktool_tosummary.sql (modified) (1 prop)
-
ippTools/share/staticskytool_export_skycalresult.sql (copied) (copied from trunk/ippTools/share/staticskytool_export_skycalresult.sql )
-
ippTools/share/staticskytool_export_skycalrun.sql (copied) (copied from trunk/ippTools/share/staticskytool_export_skycalrun.sql )
-
ippTools/share/staticskytool_skycalresult.sql (modified) (1 diff)
-
ippTools/share/warptool_warped.sql (modified) (1 prop)
-
ippTools/src (modified) (1 prop)
-
ippTools/src/difftool.c (modified) (1 prop)
-
ippTools/src/disttool.c (modified) (1 diff)
-
ippTools/src/pstamptool.c (modified) (1 diff)
-
ippTools/src/releasetool.c (modified) (3 diffs, 1 prop)
-
ippTools/src/releasetool.h (modified) (1 diff)
-
ippTools/src/releasetoolConfig.c (modified) (2 diffs, 1 prop)
-
ippTools/src/stacktool.c (modified) (4 diffs, 1 prop)
-
ippTools/src/stacktool.h (modified) (1 diff)
-
ippTools/src/stacktoolConfig.c (modified) (3 diffs)
-
ippTools/src/staticskytool.c (modified) (4 diffs)
-
ippTools/src/staticskytool.h (modified) (1 diff)
-
ippTools/src/staticskytoolConfig.c (modified) (2 diffs)
-
pstamp (modified) (1 prop)
-
pstamp/scripts (modified) (1 prop)
-
pstamp/scripts/psgetcalibinfo (modified) (1 prop)
-
pstamp/scripts/pstamp_get_image_job.pl (modified) (3 diffs)
-
pstamp/scripts/pstamp_job_run.pl (modified) (5 diffs)
-
pstamp/scripts/pstampparse.pl (modified) (15 diffs)
-
pstamp/src/Makefile.am (modified) (1 diff)
-
pstamp/src/ppstampMakeStamp.c (modified) (3 diffs)
-
pstamp/src/pstamp.h (modified) (4 diffs)
-
pstamp/test/gpc1/chip.100lines.txt (copied) (copied from trunk/pstamp/test/gpc1/chip.100lines.txt )
-
pstamp/test/gpc1/diff.difftype.txt (copied) (copied from trunk/pstamp/test/gpc1/diff.difftype.txt )
-
pstamp/test/gpc1/fwhm_cuts.txt (copied) (copied from trunk/pstamp/test/gpc1/fwhm_cuts.txt )
-
pstamp/test/gpc1/stack.calib.txt (copied) (copied from trunk/pstamp/test/gpc1/stack.calib.txt )
-
pstamp/test/gpc1/stack.invalid.mjd.txt (copied) (copied from trunk/pstamp/test/gpc1/stack.invalid.mjd.txt )
-
pstamp/test/gpc1/stack.md08.preview.txt (copied) (copied from trunk/pstamp/test/gpc1/stack.md08.preview.txt )
-
pstamp/test/gpc1/stack.sources.type.txt (copied) (copied from trunk/pstamp/test/gpc1/stack.sources.type.txt )
-
pstamp/test/gpc1/stacksummary.bycoord.all.txt (copied) (copied from trunk/pstamp/test/gpc1/stacksummary.bycoord.all.txt )
-
pstamp/test/gpc1/stacksummary.bycoord.m31.txt (copied) (copied from trunk/pstamp/test/gpc1/stacksummary.bycoord.m31.txt )
-
pstamp/test/gpc1/stacksummary.bycoord.txt (copied) (copied from trunk/pstamp/test/gpc1/stacksummary.bycoord.txt ) (1 diff)
-
pstamp/test/gpc1/stacksummary.byid.txt (copied) (copied from trunk/pstamp/test/gpc1/stacksummary.byid.txt )
-
pstamp/test/gpc1/stacksummary.byskycell.txt (copied) (copied from trunk/pstamp/test/gpc1/stacksummary.byskycell.txt )
-
pstamp/test/gpc1/stacksummary.getimage.txt (copied) (copied from trunk/pstamp/test/gpc1/stacksummary.getimage.txt )
-
pstamp/test/gpc1/warp.byid.calib.txt (copied) (copied from trunk/pstamp/test/gpc1/warp.byid.calib.txt )
-
pstamp/test/gpc1/warp.invalidmjd.txt (copied) (copied from trunk/pstamp/test/gpc1/warp.invalidmjd.txt )
-
pstamp/test/gpc1/warp.md08.56414.txt (copied) (copied from trunk/pstamp/test/gpc1/warp.md08.56414.txt )
-
pstamp/test/maketestreq (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
tags/ipp-20130712/Ohana/src/getstar/src/dvoImagesAtCoords.c
- Property svn:mergeinfo set to
r33658 r36122 9 9 static int makePoint(double ra, double dec, Point **pointsOut); 10 10 static int ListImagesAtCoords (Image *dbImages, Point *points, int Npoints); 11 static int readPointFromFile(FILE *f, Point *pt); 11 12 12 13 int main (int argc, char **argv) { … … 15 16 int status; 16 17 Image *dbImages; 17 int Npoints;18 18 FITS_DB db; 19 19 … … 23 23 24 24 Point *points; 25 int readStdin = 0; 26 int Npoints = 0; 25 27 if (coordsFile) { 26 Npoints = readPoints(coordsFile, &points); 28 if (strcmp(coordsFile, "-") == 0) { 29 readStdin = 1; 30 } else { 31 Npoints = readPoints(coordsFile, &points); 32 } 27 33 } else { 28 34 Npoints = makePoint(cmd_line_ra, cmd_line_dec, &points); 29 35 } 30 if (!Npoints ) {36 if (!Npoints && !readStdin) { 31 37 exit(1); 32 38 } … … 61 67 } 62 68 63 if (MatchCoords (dbImages, NdbImages, points, Npoints)) { 64 ListImagesAtCoords(dbImages, points, Npoints); 65 exit(0); 69 if (readStdin) { 70 Point pt; 71 memset(&pt, 0, sizeof(pt)); 72 pt.Nmatches = 0; 73 ALLOCATE(pt.matches, Match, 20); 74 pt.arrayLength = 20; 75 76 int status; 77 while ((status = readPointFromFile(stdin, &pt))) { 78 if (status < 0) { 79 fprintf(stdout, "ERROR malformed input line\n"); 80 exit(1); 81 } 82 if (MatchCoords (dbImages, NdbImages, &pt, 1)) { 83 ListImagesAtCoords(dbImages, &pt, 1); 84 } 85 fprintf(stdout, "DONE\n"); 86 fflush(stdout); 87 pt.Nmatches = 0; 88 } 66 89 } else { 67 exit(PSTAMP_NO_OVERLAP); 68 } 90 if (MatchCoords (dbImages, NdbImages, points, Npoints)) { 91 ListImagesAtCoords(dbImages, points, Npoints); 92 } else { 93 exit(PSTAMP_NO_OVERLAP); 94 } 95 } 96 exit(0); 97 } 98 99 static int readPointFromFile(FILE *f, Point *pt) { 100 char buf[80]; 101 char *good = fgets(buf, 80, f); 102 if (!good) { 103 return 0; 104 } 105 // fprintf(stderr, "READ: %s\n", buf); 106 int Nread = sscanf(buf, "%d %lf %lf\n", &pt->id, &pt->ra, &pt->dec); 107 if (Nread == 3) { 108 // got one 109 return 1; 110 } else if (Nread == -1) { 111 // all done time to go 112 return 0; 113 } else { 114 // fprintf(stderr, "malformed input line: %d\n", Nread); 115 return -1; 116 } 69 117 } 70 118 -
tags/ipp-20130712/PS-IPP-PStamp
- Property svn:mergeinfo changed
/trunk/PS-IPP-PStamp merged: 35996,36010,36018,36042,36057-36058,36102-36103
- Property svn:mergeinfo changed
-
tags/ipp-20130712/PS-IPP-PStamp/lib/PS/IPP/PStamp/Job.pm
r35909 r36122 34 34 use POSIX; 35 35 use Time::HiRes qw(gettimeofday); 36 use IO::Handle; 36 37 37 38 my $dvo_verbose = 0; … … 244 245 if (isnull($filter)) { 245 246 $filter = undef; 247 } 248 249 if ($stage eq 'stack_summary') { 250 # stack_summary jobs are so different from others that we lookup in a specialized function 251 return lookup_stack_summary($ipprc, $row, $imagedb, $tess_id, $component, $filter, $data_group, $option_mask, $mjd_min, $mjd_max, $verbose); 246 252 } 247 253 … … 736 742 } 737 743 744 sub lookup_stack_summary { 745 my ($ipprc, $row, $imagedb, $tess_id, $component, $filter, $data_group, $option_mask, $mjd_min, $mjd_max, $verbose) = @_; 746 747 $row->{error_code} = $PSTAMP_NO_IMAGE_MATCH; 748 749 $component = '' if $component eq 'all'; 750 751 my $req_type = $row->{REQ_TYPE}; 752 my $results; 753 if ($req_type eq 'byid') { 754 my $sass_id = $row->{ID}; 755 my $command = "$stacktool -dbname $imagedb -summary -sass_id $sass_id"; 756 $results = runToolAndParse($command, $verbose); 757 } else { 758 my ($release_name, $survey, $default_tess_id) = get_release_info($row); 759 if (!$tess_id and $default_tess_id) { 760 $tess_id = $default_tess_id; 761 } 762 763 my $skycells; 764 if ($req_type eq 'bycoord') { 765 my $ra = $row->{CENTER_X}; 766 my $dec = $row->{CENTER_Y}; 767 $skycells = lookup_skycell_by_coords($ipprc, $tess_id, $component, $ra, $dec, $verbose); 768 } elsif ($req_type eq 'byskycell') { 769 if (!defined $tess_id or !defined $component) { 770 print STDERR "Error: TESS_ID and COMPONENT are required for REQ_TYPE byskycell\n"; 771 $row->{error_code} = $PSTAMP_INVALID_REQUEST; 772 } 773 my $skycell = { 774 tess_id => $tess_id, 775 component => $component 776 }; 777 push @$skycells, $skycell 778 } else { 779 print STDERR "Error: $req_type is not a valid REQ_TYPE for IMG_TYPE stack_summary\n"; 780 $row->{error_code} = $PSTAMP_INVALID_REQUEST; 781 return undef; 782 } 783 784 if ($skycells) { 785 # We have a list of skycells. Find matching projection cells. 786 # and then matching rows in stackSummary 787 788 my %projection_cells_found; 789 foreach my $skycell (@$skycells) { 790 my $tess_id = $skycell->{tess_id}; 791 my $skycell_id = $skycell->{component}; 792 793 my $projection_cell = skycell_id_to_projection_cell($skycell_id); 794 795 # only need to include a projection cell once 796 next if $projection_cells_found{$projection_cell}; 797 798 $projection_cells_found{$projection_cell} = 1; 799 800 # print "$tess_id $skycell_id $projection_cell\n"; 801 802 my $command; 803 if ($release_name or $survey) { 804 $command = "$releasetool -dbname $imagedb"; 805 if ($release_name) { 806 $command .= " -release_name $release_name"; 807 } else { 808 $command .= " -priority_order"; 809 } 810 $command .= " -surveyName $survey"; 811 } else { 812 $command = "$stacktool -dbname $imagedb"; 813 } 814 $command .= " -summary -tess_id $tess_id"; 815 $command .= " -projection_cell $projection_cell"; 816 817 $command .= " -filter $filter" if $filter; 818 $command .= " -data_group $data_group" if $data_group; 819 820 my $these_results = runToolAndParse($command, $verbose); 821 push @$results, @$these_results if $these_results; 822 } 823 } 824 } 825 826 if ($results) { 827 foreach my $summary (@$results) { 828 my $path_base = $summary->{path_base}; 829 my $projection_cell = $summary->{projection_cell}; 830 831 # we need to flesh out the hashes returned with values that the parser expects 832 $summary->{stage} = 'stack_summary'; 833 $summary->{component} = $projection_cell; 834 $summary->{stage_id} = $summary->{sass_id}; 835 $summary->{path_base} = "$path_base.$projection_cell"; 836 837 # The stack_summary stage doesn't follow the usual ipp conventions for file rules 838 # and path_base. We leave it up to the program that runs the job to handle this. 839 # However, the parser uses the image parameter to set the job's outputBase (by removing the .fits) 840 # so we need to set it. Just use the new path_base. 841 $summary->{image} = $summary->{path_base}; 842 $summary->{state} = 'full'; 843 $summary->{data_state} = 'full'; 844 $summary->{fault} = 0; 845 $summary->{imagedb} = $imagedb; 846 $summary->{row_index} = []; 847 push @{$summary->{row_index}}, 0; 848 849 # XXX: Are there any other required parameters? 850 # TODO: create a function to validate the components returned 851 # and make sure that any required elements are there. 852 } 853 } 854 855 return $results; 856 } 857 738 858 sub lookup_diff { 739 859 my $ipprc = shift; … … 1169 1289 1170 1290 my @lines; 1171 { 1291 my $looked_up_fast; 1292 if ($requested_tess_id) { 1293 # try using the last method first 1294 $looked_up_fast = lookup_skycells_fast($ipprc, \@lines, $requested_tess_id, $ra, $dec, $verbose); 1295 } 1296 1297 if (!$looked_up_fast) { 1172 1298 my $command = "$whichimage $ra $dec"; 1173 1299 $command .= " --tess_id $requested_tess_id" if $requested_tess_id; … … 1878 2004 return $diff_mode; 1879 2005 } 2006 2007 sub setErrorCodesForRows { 2008 my $rowList = shift; 2009 my $error_code = shift; 2010 2011 foreach my $row (@$rowList) { 2012 $row->{error_code} = $error_code; 2013 } 2014 2015 } 2016 2017 # Convert from skycell_id to projection_cell 2018 # This code is not particularly elegant but I think that it matches the SQL used 2019 # to create stackAssocations does. 2020 2021 sub skycell_id_to_projection_cell { 2022 my $skycell_id = shift; 2023 2024 # split skycell_id into '.' separated components 2025 my @strs = split '\.', $skycell_id; 2026 2027 my $num = scalar @strs; 2028 2029 # projection_cell is 'skycell_id' plus all .num values except the last one 2030 my $projection_cell = $strs[0]; 2031 for (my $i=1; $i < $num - 1; $i++) { 2032 $projection_cell .= ".$strs[$i]"; 2033 } 2034 2035 return $projection_cell; 2036 } 2037 2038 # lookup_skycells_fast() 2039 # Lookup using a "skycell server" process which is implemented by running dvoImagesAtCoords in "server" mode. 2040 # Repeated calls to this function will reuse an existing process. This avoids having to loading the 2041 # tessellation over and over again for each skycell lookup. 2042 # When this parse process exists, the pipes are closed which causes the skycell server to exit. 2043 2044 my $scs_tess_id; # tess_id for existing scs (skycell server) (if any) 2045 my $scs_out; # reference filehandle for sending data to the scs 2046 my $scs_in; # filehandle for response from scs 2047 2048 sub lookup_skycells_fast { 2049 my ($ipprc, $results, $tess_id, $ra, $dec, $verbose) = @_; 2050 2051 # see if we need to start the scs (skycell server) 2052 2053 my $very_verbose = 0; 2054 2055 if (!$scs_tess_id or ($scs_tess_id ne $tess_id)) { 2056 if ($scs_tess_id) { 2057 # tess_id has changed, close down existing scs 2058 close $scs_out; 2059 $scs_out = undef; 2060 close $scs_in; 2061 $scs_in = undef; 2062 $scs_tess_id = undef; 2063 } 2064 2065 # convert tess_id to a directory name 2066 my $tess_dir = $ipprc->tessellation_catdir( $tess_id ); 2067 unless ($tess_dir) { 2068 print STDERR "Unrecognized tess_id: $tess_id\n"; 2069 return 0; 2070 } 2071 2072 # convert tess_dir to an absolute directory name 2073 my $tess_dir_resolved = $ipprc->convert_filename_absolute( $tess_dir ); 2074 unless ($tess_dir_resolved and -d $tess_dir_resolved) { 2075 print STDERR "failed to resolve tessellation directory for $tess_id\n"; 2076 return 0; 2077 } 2078 2079 # start an scs 2080 print "Starting skycell server for $tess_dir_resolved.\n"; 2081 2082 # create pipes for communicating with the server 2083 pipe $scs_in, SERVER_WRITER; 2084 pipe SERVER_READER, $scs_out; 2085 2086 # set our output to be unbuffered 2087 $scs_out->autoflush(1); 2088 2089 # FORK 2090 my $scs_pid = fork(); 2091 2092 if (!$scs_pid) { 2093 unless (defined $scs_pid) { 2094 # This is still in parent process. No joy. 2095 print STDERR "fork of skycell server failed: $!"; 2096 return 0; 2097 } 2098 2099 # This code is running in the child process - the skycell server 2100 # Close file handles for the parent's ends of the pipes 2101 close $scs_in; 2102 close $scs_out; 2103 # close stdio filehandles. we are about to redirect them 2104 # (STDERR stays open pointing to the parser log) 2105 close STDIN; 2106 close STDOUT; 2107 2108 # redirect our stdio file handles to the proper end of the pipes 2109 open (STDIN, "<&SERVER_READER") or die "\nSCS: failed to redirect stdin"; 2110 open (STDOUT, ">>&SERVER_WRITER") or die "\nSCS: failed to redirect stdout"; 2111 2112 # All set. Now exec dvoImagesAtCoords 2113 2114 my $command = "$dvoImagesAtCoords -D CATDIR $tess_dir_resolved -coords -"; 2115 2116 print STDERR "SCS: execing $command\n" if $very_verbose; 2117 2118 unless(exec $command) { 2119 # note parent will notice that we are gone due to the pipes getting broken 2120 # when this child dies. 2121 die "SCS: failed to exec $command"; 2122 } 2123 } 2124 2125 # This code is running in the parent process (the parser). 2126 # We have succesfully launched the scs process. 2127 # Close file handles for the scs' end of the pipes. 2128 close SERVER_WRITER; 2129 close SERVER_READER; 2130 2131 # remember the tess_id 2132 $scs_tess_id = $tess_id; 2133 } 2134 2135 # send coordinates to the skycell server and wait for the results 2136 # (which come nearly instantly which is the point of doing this) 2137 2138 # If pipes to the skycell server die, don't abort. 2139 # Our reads and writes detect errors and act sensibly. 2140 local $SIG{PIPE} = 'IGNORE'; 2141 2142 # write the coordinates to the pipe 2143 my $write_ok = print $scs_out "1 $ra $dec\n"; 2144 if (!$write_ok) { 2145 # server process probably didn't start properly or died. Fail. 2146 # Caller will attempt to use the conventional method. 2147 print STDERR "write to skycell server failed. Error is $!\n"; 2148 return 0; 2149 } 2150 2151 print STDERR " sent coordinates to skycell server\n" if $very_verbose; 2152 2153 my $received_done = 0; 2154 2155 # Wait for response. If pipe breaks the read returns with no data. 2156 while (my $line = <$scs_in>) { 2157 chomp $line; 2158 if ($line eq 'DONE') { 2159 # No more results for these coordinates. 2160 $received_done = 1; 2161 print STDERR " received DONE\n" if $very_verbose; 2162 last; 2163 } 2164 print STDERR " received $line\n" if $very_verbose; 2165 2166 # The caller expects the output to be in the format used by whichimage 2167 # which omits the point number and includes the tess_id. 2168 my ($ptnum, $raout, $decout, $skycell_id) = split " ", $line; 2169 2170 my $out = "$raout $decout $tess_id $skycell_id"; 2171 2172 # print the result to the log 2173 print "$out\n" if $verbose; 2174 2175 push @$results, $out; 2176 } 2177 2178 print STDERR "Out of wait for responses loop\n" if $very_verbose; 2179 2180 if (!$received_done) { 2181 # something has gone wrong. 2182 print STDERR "Read loop exited without receiving DONE.\n"; 2183 2184 die "BAILING out" if $very_verbose; 2185 2186 # forget about the existing server instance 2187 $scs_tess_id = undef; 2188 close $scs_out; 2189 close $scs_in; 2190 2191 # drop any results received so far 2192 @$results = (); 2193 return 0; 2194 } 2195 2196 return 1; 2197 } 2198 1880 2199 1881 2200 -
tags/ipp-20130712/PS-IPP-PStamp/lib/PS/IPP/PStamp/RequestFile.pm
r35466 r36122 29 29 $PSTAMP_SELECT_BACKMDL 30 30 $PSTAMP_SELECT_JPEG 31 $PSTAMP_SELECT_EXP 32 $PSTAMP_SELECT_NUM 31 33 $PSTAMP_SELECT_UNCOMPRESSED 32 34 $PSTAMP_SELECT_INVERSE … … 35 37 $PSTAMP_USE_IMFILE_ID 36 38 $PSTAMP_NO_WAIT_FOR_UPDATE 37 $PSTAMP_ REQUEST_UNCENSORED38 $PSTAMP_ REQUIRE_UNCENSORED39 $PSTAMP_SELECT_EXPJPEG 40 $PSTAMP_SELECT_NUMJPEG 39 41 $PSTAMP_SUCCESS 40 42 $PSTAMP_FIRST_ERROR_CODE … … 71 73 our $PSTAMP_SELECT_BACKMDL = 32; 72 74 our $PSTAMP_SELECT_JPEG = 64; 73 # unused 128 74 # unused 256 75 our $PSTAMP_SELECT_EXP = 128; 76 our $PSTAMP_SELECT_NUM = 256; 75 77 our $PSTAMP_SELECT_UNCOMPRESSED = 512; 76 78 our $PSTAMP_SELECT_INVERSE = 1024; … … 82 84 our $PSTAMP_NO_WAIT_FOR_UPDATE = 32768; 83 85 84 # these bits will be repurposed 85 our $PSTAMP_REQUEST_UNCENSORED = 0x10000; 86 our $PSTAMP_REQUIRE_UNCENSORED = 0x20000; 86 our $PSTAMP_SELECT_EXPJPEG = 0x10000; 87 our $PSTAMP_SELECT_NUMJPEG = 0x20000; 88 89 # these bits have been repurposed. They were only exposed to MOPS and IFA and they have adapted. 90 #our $PSTAMP_REQUEST_UNCENSORED = 0x10000; 91 #our $PSTAMP_REQUIRE_UNCENSORED = 0x20000; 87 92 88 93 # job and result codes … … 97 102 our $PSTAMP_INVALID_REQUEST = 21; 98 103 our $PSTAMP_UNKNOWN_PROJECT = 22; 99 our $PSTAMP_UNKNOWN_PRODUCT = 22; #this error code was mis-named it is left for compatabiliyt104 our $PSTAMP_UNKNOWN_PRODUCT = 22; #this error code was a typo it is left for compatabiliy 100 105 our $PSTAMP_NO_IMAGE_MATCH = 23; 101 106 our $PSTAMP_NOT_DESTREAKED = 24; 102 107 our $PSTAMP_NOT_AVAILABLE = 25; 103 our $PSTAMP_GONE = 26; # this value is used in ippTools108 our $PSTAMP_GONE = 26; # this value is also used in ippTools 104 109 our $PSTAMP_NO_JOBS_QUEUED = 27; 105 110 our $PSTAMP_NO_OVERLAP = 28; 106 111 our $PSTAMP_NOT_AUTHORIZED = 29; 112 our $PSTAMP_NO_VALID_PIXELS = 30; 107 113 108 114 … … 143 149 PSTAMP_NO_OVERLAP 144 150 PSTAMP_NOT_AUTHORIZED 145 PSTAMP_NO T_AUTHORIZED151 PSTAMP_NO_VALID_PIXELS 146 152 ); 147 153 -
tags/ipp-20130712/ippTools
- Property svn:mergeinfo set to
-
tags/ipp-20130712/ippTools/share/Makefile.am
r35799 r36122 193 193 disttool_definebyquery_sky.sql \ 194 194 disttool_definebyquery_sky_singlefilter.sql \ 195 disttool_definebyquery_skycal.sql \ 195 196 disttool_definebyquery_stack.sql \ 196 197 disttool_definebyquery_warp.sql \ … … 207 208 disttool_pending_raw.sql \ 208 209 disttool_pending_sky.sql \ 210 disttool_pending_skycal.sql \ 209 211 disttool_pending_stack.sql \ 210 212 disttool_pending_warp.sql \ … … 398 400 stacktool_tosummary.sql \ 399 401 stacktool_addsummary.sql \ 402 stacktool_summary.sql \ 400 403 staticskytool_definebyquery_select.sql \ 401 404 staticskytool_definebyquery_select_by_dg.sql \ … … 408 411 staticskytool_export_input.sql \ 409 412 staticskytool_export_result.sql \ 413 staticskytool_export_skycalrun.sql \ 414 staticskytool_export_skycalresult.sql \ 410 415 staticskytool_inputs.sql \ 411 416 staticskytool_todo.sql \ … … 476 481 releasetool_definerelstack_with_skycal.sql \ 477 482 releasetool_listrelstack.sql \ 483 releasetool_summary.sql \ 478 484 releasetool_definerelgroup_select_lap.sql \ 479 485 releasetool_definerelgroup_select_data_group.sql \ 480 486 releasetool_definerelgroup_select_exp_data_group.sql \ 481 487 releasetool_definerelgroup_select_exp_lap.sql \ 488 releasetool_stacksummary.sql \ 482 489 releasetool_pendingrelgroup.sql 483 490 -
tags/ipp-20130712/ippTools/share/camtool_pendingexp.sql
- Property svn:mergeinfo changed (with no actual effect on merging)
-
tags/ipp-20130712/ippTools/share/disttool_definebyquery_sky.sql
r32696 r36122 3 3 staticskyRun.sky_id AS stage_id, 4 4 CAST(0 AS SIGNED) AS magicked, 5 -- run tag in the form 'sky.$skycell_id.$s tack_id'5 -- run tag in the form 'sky.$skycell_id.$sky_id' 6 6 CONCAT_WS('.', 'sky', stackRun.skycell_id, convert(staticskyRun.sky_id, CHAR)) as run_tag, 7 7 staticskyRun.label, -
tags/ipp-20130712/ippTools/share/disttool_toadvance.sql
r32710 r36122 262 262 AND distComponent.fault = 0 263 263 UNION 264 -- skycal stage 265 -- NOTE this assumes that there is only one component per skycalRun 266 -- (one skycell) 267 SELECT 268 distRun.dist_id, 269 stage, 270 stage_id, 271 outroot, 272 label, 273 clean 274 FROM distRun 275 JOIN skycalResult on stage_id = skycal_id 276 LEFT JOIN distComponent 277 ON distRun.dist_id = distComponent.dist_id 278 WHERE 279 distRun.state = 'new' 280 AND distRun.fault = 0 281 AND distRun.stage = 'skycal' 282 AND distComponent.component IS NOT NULL 283 AND distComponent.fault = 0 284 UNION 264 285 -- SSdiff stage 265 286 SELECT -
tags/ipp-20130712/ippTools/share/releasetool_listrelexp.sql
- Property svn:mergeinfo changed (with no actual effect on merging)
-
tags/ipp-20130712/ippTools/share/stacktool_tosummary.sql
- Property svn:mergeinfo changed (with no actual effect on merging)
-
tags/ipp-20130712/ippTools/share/staticskytool_skycalresult.sql
r34975 r36122 2 2 skycalResult.*, 3 3 skycalRun.stack_id, 4 skycalRun.workdir, 4 5 stackRun.filter, 5 6 skycalRun.state, 6 7 skycalRun.label, 7 8 skycalRun.data_group, 9 skycalRun.dist_group, 8 10 skycalRun.sky_id, 9 11 skycell.* -
tags/ipp-20130712/ippTools/share/warptool_warped.sql
- Property svn:mergeinfo changed (with no actual effect on merging)
-
tags/ipp-20130712/ippTools/src
- Property svn:mergeinfo changed
/trunk/ippTools/src (added) merged: 35856,35888,35896-35897,35955,35960,36009,36019,36041,36046
- Property svn:mergeinfo changed
-
tags/ipp-20130712/ippTools/src/difftool.c
- Property svn:mergeinfo deleted
-
tags/ipp-20130712/ippTools/src/disttool.c
r35193 r36122 375 375 } 376 376 if (dist_group) { 377 psStringAppend(&query, " AND (st icskyRun.dist_group = '%s')", dist_group);377 psStringAppend(&query, " AND (staticskyRun.dist_group = '%s')", dist_group); 378 378 } 379 379 // (static)sky stage doesn't require magic 380 magic = false; 381 } else if (!strcmp(stage, "skycal")) { 382 query = pxDataGet("disttool_definebyquery_skycal.sql"); 383 if (!query) { 384 psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement"); 385 psFree(where); 386 return false; 387 } 388 389 if (label) { 390 psStringAppend(&query, " AND (skycalRun.label = '%s')", label); 391 } 392 if (dist_group) { 393 psStringAppend(&query, " AND (skycalRun.dist_group = '%s')", dist_group); 394 } 395 // skycal stage doesn't require magic 380 396 magic = false; 381 397 } else if (!strcmp(stage, "SSdiff")) { -
tags/ipp-20130712/ippTools/src/pstamptool.c
r35673 r36122 1428 1428 psFree(where); 1429 1429 1430 psStringAppend(&query, " ORDER BY priority DESC, req_id, dep_id");1430 psStringAppend(&query, " GROUP BY dep_id ORDER BY priority DESC, MIN(req_id), dep_id"); 1431 1431 1432 1432 // treat limit == 0 as "no limit" -
tags/ipp-20130712/ippTools/src/releasetool.c
- Property svn:mergeinfo deleted
r35909 r36122 47 47 static bool updaterelstackMode(pxConfig *config); 48 48 static bool listrelstackMode(pxConfig *config); 49 static bool summaryMode(pxConfig *config); 49 50 static bool definerelgroupMode(pxConfig *config); 50 51 static bool pendingrelgroupMode(pxConfig *config); … … 84 85 MODECASE(RELEASETOOL_MODE_UPDATERELSTACK, updaterelstackMode); 85 86 MODECASE(RELEASETOOL_MODE_LISTRELSTACK, listrelstackMode); 87 MODECASE(RELEASETOOL_MODE_SUMMARY, summaryMode); 86 88 87 89 MODECASE(RELEASETOOL_MODE_DEFINERELGROUP, definerelgroupMode); … … 1080 1082 1081 1083 if (priority_order) { 1082 psStringAppend(&query, "\nAND priority > 0 order by stack_id, priority DESC"); 1084 psStringAppend(&query, "\nAND priority > 0 order by priority DESC, stack_id"); 1085 } 1086 1087 if (limit) { 1088 psString limitString = psDBGenerateLimitSQL(limit); 1089 psStringAppend(&query, " %s", limitString); 1090 psFree(limitString); 1091 } 1092 1093 if (!p_psDBRunQuery(config->dbh, query)) { 1094 psError(PS_ERR_UNKNOWN, false, "database error"); 1095 psFree(query); 1096 return false; 1097 } 1098 psFree(query); 1099 1100 psArray *output = p_psDBFetchResult(config->dbh); 1101 if (!output) { 1102 psError(PS_ERR_UNKNOWN, false, "database error"); 1103 return false; 1104 } 1105 1106 if (!psArrayLength(output)) { 1107 psTrace("releasetool", PS_LOG_INFO, "no rows found"); 1108 psFree(output); 1109 return true; 1110 } 1111 1112 if (!ippdbPrintMetadatas(stdout, output, "relStack", !simple)) { 1113 psError(PS_ERR_UNKNOWN, false, "failed to print array"); 1114 psFree(output); 1115 return false; 1116 } 1117 1118 psFree(output); 1119 1120 return true; 1121 } 1122 static bool summaryMode(pxConfig *config) 1123 { 1124 PS_ASSERT_PTR_NON_NULL(config, NULL); 1125 1126 psMetadata *where = psMetadataAlloc(); 1127 1128 PXOPT_COPY_S64(config->args, where, "-sass_id", "stackAssociation.sass_id", "=="); 1129 PXOPT_COPY_S64(config->args, where, "-relstack_id", "relStack.relstack_id", "=="); 1130 PXOPT_COPY_S64(config->args, where, "-stack_id", "relStack.stack_id", "=="); 1131 // PXOPT_COPY_S64(config->args, where, "-skycal_id", "relStack.skycal_id", "=="); 1132 PXOPT_COPY_S64(config->args, where, "-relstack_id", "relStack.relstack_id", "=="); 1133 PXOPT_COPY_STR(config->args, where, "-release_name", "ippRelease.release_name", "LIKE"); 1134 pxAddLabelSearchArgs(config, where, "-release_state","ippRelease.state", "=="); 1135 // PXOPT_COPY_STR(config->args, where, "-state", "relStack.state", "=="); 1136 PXOPT_COPY_STR(config->args, where, "-filter", "relStack.filter", "LIKE"); 1137 // PXOPT_COPY_F32(config->args, where, "-mjd_min", "stackSumSkyfile.mjd_obs", ">="); 1138 // PXOPT_COPY_F32(config->args, where, "-mjd_max", "stackSumSkyfile.mjd_obs", "<="); 1139 PXOPT_COPY_STR(config->args, where, "-tess_id", "relStack.tess_id", "=="); 1140 PXOPT_COPY_STR(config->args, where, "-skycell_id", "relStack.skycell_id", "LIKE"); 1141 PXOPT_COPY_STR(config->args, where, "-projection_cell", "stackAssociation.projection_cell", "LIKE"); 1142 PXOPT_COPY_STR(config->args, where, "-stack_data_group", "stackRun.data_group", "LIKE"); 1143 PXOPT_COPY_STR(config->args, where, "-data_group", "stackAssociation.data_group", "LIKE"); 1144 // PXOPT_COPY_STR(config->args, where, "-skycal_data_group", "skycalRun.data_group", "LIKE"); 1145 1146 PXOPT_COPY_STR(config->args, where, "-surveyName", "survey.surveyName", "LIKE"); 1147 PXOPT_COPY_S32(config->args, where, "-rel_id", "relExp.rel_id", "=="); 1148 pxskycellAddWhere(config, where); 1149 1150 // PXOPT_COPY_F32(config->args, where, "-fwhm_min", "IFNULL(skycalResult.fwhm_major, 999)", ">="); 1151 // PXOPT_COPY_F32(config->args, where, "-fwhm_max", "IFNULL(skycalResult.fwhm_major, 0)", "<="); 1152 1153 PXOPT_LOOKUP_BOOL(priority_order, config->args, "-priority_order", false); 1154 1155 PXOPT_LOOKUP_U64(limit, config->args, "-limit", false, false); 1156 PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false); 1157 1158 pxAddLabelSearchArgs (config, where, "-stack_type", "relStack.stack_type", "=="); 1159 1160 psString query = pxDataGet("releasetool_summary.sql"); 1161 if (!query) { 1162 psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement"); 1163 return false; 1164 } 1165 1166 if (psListLength(where->list)) { 1167 psString whereClause = psDBGenerateWhereConditionSQL(where, NULL); 1168 psStringAppend(&query, "\nWHERE %s", whereClause); 1169 psFree(whereClause); 1170 } else { 1171 psError(PXTOOLS_ERR_CONFIG, false, "search parameters are required\n"); 1172 psFree(where); 1173 return false; 1174 } 1175 1176 if (priority_order) { 1177 psStringAppend(&query, "\nAND priority > 0 order by priority DESC, stack_id"); 1083 1178 } 1084 1179 -
tags/ipp-20130712/ippTools/src/releasetool.h
r35213 r36122 38 38 RELEASETOOL_MODE_TOCALIBSTACK, 39 39 RELEASETOOL_MODE_LISTRELSTACK, 40 RELEASETOOL_MODE_SUMMARY, 40 41 RELEASETOOL_MODE_DEFINERELGROUP, 41 42 RELEASETOOL_MODE_PENDINGRELGROUP, -
tags/ipp-20130712/ippTools/src/releasetoolConfig.c
- Property svn:mergeinfo deleted
r35898 r36122 248 248 psMetadataAddBool(listrelstackArgs, PS_LIST_TAIL, "-simple", 0, "use the simple output format", false); 249 249 250 // -summary 251 psMetadata *summaryArgs = psMetadataAlloc(); 252 psMetadataAddS64(summaryArgs, PS_LIST_TAIL, "-sass_id", 0, "select by released SASS ID", 0); 253 psMetadataAddS64(summaryArgs, PS_LIST_TAIL, "-relstack_id", 0, "select by released exposure ID", 0); 254 psMetadataAddS64(summaryArgs, PS_LIST_TAIL, "-stack_id", 0, "select by stack ID", 0); 255 // psMetadataAddS64(summaryArgs, PS_LIST_TAIL, "-skycal_id", 0, "select by skycal ID", 0); 256 psMetadataAddStr(summaryArgs, PS_LIST_TAIL, "-release_name", 0, "select by release name (LIKE comparision)", NULL); 257 psMetadataAddStr(summaryArgs, PS_LIST_TAIL, "-release_state", PS_META_DUPLICATE_OK, "select by release state", NULL); 258 // psMetadataAddStr(summaryArgs, PS_LIST_TAIL, "-state", 0, "select by released stack state", NULL); 259 260 psMetadataAddStr(summaryArgs, PS_LIST_TAIL, "-filter", 0, "select by filter name (LIKE comparison)", NULL); 261 262 pxskycellAddArguments(summaryArgs); 263 264 psMetadataAddStr(summaryArgs, PS_LIST_TAIL, "-tess_id", 0, "select by tess_id", NULL); 265 psMetadataAddStr(summaryArgs, PS_LIST_TAIL, "-skycell_id", 0, "select by skycell_id (LIKE comparision)", NULL); 266 psMetadataAddStr(summaryArgs, PS_LIST_TAIL, "-projection_cell", 0, "select by projection_cell (LIKE comparision)", NULL); 267 psMetadataAddStr(summaryArgs, PS_LIST_TAIL, "-stack_type", PS_META_DUPLICATE_OK, "select by stack_type", NULL); 268 269 psMetadataAddStr(summaryArgs, PS_LIST_TAIL, "-stack_data_group", 0, "select by stackRun.data_group (LIKE comparison)", NULL); 270 psMetadataAddStr(summaryArgs, PS_LIST_TAIL, "-data_group", 0, "select by stackAsociation.data_group (LIKE comparison)", NULL); 271 272 psMetadataAddStr(summaryArgs, PS_LIST_TAIL, "-surveyName", 0, "select by survey name (LIKE comparision)", NULL); 273 psMetadataAddS64(summaryArgs, PS_LIST_TAIL, "-rel_id", 0, "select by release ID", 0); 274 275 psMetadataAddBool(summaryArgs, PS_LIST_TAIL, "-priority_order", 0, "order by release priority", false); 276 277 psMetadataAddU64(summaryArgs, PS_LIST_TAIL, "-limit", 0, "limit result set to N items", 0); 278 psMetadataAddBool(summaryArgs, PS_LIST_TAIL, "-simple", 0, "use the simple output format", false); 250 279 251 280 // -definerelgroup … … 322 351 PXOPT_ADD_MODE("-definerelstack", "define a released stack", RELEASETOOL_MODE_DEFINERELSTACK, definerelstackArgs); 323 352 PXOPT_ADD_MODE("-listrelstack", "list released stacks", RELEASETOOL_MODE_LISTRELSTACK, listrelstackArgs); 353 PXOPT_ADD_MODE("-summary", "list stackSummaryes for released stacks", RELEASETOOL_MODE_SUMMARY, summaryArgs); 324 354 325 355 PXOPT_ADD_MODE("-definerelgroup", "define a group of exposures", RELEASETOOL_MODE_DEFINERELGROUP, definerelgroupArgs); -
tags/ipp-20130712/ippTools/src/stacktool.c
- Property svn:mergeinfo deleted
r35857 r36122 44 44 static bool tosummaryMode(pxConfig *config); 45 45 static bool addsummaryMode(pxConfig *config); 46 static bool summaryMode(pxConfig *config); 46 47 static bool pendingcleanuprunMode(pxConfig *config); 47 48 static bool pendingcleanupskyfileMode(pxConfig *config); … … 84 85 MODECASE(STACKTOOL_MODE_TOSUMMARY, tosummaryMode); 85 86 MODECASE(STACKTOOL_MODE_ADDSUMMARY, addsummaryMode); 87 MODECASE(STACKTOOL_MODE_SUMMARY, summaryMode); 86 88 MODECASE(STACKTOOL_MODE_PENDINGCLEANUPRUN, pendingcleanuprunMode); 87 89 MODECASE(STACKTOOL_MODE_PENDINGCLEANUPSKYFILE, pendingcleanupskyfileMode); … … 748 750 PXOPT_COPY_S64(config->args, where, "-stack_id", "stackRun.stack_id", "=="); 749 751 PXOPT_COPY_STR(config->args, where, "-label", "stackRun.label", "=="); 752 PXOPT_COPY_STR(config->args, where, "-data_group", "stackRun.data_group", "=="); 750 753 PXOPT_COPY_STR(config->args, where, "-state", "stackRun.state", "=="); 751 754 PXOPT_COPY_S64(config->args, where, "-sass_id", "stackAssociationMap.sass_id", "=="); … … 1567 1570 } 1568 1571 1572 static bool summaryMode(pxConfig *config) 1573 { 1574 PS_ASSERT_PTR_NON_NULL(config, false); 1575 1576 psMetadata *where = psMetadataAlloc(); 1577 PXOPT_COPY_S64(config->args, where, "-sass_id", "stackSummary.sass_id", "=="); 1578 PXOPT_COPY_STR(config->args, where, "-projection_cell", "stackAssociation.projection_cell", "=="); 1579 PXOPT_COPY_STR(config->args, where, "-tess_id", "stackAssociation.tess_id", "LIKE"); 1580 PXOPT_COPY_STR(config->args, where, "-filter", "stackAssociation.filter", "LIKE"); 1581 PXOPT_COPY_S64(config->args, where, "-stack_id", "stackSumSkyfile.stack_id", "=="); 1582 pxAddLabelSearchArgs(config, where, "-data_group", "stackAssociation.data_group", "LIKE"); 1583 PXOPT_COPY_STR(config->args, where, "-skycell_id", "stackRun.skycell_id", "LIKE"); 1584 // PXOPT_COPY_STR(config->args, where, "-state", "stackRun.state", "=="); 1585 pxAddLabelSearchArgs(config, where, "-label", "stackRun.label", "LIKE"); 1586 // PXOPT_COPY_S16(config->args, where, "-fault", "stackSumSkyfile.fault", "=="); 1587 // PXOPT_COPY_F64(config->args, where, "-mjd_obs_begin", "stackSumSkyfile.mjd_obs", ">="); 1588 // PXOPT_COPY_F64(config->args, where, "-mjd_obs_end", "stackSumSkyfile.mjd_obs", "<="); 1589 // PXOPT_COPY_S16(config->args, where, "-background_model","stackSumSkyfile.background_model", "=="); 1590 1591 // PXOPT_LOOKUP_BOOL(all, config->args, "-all", false); 1592 1593 PXOPT_LOOKUP_U64(limit, config->args, "-limit", false, false); 1594 PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false); 1595 1596 psString query = pxDataGet("stacktool_summary.sql"); 1597 if (!query) { 1598 psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement"); 1599 return false; 1600 } 1601 1602 if (psListLength(where->list)) { 1603 psString whereClause = psDBGenerateWhereConditionSQL(where, NULL); 1604 psStringAppend(&query, " WHERE %s", whereClause); 1605 psFree(whereClause); 1606 } else { 1607 psError(PXTOOLS_ERR_CONFIG, true, "search parameters are required"); 1608 return false; 1609 } 1610 1611 psFree(where); 1612 1613 // treat limit == 0 as "no limit" 1614 if (limit) { 1615 psString limitString = psDBGenerateLimitSQL(limit); 1616 psStringAppend(&query, " %s", limitString); 1617 psFree(limitString); 1618 } 1619 1620 if (!p_psDBRunQuery(config->dbh, query)) { 1621 psError(PS_ERR_UNKNOWN, false, "database error"); 1622 psFree(query); 1623 return false; 1624 } 1625 psFree(query); 1626 1627 psArray *output = p_psDBFetchResult(config->dbh); 1628 if (!output) { 1629 psErrorCode err = psErrorCodeLast(); 1630 switch (err) { 1631 case PS_ERR_DB_CLIENT: 1632 psError(PXTOOLS_ERR_SYS, false, "database error"); 1633 case PS_ERR_DB_SERVER: 1634 psError(PXTOOLS_ERR_PROG, false, "database error"); 1635 default: 1636 psError(PXTOOLS_ERR_PROG, false, "unknown error"); 1637 } 1638 1639 return false; 1640 } 1641 if (!psArrayLength(output)) { 1642 psTrace("stacktool", PS_LOG_INFO, "no rows found"); 1643 psFree(output); 1644 return true; 1645 } 1646 1647 if (psArrayLength(output)) { 1648 if (!ippdbPrintMetadatas(stdout, output, "stackSummary", !simple)) { 1649 psError(PS_ERR_UNKNOWN, false, "failed to print array"); 1650 psFree(output); 1651 return false; 1652 } 1653 } 1654 1655 psFree(output); 1656 1657 return true; 1658 } 1659 1569 1660 static bool pendingcleanuprunMode(pxConfig *config) 1570 1661 { -
tags/ipp-20130712/ippTools/src/stacktool.h
r34800 r36122 38 38 STACKTOOL_MODE_TOSUMMARY, 39 39 STACKTOOL_MODE_ADDSUMMARY, 40 STACKTOOL_MODE_SUMMARY, 40 41 STACKTOOL_MODE_PENDINGCLEANUPRUN, 41 42 STACKTOOL_MODE_PENDINGCLEANUPSKYFILE, -
tags/ipp-20130712/ippTools/src/stacktoolConfig.c
r35122 r36122 121 121 psMetadataAddStr(updaterunArgs, PS_LIST_TAIL, "-state", 0, "search by state", NULL); 122 122 psMetadataAddStr(updaterunArgs, PS_LIST_TAIL, "-label", 0, "search by label", 0); 123 psMetadataAddStr(updaterunArgs, PS_LIST_TAIL, "-data_group", 0, "search by data_group", 0); 123 124 psMetadataAddS16(updaterunArgs, PS_LIST_TAIL, "-fault", 0, "search by fault code", 0); 124 125 psMetadataAddS64(updaterunArgs, PS_LIST_TAIL, "-sass_id", 0, "search by stack association ID", 0); … … 264 265 psMetadataAddStr(addsummaryArgs, PS_LIST_TAIL, "-path_base", 0, "set summary path base", NULL); 265 266 267 // -summary 268 psMetadata *summaryArgs = psMetadataAlloc(); 269 psMetadataAddS64(summaryArgs, PS_LIST_TAIL, "-sass_id", 0, "search by stack association ID", 0); 270 psMetadataAddS64(summaryArgs, PS_LIST_TAIL, "-stack_id", 0, "search by stack ID", 0); 271 psMetadataAddStr(summaryArgs, PS_LIST_TAIL, "-tess_id", 0, "search by tessellation ID", NULL); 272 psMetadataAddStr(summaryArgs, PS_LIST_TAIL, "-projection_cell", 0, "search by projection cell ID", NULL); 273 // psMetadataAddStr(summaryArgs, PS_LIST_TAIL, "-state", 0, "search by state", NULL); 274 psMetadataAddStr(summaryArgs, PS_LIST_TAIL, "-filter", 0, "search by filter (LIKE comparison)", NULL); 275 psMetadataAddStr(summaryArgs, PS_LIST_TAIL, "-label", PS_META_DUPLICATE_OK, "search by stackRun label (LIKE comparison)", NULL); 276 psMetadataAddStr(summaryArgs, PS_LIST_TAIL, "-data_group", PS_META_DUPLICATE_OK, "search by stackAssociation data_group (LIKE comparison)", NULL); 277 psMetadataAddStr(summaryArgs, PS_LIST_TAIL, "-skycell_id", 0, "search by skycell ID", NULL); 278 // psMetadataAddStr(summaryArgs, PS_LIST_TAIL, "-dist_group", PS_META_DUPLICATE_OK, "search by stackRun dist_group (LIKE comparison)", NULL); 279 280 // psMetadataAddBool(summaryArgs, PS_LIST_TAIL, "-all", 0, "search without arguments", false); 281 psMetadataAddU64(summaryArgs, PS_LIST_TAIL, "-limit", 0, "limit result set to N items", 0); 282 psMetadataAddBool(summaryArgs, PS_LIST_TAIL, "-simple", 0, "use the simple output format", false); 283 266 284 // -pendingcleanuprun 267 285 psMetadata *pendingcleanuprunArgs = psMetadataAlloc(); … … 324 342 PXOPT_ADD_MODE("-updatesumskyfile", "update fault code for sumskyfile", STACKTOOL_MODE_UPDATESUMSKYFILE, updatesumskyfileArgs); 325 343 PXOPT_ADD_MODE("-tosummary", "show runs that can be summarized", STACKTOOL_MODE_TOSUMMARY, tosummaryArgs); 344 PXOPT_ADD_MODE("-summary", "show runs that have been summarized", STACKTOOL_MODE_SUMMARY, summaryArgs); 326 345 PXOPT_ADD_MODE("-addsummary", "add entry to the summary table", STACKTOOL_MODE_ADDSUMMARY, addsummaryArgs); 327 346 PXOPT_ADD_MODE("-exportrun", "export run for import on other database", STACKTOOL_MODE_EXPORTRUN, exportrunArgs); -
tags/ipp-20130712/ippTools/src/staticskytool.c
r35194 r36122 50 50 static bool revertskycalresultMode(pxConfig *config); 51 51 static bool updateskycalresultMode(pxConfig *config); 52 static bool exportskycalrunMode(pxConfig *config); 53 static bool importskycalrunMode(pxConfig *config); 52 54 53 55 static bool setstaticskyRunState(pxConfig *config, psS64 sky_id, const char *state); … … 88 90 MODECASE(STATICSKYTOOL_MODE_REVERTSKYCALRESULT,revertskycalresultMode); 89 91 MODECASE(STATICSKYTOOL_MODE_SKYCALRESULT, skycalresultMode); 92 MODECASE(STATICSKYTOOL_MODE_EXPORTSKYCALRUN, exportskycalrunMode); 93 MODECASE(STATICSKYTOOL_MODE_IMPORTSKYCALRUN, importskycalrunMode); 90 94 default: 91 95 psAbort("invalid option (this should not happen)"); … … 895 899 bool importrunMode(pxConfig *config) 896 900 { 897 # if (0) 898 unsigned int nFail; 899 900 int numImportTables = 2; 901 902 char tables[2] [80] = {"stackInputSkyfile", "stackSumSkyfile"}; 901 return false; 902 } 903 904 bool exportskycalrunMode(pxConfig *config) 905 { 906 typedef struct ExportTable { 907 char tableName[80]; 908 char sqlFilename[80]; 909 } ExportTable; 910 911 int numExportTables = 2; 903 912 904 913 PS_ASSERT_PTR_NON_NULL(config, NULL); 905 914 906 PXOPT_LOOKUP_STR(infile, config->args, "-infile", true, false); 907 908 psMetadata *input = psMetadataConfigRead (NULL, &nFail, infile, false); 909 910 #ifdef notdef 911 fprintf (stderr, "---- input ----\n"); 912 psMetadataPrint (stderr, input, 1); 913 #endif 914 915 if (!pxCheckImportVersion(config, input)) { 916 psError(PS_ERR_UNKNOWN, false, "pxCheckImportVersion failed"); 915 // XXX unused PXOPT_LOOKUP_S64(det_id, config->args, "-sky_id", true, false); 916 PXOPT_LOOKUP_STR(outfile, config->args, "-outfile", true, false); 917 PXOPT_LOOKUP_BOOL(clean, config->args, "-clean", false); 918 PXOPT_LOOKUP_U64(limit, config->args, "-limit", false, false); 919 920 FILE *f = fopen (outfile, "w"); 921 if (f == NULL) { 922 psError(PS_ERR_UNKNOWN, false, "failed to open output file"); 917 923 return false; 918 924 } 919 psMetadataItem *item = psMetadataLookup (input, "stackRun"); 920 psAssert (item, "entry not in input?"); 921 psAssert (item->type == PS_DATA_METADATA_MULTI, "entry not multi?"); 922 923 psMetadataItem *entry = psListGet (item->data.list, 0); 924 assert (entry); 925 assert (entry->type == PS_DATA_METADATA); 926 stackRunRow *stackRun = stackRunObjectFromMetadata (entry->data.md); 927 stackRunInsertObject (config->dbh, stackRun); 928 929 // fprintf (stdout, "---- stack run ----\n"); 930 // psMetadataPrint (stderr, entry->data.md, 1); 931 932 for (int i = 0; i < numImportTables; i++) { 933 psMetadataItem *item = psMetadataLookup (input, tables[i]); 934 psAssert (item, "entry not in input?"); 935 psAssert (item->type == PS_DATA_METADATA_MULTI, "entry not multi?"); 936 937 switch (i) { 938 case 0: 939 for (int i = 0; i < item->data.list->n; i++) { 940 entry = psListGet (item->data.list, i); 941 assert (entry); 942 assert (entry->type == PS_DATA_METADATA); 943 stackInputSkyfileRow *stackInputSkyfile = stackInputSkyfileObjectFromMetadata (entry->data.md); 944 stackInputSkyfileInsertObject (config->dbh, stackInputSkyfile); 945 946 // fprintf (stdout, "---- row %d ----\n", i); 947 // psMetadataPrint (stderr, entry->data.md, 1); 948 } 949 break; 950 951 case 1: 952 for (int i = 0; i < item->data.list->n; i++) { 953 entry = psListGet (item->data.list, i); 954 assert (entry); 955 assert (entry->type == PS_DATA_METADATA); 956 stackSumSkyfileRow *stackSumSkyfile = stackSumSkyfileObjectFromMetadata (entry->data.md); 957 stackSumSkyfileInsertObject (config->dbh, stackSumSkyfile); 958 959 // fprintf (stdout, "---- row %d ----\n", i); 960 // psMetadataPrint (stderr, entry->data.md, 1); 961 } 962 break; 963 } 925 926 if (!pxExportVersion(config, f)) { 927 psError(PS_ERR_UNKNOWN, false, "failed to write dbversion output file"); 928 return false; 964 929 } 965 966 # endif 967 return true; 930 psMetadata *where = psMetadataAlloc(); 931 PXOPT_COPY_S64(config->args, where, "-skycal_id", "skycal_id", "=="); 932 933 ExportTable tables [] = { 934 {"skycalRun", "staticskytool_export_skycalrun.sql"}, 935 {"skycalResult", "staticskytool_export_skycalresult.sql"}, 936 }; 937 938 for (int i=0; i < numExportTables; i++) { 939 psString query = pxDataGet(tables[i].sqlFilename); 940 if (!query) { 941 psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement"); 942 return false; 943 } 944 945 if (where && psListLength(where->list)) { 946 psString whereClause = psDBGenerateWhereSQL(where, NULL); 947 psStringAppend(&query, " %s", whereClause); 948 psFree(whereClause); 949 } 950 951 // treat limit == 0 as "no limit" 952 if (limit) { 953 psString limitString = psDBGenerateLimitSQL(limit); 954 psStringAppend(&query, " %s", limitString); 955 psFree(limitString); 956 } 957 958 if (!p_psDBRunQuery(config->dbh, query)) { 959 psError(PS_ERR_UNKNOWN, false, "database error"); 960 psFree(query); 961 return false; 962 } 963 psFree(query); 964 965 psArray *output = p_psDBFetchResult(config->dbh); 966 if (!output) { 967 psError(PS_ERR_UNKNOWN, false, "database error"); 968 return false; 969 } 970 if (!psArrayLength(output)) { 971 psError(PS_ERR_UNKNOWN, true, "no rows found"); 972 psFree(output); 973 return false; 974 } 975 976 if (clean) { 977 if (!strcmp(tables[i].tableName, "skycalRun")) { 978 if (!pxSetStateCleaned("skycalRun", "state", output)) { 979 psFree(output); 980 psError(PS_ERR_UNKNOWN, false, "pxSetStateClean failed for table %s", tables[i].tableName); 981 return false; 982 } 983 } 984 } 985 986 // we must write the export table in non-simple (true) format 987 if (!ippdbPrintMetadatas(f, output, tables[i].tableName, true)) { 988 psError(PS_ERR_UNKNOWN, false, "failed to print array"); 989 psFree(output); 990 return false; 991 } 992 993 psFree(output); 994 } 995 996 fclose (f); 997 998 return true; 999 } 1000 1001 bool importskycalrunMode(pxConfig *config) 1002 { 1003 return false; 968 1004 } 969 1005 … … 986 1022 987 1023 } 988 989 # if (0)990 // now we need to loop over all requested filters and check that each is found991 // XXX is this needed? haven't we required that we only match the requested filters992 // and that N unique filters are found?993 994 psVector *found = psVectorAlloc(inputs->n, PS_TYPE_U8);995 psVectorInit (found, 0);996 997 psMetadataItem *filter = NULL;998 psListIterator *iter = psListIteratorAlloc (filters->data.list, PS_LIST_HEAD, false);999 while ((filter = psListGetAndIncrement(iter))) {1000 1001 bool foundOne = false;1002 1003 psAssert (filter->type == PS_DATA_STR, "filter is not a string?");1004 for (int j = 0; !foundOne && (j < inputs->n); j++) {1005 if (found->data.U8[j]) continue;1006 psMetadata *inputRow = inputs->data[j]; // Row from select1007 1008 // pull out the skycell_id, tess_id, filter1009 psString inFilter = psMetadataLookupStr(&status, row, "filter");1010 psAssert (status);1011 1012 found->data.U8[j] = true;1013 foundOne = true;1014 }1015 if (!foundOne) {1016 // this required filter was not found in the inputs, skip the entry1017 skip();1018 }1019 }1020 # endif1021 1024 1022 1025 static bool defineskycalrunMode(pxConfig *config) -
tags/ipp-20130712/ippTools/src/staticskytool.h
r32960 r36122 43 43 STATICSKYTOOL_MODE_SKYCALRESULT, 44 44 STATICSKYTOOL_MODE_REVERTSKYCALRESULT, 45 STATICSKYTOOL_MODE_EXPORTSKYCALRUN, 46 STATICSKYTOOL_MODE_IMPORTSKYCALRUN, 45 47 } staticskytoolMode; 46 48 -
tags/ipp-20130712/ippTools/src/staticskytoolConfig.c
r35197 r36122 269 269 psMetadataAddBool(skycalresultArgs, PS_LIST_TAIL, "-simple", 0, "use the simple output format", false); 270 270 271 // -exportskycalrun 272 psMetadata *exportskycalrunArgs = psMetadataAlloc(); 273 psMetadataAddS64(exportskycalrunArgs, PS_LIST_TAIL, "-skycal_id", 0, "export this skycal ID (required)", 0); 274 psMetadataAddStr(exportskycalrunArgs, PS_LIST_TAIL, "-outfile", 0, "export to this file (required)", NULL); 275 psMetadataAddU64(exportskycalrunArgs, PS_LIST_TAIL, "-limit", 0, "limit result set to N items", 0); 276 psMetadataAddBool(exportskycalrunArgs, PS_LIST_TAIL, "-clean", 0, "mark tables as cleaned", false); 277 278 // -importrun 279 psMetadata *importskycalrunArgs = psMetadataAlloc(); 280 psMetadataAddStr(importskycalrunArgs, PS_LIST_TAIL, "-infile", 0, "import from this file (required)", NULL); 281 282 271 283 psFree(now); 272 284 … … 291 303 PXOPT_ADD_MODE("-updateskycal", "revert faulted skycal run", STATICSKYTOOL_MODE_UPDATESKYCALRESULT, updateskycalresultArgs); 292 304 PXOPT_ADD_MODE("-skycalresult", "Get result of skycal run", STATICSKYTOOL_MODE_SKYCALRESULT, skycalresultArgs); 305 PXOPT_ADD_MODE("-exportskycalrun", "Export skycal run", STATICSKYTOOL_MODE_EXPORTSKYCALRUN, exportskycalrunArgs); 306 PXOPT_ADD_MODE("-importskycalrun", "Import skycal run", STATICSKYTOOL_MODE_IMPORTSKYCALRUN, importskycalrunArgs); 293 307 294 308 if (!pxGetOptions(stderr, argc, argv, config, modes, argSets)) { -
tags/ipp-20130712/pstamp
- Property svn:mergeinfo changed
/trunk/pstamp merged: 35911,35932,35937,36010-36011,36017-36018,36043,36048,36059-36061,36077,36104
- Property svn:mergeinfo changed
-
tags/ipp-20130712/pstamp/scripts
- Property svn:mergeinfo changed
/branches/eam_branches/ipp-20130711/pstamp/scripts (added) merged: 36071
- Property svn:mergeinfo changed
-
tags/ipp-20130712/pstamp/scripts/psgetcalibinfo
- Property svn:mergeinfo changed (with no actual effect on merging)
-
tags/ipp-20130712/pstamp/scripts/pstamp_get_image_job.pl
r33015 r36122 65 65 my $mdcParser = PS::IPP::Metadata::Config->new; # Parser for metadata config files 66 66 67 my $data = $mdcParser->parse(join "", (<INPUT>)) or my_die("failed to parse metadata config doc", $PS_EXIT_UNKNOWN_ERROR); 67 my $data = $mdcParser->parse(join "", (<INPUT>)) 68 or my_die("failed to parse metadata config doc", $PS_EXIT_UNKNOWN_ERROR); 69 68 70 my $components = parse_md_list($data); 69 71 my $n = scalar @$components; … … 83 85 print STDERR "stage_id is $stage_id\n"; 84 86 print STDERR "path_base is $path_base\n"; 85 print STDERR "path_base is $path_base\n";86 87 print STDERR "CAMERA is $camera\n"; 87 88 print STDERR "magicked is " . (defined $magicked ? $magicked : "undefined") . "\n"; … … 89 90 90 91 if (!$camera or !$path_base or !$component or !$stage_id or !$stage) { 91 my_die(" failed to parse params from: $params_file", $PS_EXIT_UNKNOWN_ERROR);92 my_die("One or more parameters are missing in: $params_file", $PS_EXIT_UNKNOWN_ERROR); 92 93 } 93 94 -
tags/ipp-20130712/pstamp/scripts/pstamp_job_run.pl
r35909 r36122 57 57 my_die("output_base is required", $job_id, $PS_EXIT_PROG_ERROR) if !$outputBase; 58 58 59 $options = 1 if !$options; 60 61 # We don't need to muggle anymore. Ignore those options 62 $options &= ~($PSTAMP_REQUEST_UNCENSORED | $PSTAMP_REQUIRE_UNCENSORED); 59 # ppstamp requires an input file 60 $options = $PSTAMP_SELECT_IMAGE if !$options; 63 61 64 62 my $ipprc = PS::IPP::Config->new(); # IPP Configuration … … 95 93 my $argString; 96 94 $argString = $params->{job_args}; 95 96 my_die("argument list is empty", $job_id, $PS_EXIT_DATA_ERROR) if !$argString; 97 97 98 my $stage = $params->{stage}; 98 99 # XXX: should we do any other sanity checking? 100 my_die("argument list is empty", $job_id, $PS_EXIT_DATA_ERROR) if !$argString; 99 my_die("stage is not defined", $job_id, $PS_EXIT_DATA_ERROR) if !$stage; 100 101 if ($stage eq 'stack_summary') { 102 103 # remove options not supported by stack summary 104 $options &= ~($PSTAMP_SELECT_SOURCES | $PSTAMP_SELECT_BACKMDL | $PSTAMP_SELECT_INVERSE 105 | $PSTAMP_RESTORE_BACKGROUND); 106 107 # stackSummary outputs do not follow the usual IPP conventions for file names. 108 # The parser (actually Job.pm) has deferred handling this until here 109 update_stack_summary_filenames($params); 110 111 } elsif ($stage ne 'stack') { 112 # ignore options only supported by stack and stack_summary 113 $options &= ~($PSTAMP_SELECT_EXP | $PSTAMP_SELECT_NUM); 114 } 115 101 116 102 117 if ($stage eq "raw") { … … 181 196 } 182 197 183 # my ($tmpImage, $tmpMask, $tmpVariance, $tmproot); 184 185 my $command = "$ppstamp $outputBase $argString $fileArgs"; 186 $command .= " -write_jpeg" if ($options & $PSTAMP_SELECT_JPEG); 187 $command .= " -nocompress" if ($options & $PSTAMP_SELECT_UNCOMPRESSED); 188 $command .= " -stage $stage"; 189 $command .= " -forheader $calibfile" if $calibfile; 190 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 191 run(command => $command, verbose => $verbose); 198 # unless the stage is stack_summary we use ppstamp to make postage stamps (including -wholefile) 199 # otherwise we make copies of the input files to the outputs 200 my $use_ppstamp = ($stage ne 'stack_summary'); 192 201 193 202 my $exitStatus; 194 if (WIFEXITED($error_code)) { 195 $exitStatus = WEXITSTATUS($error_code); 196 } else { 197 print STDERR "ppstamp failed error_code: $error_code\n"; 198 $exitStatus = $PS_EXIT_SYS_ERROR; 203 if ($use_ppstamp) { 204 my $command = "$ppstamp $outputBase $argString $fileArgs"; 205 $command .= " -write_jpeg" if ($options & $PSTAMP_SELECT_JPEG); 206 $command .= " -nocompress" if ($options & $PSTAMP_SELECT_UNCOMPRESSED); 207 $command .= " -stage $stage"; 208 $command .= " -forheader $calibfile" if $calibfile; 209 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 210 run(command => $command, verbose => $verbose); 211 212 if (WIFEXITED($error_code)) { 213 $exitStatus = WEXITSTATUS($error_code); 214 } else { 215 print STDERR "ppstamp failed error_code: $error_code\n"; 216 $exitStatus = $PS_EXIT_SYS_ERROR; 217 } 218 # XXX: if stage is stack deal with EXP and NUM images if selected 219 } else { 220 $exitStatus = justCopyFiles($outputBase, \$options, $params); 199 221 } 200 222 … … 208 230 209 231 # Note: we are assuming the contents of the PSTAMP filerules here. 210 my %extensions = ( $PSTAMP_SELECT_IMAGE => "fits", 211 $PSTAMP_SELECT_MASK => "mk.fits", 212 $PSTAMP_SELECT_VARIANCE => "wt.fits", 213 $PSTAMP_SELECT_SOURCES => "cmf", 214 $PSTAMP_SELECT_JPEG => "jpg"); 215 216 my $output_mask = $options & ($PSTAMP_SELECT_IMAGE | $PSTAMP_SELECT_MASK | $PSTAMP_SELECT_VARIANCE | $PSTAMP_SELECT_JPEG | $PSTAMP_SELECT_SOURCES); 232 my %extensions = ( $PSTAMP_SELECT_IMAGE => 'fits', 233 $PSTAMP_SELECT_MASK => 'mk.fits', 234 $PSTAMP_SELECT_VARIANCE => 'wt.fits', 235 $PSTAMP_SELECT_SOURCES => 'cmf', 236 $PSTAMP_SELECT_JPEG => 'jpg', 237 $PSTAMP_SELECT_EXP => 'exp.fits', 238 $PSTAMP_SELECT_NUM => 'num.fits', 239 $PSTAMP_SELECT_EXPJPEG => 'exp.jpg', 240 $PSTAMP_SELECT_NUMJPEG => 'num.jpg'); 241 242 my $output_mask = $options & ($PSTAMP_SELECT_IMAGE | $PSTAMP_SELECT_MASK | $PSTAMP_SELECT_VARIANCE 243 | $PSTAMP_SELECT_JPEG | $PSTAMP_SELECT_SOURCES 244 | $PSTAMP_SELECT_EXP | $PSTAMP_SELECT_NUM 245 | $PSTAMP_SELECT_EXPJPEG | $PSTAMP_SELECT_NUMJPEG); 246 217 247 218 248 foreach my $key (keys (%extensions)) { … … 534 564 } 535 565 566 # stack_summary stage does not currently use proper file rules. 567 # The parser defers handlint this to us.. 568 569 sub update_stack_summary_filenames { 570 my $params = shift; 571 572 my $path_base = $params->{path_base}; 573 574 $params->{image} = $path_base . ".image.b1.fits"; 575 $params->{mask} = $path_base . ".mask.b1.fits"; 576 $params->{weight} = $path_base . ".variance.b1.fits"; 577 $params->{jpeg} = $path_base . ".image.0.b1.jpeg"; 578 $params->{exp} = $path_base . ".exp.b1.fits"; 579 $params->{num} = $path_base . ".num.b1.fits"; 580 $params->{expjpeg} = $path_base . ".exp.0.b1.jpeg"; 581 $params->{numjpeg} = $path_base . ".num.0.b1.jpeg"; 582 } 583 584 sub myCopy { 585 my ($dest, $src, $type, $dieOnFail) = @_; 586 587 my $result; 588 my $resolved = $ipprc->file_resolve($src); 589 if ($resolved and $ipprc->file_exists($resolved)) { 590 print "Copying $src to $dest\n" if $verbose;; 591 $result = copy($resolved, $dest); 592 } else { 593 my $msg = "Specified source $type image $src not found."; 594 if ($dieOnFail) { 595 $msg .= "\n"; 596 } else { 597 $msg .= " ignoring\n"; 598 } 599 carp $msg; 600 $result = 0; 601 } 602 603 if (!$result and $dieOnFail) { 604 &my_die("Unable to copy $type image", $job_id, $PS_EXIT_SYS_ERROR, 'run'); 605 } 606 return $result; 607 } 608 609 sub justCopyFiles { 610 my ($outputBase, $r_options, $params) = @_; 611 612 print "Just copying files for $job_id.\n"; 613 614 my $options = $$r_options; 615 if ($options & $PSTAMP_SELECT_IMAGE) { 616 myCopy("$outputBase.fits", $params->{image}, 'image', 1); 617 } 618 if ($options & $PSTAMP_SELECT_MASK) { 619 if (!myCopy("$outputBase.mk.fits", $params->{mask}, 'mask', 0)) { 620 $options &= ~$PSTAMP_SELECT_MASK; 621 } 622 } 623 if ($options & $PSTAMP_SELECT_VARIANCE) { 624 if (!myCopy("$outputBase.wt.fits", $params->{weight}, 'variance', 0)) { 625 $options = ~$PSTAMP_SELECT_VARIANCE; 626 } 627 } 628 if ($options & $PSTAMP_SELECT_JPEG) { 629 if (!myCopy("$outputBase.jpg", $params->{jpeg}, 'jpeg', 0)) { 630 $options &= ~$PSTAMP_SELECT_JPEG; 631 } 632 } 633 if ($options & $PSTAMP_SELECT_EXP) { 634 if (!myCopy("$outputBase.exp.fits", $params->{exp}, 'exp', 0)) { 635 $options &= ~$PSTAMP_SELECT_EXP; 636 } 637 } 638 if ($options & $PSTAMP_SELECT_NUM) { 639 if (!myCopy("$outputBase.num.fits", $params->{num}, 'num', 0)) { 640 $options &= ~$PSTAMP_SELECT_NUM; 641 } 642 } 643 if ($options & $PSTAMP_SELECT_EXPJPEG) { 644 if (!myCopy("$outputBase.exp.jpg", $params->{expjpeg}, 'exp', 0)) { 645 $options &= ~$PSTAMP_SELECT_EXPJPEG; 646 } 647 } 648 if ($options & $PSTAMP_SELECT_NUMJPEG) { 649 if (!myCopy("$outputBase.num.jpg", $params->{numjpeg}, 'num', 0)) { 650 $options &= ~$PSTAMP_SELECT_NUMJPEG; 651 } 652 } 653 654 $$r_options = $options; 655 656 print "Done with copy.\n"; 657 658 return 0; 659 } 660 536 661 sub my_die 537 662 { -
tags/ipp-20130712/pstamp/scripts/pstampparse.pl
r36056 r36122 51 51 52 52 die "invalid mode '$mode'" unless ($mode eq "list_uri") or ($mode eq "queue_job"); 53 die "--file is required" if !defined($request_file_name);53 die "--file is required" unless defined($request_file_name); 54 54 55 55 if ($mode ne "list_uri") { 56 die "req_id is required" if !$req_id;56 die "req_id is required" if !$req_id; 57 57 die "outdir is required" if !$outdir; 58 die "product is required" if !$product;58 die "product is required" if !$product; 59 59 } else { 60 $req_id = 0; 61 $outdir = "nowhere"; 60 # mode eq 'list_uri' (used for parser testing) 61 # these values won't be used for anything but should be defined to avoid errors 62 $req_id = 0; 63 $outdir = "nowhere"; 62 64 $product = "dummy"; 63 65 } … … 76 78 my $pstamptool = can_run('pstamptool') or (warn "Can't find pstamptool" and $missing_tools = 1); 77 79 my $pstampdump = can_run('pstampdump') or (warn "Can't find pstampdump" and $missing_tools = 1); 78 my $fields = can_run('fields') or (warn "Can't find fields" and $missing_tools = 1);80 my $fields = can_run('fields') or (warn "Can't find fields" and $missing_tools = 1); 79 81 80 82 if ($missing_tools) { … … 116 118 if ($extver >= 2) { 117 119 # We have a version 2 file. Require that the new keywords be supplied. 118 my_die("action not supplied in version $extver request file $request_file_name\n", $PSTAMP_INVALID_REQUEST) unless defined $action; 119 120 my_die("invalid action: $action supplied in version $extver request file $request_file_name\n", $PSTAMP_INVALID_REQUEST) unless (uc($action) eq 'PROCESS' or uc($action) eq 'PREVIEW'); 121 122 my_die("email not supplied in version $extver request file $request_file_name\n", $PSTAMP_INVALID_REQUEST) unless $email; 120 my_die("action not supplied in version $extver request file $request_file_name\n", $PSTAMP_INVALID_REQUEST) 121 unless defined $action; 122 123 my_die("invalid action: $action supplied in version $extver request file $request_file_name\n", 124 $PSTAMP_INVALID_REQUEST) 125 unless (uc($action) eq 'PROCESS' or uc($action) eq 'PREVIEW'); 126 127 my_die("email not supplied in version $extver request file $request_file_name\n", $PSTAMP_INVALID_REQUEST) 128 unless $email; 129 123 130 # XXX check for "valid" $email 124 131 } else { 125 132 # for version 1 file the action is process and email is not used 126 133 $action = 'PROCESS'; 127 $email = 'null';134 $email = 'null'; 128 135 } 129 136 … … 175 182 176 183 177 if ($req_id and !$no_update){184 { 178 185 # update the database with the request name. This will be used as the 179 # the output data store's product name186 # the fileset name in the output data store 180 187 my $command = "$pstamptool -updatereq -req_id $req_id -set_name $req_name"; 181 188 $command .= " -set_username $email" if $email ne 'null'; 182 189 $command .= " -set_outProduct $product"; 183 190 $command .= " -set_label $label" if $label_changed; 184 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 185 run(command => $command, verbose => $verbose); 186 unless ($success) { 187 my_die("$command failed", $PS_EXIT_UNKNOWN_ERROR); 188 } 189 } 191 unless ($no_update) { 192 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 193 run(command => $command, verbose => $verbose); 194 unless ($success) { 195 my_die("$command failed", $PS_EXIT_UNKNOWN_ERROR); 196 } 197 } else { 198 print "skipping $command\n"; 199 } 200 } 201 190 202 if ($duplicate_req_name) { 191 203 exit 0; … … 212 224 } 213 225 214 if (!$rows) { 215 # we got called so a valid pstamp request header was found so we can only assume 216 # that the file is invalid 217 print STDERR "Invalid request file\n"; 226 my $nRows = $rows ? scalar @$rows : 0; 227 print "\n$nRows rows read from request file\n"; 228 229 unless ($nRows) { 230 # pstamp_job_run was invoked so the request file must have contained a valid header 231 # a request file with no rows is invalid. 232 # The print above will let the log file know a bit more. 233 # Insert a faulted fake job and exit this program successfully. 234 print STDERR "Invalid request file.\n"; 218 235 insertFakeJobForRow(undef, 0, $PSTAMP_INVALID_REQUEST); 219 236 exit 0; 220 237 } 221 238 222 my $nRows = scalar @$rows;223 print "\n$nRows rows read from request file\n";224 239 225 240 … … 227 242 my $imageList; 228 243 my $stage; 244 my $big_limit = 100; # XXX: this should be in a configuration file some where 229 245 foreach my $row (@$rows) { 230 246 231 247 if (!($label =~ /BIG/) and ($label =~ /PSI/ or $label =~ /WEB/) and 232 248 ($nRows > 200 or $num_jobs > 200) and $req_id and !$no_update) { 233 234 # this is a big request and it came from one of the "high priority" channels235 # change the label to one that runs with lower priority249 # This is a "big" request and it came from one of the "high priority" 250 # channels and doesn't have a specific label assigned. 251 # Change the label to a value that its jobs run with lower priority. 236 252 my $old_label = $label; 237 253 254 print "\nChanging label for big request from $old_label to $label\n"; 238 255 $label = ($label =~ /WEB/) ? 'WEB.BIG' : 'PSI.BIG'; 239 print "\nChanging label for big request from $old_label to $label\n";240 256 241 257 my $command = "$pstamptool -updatereq -req_id $req_id -set_label $label"; … … 261 277 262 278 if (($action eq 'LIST' or $mode eq "queue_job") and ($num_jobs eq 0)) { 263 print STDERR "no jobs created for $req_name\n" if $verbose; 264 insertFakeJobForRow(undef, 0, $PSTAMP_INVALID_REQUEST); 279 # this should not happen. The function above is required to insert a fake job for any 280 # rows that did not yield any jobs. 281 print STDERR "ERROR: zero jobs created for $req_name\n"; 282 insertFakeJobForRow(undef, 0, $PS_EXIT_PROG_ERROR); 265 283 } 266 284 … … 298 316 } 299 317 if ($job_type eq 'get_image') { 300 unless ($req_type eq 'byid' or $req_type eq 'byexp' or ($req_type eq 'byskycell' and $stage eq 'stack')) { 301 print STDERR "REQ_TYPE must be 'byid' or 'byexp' or byskcyell for stacks for JOB_TYPE 'get_image'\n"; 318 # get_image jobs are quite expensive in terms of space so we are currently restricting them 319 unless ($req_type eq 'byid' or $req_type eq 'byexp' 320 or ($req_type eq 'byskycell' and $stage eq 'stack') 321 or ($stage eq 'stack_summary')) { 322 print STDERR "REQ_TYPE must be 'byid' or 'byexp' JOB_TYPE 'get_image' for IMG_TYPE $stage\n"; 302 323 insertFakeJobForRow($row, 1, $PSTAMP_INVALID_REQUEST); 303 324 return 0; … … 307 328 my $component = $row->{COMPONENT}; 308 329 if (!defined $component or (lc($component) eq "null") or (lc($component) eq "all")) { 309 if ($job_type eq 'get_image' ) {330 if ($job_type eq 'get_image' and ! ($stage eq 'stack' or $stage eq 'stack_summary')) { 310 331 $row->{COMPONENT} = 'all'; 311 332 } else { … … 396 417 } 397 418 398 if (($req_type eq "byexp") and ($stage eq "stack" )) {399 print STDERR "byexp not implemented for stackstage. row: $rownum\n";419 if (($req_type eq "byexp") and ($stage eq "stack" or $stage eq 'stack_summary')) { 420 print STDERR "byexp not implemented for $stage stage. row: $rownum\n"; 400 421 insertFakeJobForRow($row, 1, $PSTAMP_NOT_IMPLEMENTED); 401 422 return 0; … … 469 490 my $start_locate = gettimeofday(); 470 491 471 print "\nCalling new_locate_imagesfor row: $rownum\n";492 print "\nCalling locate_images_for_row for row: $rownum\n"; 472 493 473 494 $imageList = locate_images_for_row($ipprc, $image_db, $camera, $row, $verbose); … … 533 554 my $image_db = $proj_hash->{dbname}; 534 555 my $camera = $proj_hash->{camera}; 535 my $need_magic = $proj_hash->{need_magic};556 my $need_magic = $proj_hash->{need_magic}; 536 557 # Since user can get unmagicked data "by coordinate" requests can go back in time 537 558 # to dredge unusable data from the "dark days"... … … 544 565 $need_magic = 0 if $stage eq 'stack'; 545 566 546 if ($need_magic) { 547 548 # this project requires that postage stamps be extracted from destreaked images 549 550 if ($option_mask & ($PSTAMP_REQUEST_UNCENSORED | $PSTAMP_REQUIRE_UNCENSORED)) { 551 # The user has requested uncensored stamps 552 553 if (!$dest_requires_magic) { 554 # and this user's data store destination is allowed uncensored stamps, so accept the request 555 $need_magic = 0; 556 } else { 557 print STDERR "Error row $rownum: User not authorized to to request uncensored stamps.\n"; 558 if ($option_mask & $PSTAMP_REQUIRE_UNCENSORED) { 559 # user required uncensored stamps. Can't do it so fail. 560 foreach my $r (@$rowList) { 561 insertFakeJobForRow($r, 1, $PSTAMP_NOT_AUTHORIZED); 562 $num_jobs++; 563 } 564 return $num_jobs; 565 } 566 567 # user will accept censored stamps. alter OPTION_MASK and continue 568 569 print STDERR " Will attempt to make destreaked stamps\n"; 570 # zap the offending bit in the option mask 571 $option_mask = $option_mask ^ ($PSTAMP_REQUEST_UNCENSORED); 572 foreach my $r (@$rowList) { 573 $r->{OPTION_MASK} = $option_mask; 574 } 575 } 576 } 577 } 578 567 # XXX: magic is dead 568 $need_magic = 0; 569 579 570 my $numRows = scalar @$rowList; 580 571 … … 713 704 } 714 705 $base =~ s/.fits$//; 706 707 my $filter = $image->{filter}; 708 if (!$filter) { 709 if ($stage eq 'diff') { 710 $filter = $image->{filter_1}; 711 } 712 if (!$filter) { 713 # XXX: perhaps this should be a programming error... 714 print STDERR "missing filter using 'X'\n"; 715 $filter = 'X'; 716 } 717 } 718 # use first character of filter 719 $filter = substr($filter, 0, 1); 715 720 716 my $output_base = "$outdir/${rownum}_${job_num}_${ base}";721 my $output_base = "$outdir/${rownum}_${job_num}_${filter}_${base}"; 717 722 write_params($output_base, $image); 718 723 … … 1175 1180 } 1176 1181 if (($img_type eq "raw") or ($img_type eq "chip") or ($img_type eq "warp") or 1177 ($img_type eq "stack") or ($img_type eq "diff")) {1182 ($img_type eq "stack") or ($img_type eq 'stack_summary') or ($img_type eq "diff")) { 1178 1183 return 1; 1179 1184 } else { -
tags/ipp-20130712/pstamp/src/Makefile.am
r34089 r36122 1 bin_PROGRAMS = ppstamp pstamp request pstampdump1 bin_PROGRAMS = ppstamp pstampdump 2 2 3 3 include_HEADERS = \ -
tags/ipp-20130712/pstamp/src/ppstampMakeStamp.c
r35909 r36122 20 20 static bool setMaskedToNAN(pmConfig *config, psImage *image, psImage *mask, psImage *variance); 21 21 static bool copySources(pmReadout *outputReadout, pmReadout *inputReadout, pmReadout *astromReadout, psRegion extractRegion); 22 static bool imageHasValidPixels(psImage *image); 22 23 23 24 // convert the input chip's transforms to the output … … 337 338 status = false; 338 339 break; 340 } 341 if (!imageHasValidPixels(outReadout->image)) { 342 return PSTAMP_NO_VALID_PIXELS; 339 343 } 340 344 if (readout->variance) { … … 885 889 return true; 886 890 } 891 892 static bool 893 imageHasValidPixels(psImage *image) { 894 // check F32 image and return true if any pixel is finite 895 if (image->type.type != PS_TYPE_F32) { 896 return true; 897 } 898 for (int y=0; y<image->numRows; y++) { 899 for (int x=0; x<image->numCols; x++) { 900 psF32 pixel = image->data.F32[y][x]; 901 if (isfinite(pixel)) { 902 return true; 903 } 904 } 905 } 906 return false; 907 } -
tags/ipp-20130712/pstamp/src/pstamp.h
r34596 r36122 15 15 PSTAMP_DUP_REQUEST = 20, 16 16 PSTAMP_INVALID_REQUEST = 21, 17 PSTAMP_UNKNOWN_PRO DUCT = 22,17 PSTAMP_UNKNOWN_PROJECT = 22, 18 18 PSTAMP_NO_IMAGE_MATCH = 23, 19 19 PSTAMP_NOT_DESTREAKED = 24, … … 21 21 PSTAMP_GONE = 26, 22 22 PSTAMP_NO_JOBS_QUEUED = 27, 23 PSTAMP_NO_OVERLAP = 28 23 PSTAMP_NO_OVERLAP = 28, 24 PSTAMP_NOT_AUTHORIZED = 29, 25 PSTAMP_NO_VALID_PIXELS = 30, 24 26 } pstampJobErrors; 25 27 … … 34 36 #define PSTAMP_SELECT_BACKMDL 32 35 37 #define PSTAMP_SELECT_JPEG 64 36 // unused12837 // unused25638 #define PSTAMP_SELECT_EXP 128 39 #define PSTAMP_SELECT_NUM 256 38 40 #define PSTAMP_SELECT_UNCOMPRESSED 512 39 41 #define PSTAMP_SELECT_INVERSE 1024 … … 44 46 45 47 #define PSTAMP_NO_WAIT_FOR_UPDATE 32768 48 #ifdef notdef 46 49 #define PSTAMP_REQUEST_UNCENSORED 0x10000 47 50 #define PSTAMP_REQUIRE_UNCENSORED 0x20000 51 #endif 48 52 49 53 #define PSTAMP_CENTER_IN_PIXELS 1 -
tags/ipp-20130712/pstamp/test/gpc1/stacksummary.bycoord.txt
r36049 r36122 4 4 CHANGEME 2 PROCESS null 5 5 # ROWNUM CENTER_X CENTER_Y WIDTH HEIGHT COORD_MASK JOB_TYPE OPTION_MASK PROJECT SURVEY_NAME IPP_RELEASE REQ_TYPE IMG_TYPE ID TESS_ID COMPONENT DATA_GROUP REQFILT MJD_MIN MJD_MAX RUN_TYPE FWHM_MIN FWHM_MAX | COMMENT 6 1 359.767 -30.2009 100 100 2 stamp 455gpc1 3PI null bycoord stack_summary null RINGS.V3 null LAP.ThreePI.20130717% r 0 0 null 0 0 |6 1 359.767 -30.2009 100 100 2 stamp 1 gpc1 3PI null bycoord stack_summary null RINGS.V3 null LAP.ThreePI.20130717% r 0 0 null 0 0 | -
tags/ipp-20130712/pstamp/test/maketestreq
r35574 r36122 48 48 'label=s' => \$label, 49 49 'email=s' => \$email, 50 'username=s' => \$email, # I always forget what the option is 50 51 51 52 'dbname=s' => \$dbname,
Note:
See TracChangeset
for help on using the changeset viewer.
