Changeset 28181 for trunk/ippScripts/scripts
- Timestamp:
- Jun 1, 2010, 3:09:47 PM (16 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
- 2 copied
-
. (modified) (1 prop)
-
ippScripts/scripts/addstar_run.pl (modified) (7 diffs)
-
ippScripts/scripts/minidvodb_createdb.pl (copied) (copied from branches/haf_branches/ipp.20100512/ippScripts/scripts/minidvodb_createdb.pl )
-
ippScripts/scripts/minidvodb_merge.pl (copied) (copied from branches/haf_branches/ipp.20100512/ippScripts/scripts/minidvodb_merge.pl ) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/haf_branches/ipp.20100512 (added) merged: 27935-27937,27956,28034-28037,28058-28061,28101-28102,28104,28168-28171,28177,28180
- Property svn:mergeinfo changed
-
trunk/ippScripts/scripts/addstar_run.pl
r27718 r28181 37 37 } 38 38 39 my ( $exp_tag, $add_id, $camera, $outroot, $camroot, $dbname, $reduction, $dvodb, $ image_only, $verbose, $no_update,39 my ( $exp_tag, $add_id, $camera, $outroot, $camroot, $dbname, $reduction, $dvodb, $minidvodb, $minidvodb_name, $minidvodb_group, $image_only, $verbose, $no_update, 40 40 $no_op, $redirect, $save_temps); 41 41 GetOptions( … … 48 48 'reduction=s' => \$reduction, # Reduction class 49 49 'dvodb|w=s' => \$dvodb, # output DVO database 50 'minidvodb' => \$minidvodb, # use minidvodb? 51 'minidvodb_name|w=s'=> \$minidvodb_name, # miniDVO database name 52 'minidvodb_group|w=s' => \$minidvodb_group, # miniDVO database group 50 53 'image-only' => \$image_only, # Print to stdout 51 54 'verbose' => \$verbose, # Print to stdout … … 58 61 pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV; 59 62 pod2usage( 60 -msg => "Required options: --exp_tag --add_id --camera --outroot ",63 -msg => "Required options: --exp_tag --add_id --camera --outroot --dvodb --camroot", 61 64 -exitval => 3, 62 65 ) unless … … 65 68 defined $outroot and 66 69 defined $camroot and 70 defined $dvodb and 67 71 defined $camera; 68 72 if ($minidvodb && !defined($minidvodb_group)) { 73 my_die( "missing minidvodb_group", $add_id, 3 ); 74 } 69 75 my $ipprc = PS::IPP::Config->new( $camera ) or my_die( "Unable to set up", $add_id, $PS_EXIT_CONFIG_ERROR ); # IPP configuration 70 76 … … 103 109 my $dtime_addstar = 0; 104 110 111 if (defined $dvodbReal) { 112 if ($minidvodb) { 113 114 if (!defined($minidvodb_name)) { 115 #take the active one, if it's not defined on the command line 116 #reverts would have this already set, for example. 117 my $command = "addtool -listminidvodbrun "; 118 $command .= " -minidvodb_group $minidvodb_group" if defined $minidvodb_group; 119 $command .= " -state 'active' -limit 1"; 120 $command .= " -dbname $dbname" if defined $dbname; 121 print $command; 122 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 123 run(command => $command, verbose => $verbose); 124 &my_die( "Unable to get active minidvodb_name", $add_id, $PS_EXIT_SYS_ERROR) unless $success; 125 my $metadata = $mdcParser->parse(join "", @$stdout_buf) or 126 &my_die("Unable to parse metadata config", $add_id, $PS_EXIT_PROG_ERROR); 127 128 my $components = parse_md_list($metadata) or 129 &my_die("Unable to parse metadata list", $add_id, $PS_EXIT_PROG_ERROR); 130 my $comp = $$components[0]; 131 $minidvodb_name = $comp->{minidvodb_name}; 132 133 if (!defined($minidvodb_name)) { 134 &my_die("Unable to parse minidvodb_name", $add_id, $PS_EXIT_PROG_ERROR); 135 } 136 137 } 138 # tack on the minidvodb part to the db. 139 $dvodbReal = $dvodbReal . '/' . $minidvodb_name . '/'; 140 141 } 105 142 unless ($no_op) { 106 if (defined $dvodbReal) {143 print $dvodbReal; 107 144 108 145 ## addstar can either save the full set of detections, or just … … 142 179 $fpaCommand .= " -path_base $outroot"; 143 180 $fpaCommand .= " -dtime_addstar $dtime_addstar"; 181 $fpaCommand .= " -dvodb_path $dvodbReal"; 144 182 $fpaCommand .= " -dbname $dbname" if defined $dbname; 145 183 print $fpaCommand; 146 184 # Add the result into the database 147 185 unless ($no_update) { … … 171 209 $command .= " -addprocessedexp"; 172 210 $command .= " -fault $exit_code"; 211 $command .= " -dvodb_path $dvodbReal" if defined $dvodbReal; 173 212 $command .= " -path_base $outroot" if defined $outroot; 174 213 $command .= (" -dtime_addstar " . ((DateTime->now->mjd - $mjd_start) * 86400)); -
trunk/ippScripts/scripts/minidvodb_merge.pl
r28180 r28181 87 87 unless ($no_op) { 88 88 if (defined $mergedvodbReal) { 89 {89 { 90 90 my $command = "$addstar -resort"; 91 91 $command .= " -D CAMERA $camera"; … … 101 101 } 102 102 $dtime_addstar = 86400.0*(DateTime->now->mjd - $mjd_addstar_start); $dtime_resort = $dtime_addstar; 103 # MJD of starting script103 # MJD of starting script 104 104 print "addstar -resort time $dtime_addstar\n"; 105 105 } … … 123 123 print "relphot time $dtime_relphot\n"; 124 124 } 125 126 { 127 128 my $mdcParser = PS::IPP::Metadata::Config->new; 129 130 131 my $command = "$addtool -listminidvodbrun -state mergedsdfsad -minidvodb_group " . $minidvodb_group; 132 $command .= " -dbname $dbname" if defined $dbname; 133 134 135 136 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 125 126 my $this_is_the_first; 127 { 128 129 my $mdcParser = PS::IPP::Metadata::Config->new; 130 131 my $command = "$addtool -listminidvodbrun -state mergedsdfsad -minidvodb_group " . $minidvodb_group; 132 $command .= " -dbname $dbname" if defined $dbname; 133 134 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 137 135 run(command => $command, verbose => $verbose); 138 &my_die( "Unable to get list of minidvodbruns", $minidvodb_id, $PS_EXIT_SYS_ERROR) unless $success; 139 my $this_is_the_first; 140 if (scalar @$stdout_buf == 0 ) { #it lists nothing if it is the first 141 $this_is_the_first =1; 142 } else { 143 my $metadata = $mdcParser->parse(join "", @$stdout_buf) or 136 &my_die( "Unable to get list of minidvodbruns", $minidvodb_id, $PS_EXIT_SYS_ERROR) unless $success; 137 if (scalar @$stdout_buf == 0 ) { #it lists nothing if it is the first 138 $this_is_the_first =1; 139 } else { 140 my $metadata = $mdcParser->parse(join "", @$stdout_buf) or 144 141 &my_die("Unable to parse metadata config", $minidvodb_id, $PS_EXIT_PROG_ERROR); 145 #this fails if there is nothing listed. I checked.142 #this fails if there is nothing listed. I checked. 146 143 my $components = parse_md_list($metadata) or 147 144 &my_die("Unable to parse metadata list", $minidvodb_id, $PS_EXIT_PROG_ERROR); 148 145 my $comp = $$components[0]; 149 my $minidvodb_name = $comp->{minidvodb_name};150 146 my $minidvodb_name = $comp->{minidvodb_name}; 147 151 148 if (!defined($minidvodb_name)) { 152 149 &my_die("Unable to parse minidvodb_name", $minidvodb_id, $PS_EXIT_PROG_ERROR); 153 150 } #but just to make sure, have it grab a minidvodb_name, to make sure it's not junk. 154 $this_is_the_first = 0; 155 } 156 157 my $merge_command; 158 if ($this_is_the_first) { 159 160 $merge_command = "cp -rp $minidvodb $mergedvodb" 161 162 } else { 163 164 $merge_command = "$dvomerge $minidvodb into $mergedvodb" 165 } 166 167 168 169 system ($merge_command); 170 171 my ( $success2, $error_code2, $full_buf2, $stdout_buf2, $stderr_buf2 ) = 172 run(command => $merge_command, verbose => $verbose); 173 unless ($success2) { 174 $error_code2 = (($error_code2 >> 8) or $PS_EXIT_PROG_ERROR); 175 &my_die("Unable to merge: $error_code", $mergedvodb, $error_code2); 176 } 177 178 179 $dtime_merge = 86400.0*(DateTime->now->mjd - $mjd_relphot_start); # MJD of starting script 151 $this_is_the_first = 0; 152 } 153 } 154 155 { 156 my $merge_command; 157 if ($this_is_the_first) { 158 $merge_command = "cp -rp $minidvodb $mergedvodb" 159 } else { 160 $merge_command = "$dvomerge $minidvodb into $mergedvodb" 161 } 162 163 my $mjd_merge_start = DateTime->now->mjd; # MJD of starting script 164 165 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 166 run(command => $merge_command, verbose => $verbose); 167 unless ($success) { 168 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 169 &my_die("Unable to merge: $error_code", $mergedvodb, $error_code); 170 } 171 172 $dtime_merge = 86400.0*(DateTime->now->mjd - $mjd_merge_start); # MJD of starting script 180 173 print "merge time $dtime_merge\n"; 181 182 } 183 184 185 { 186 my $command = "addtool -minidvodb_id $minidvodb_id"; 187 $command .= " -addminidvodbprocessed"; 188 $command .= " -mergedvodb_path $mergedvodbReal" if defined $mergedvodbReal; 189 $command .= " -minidvodb_group $minidvodb_group"; 190 $command .= " -dtime_relphot $dtime_relphot" if defined $dtime_relphot; 191 $command .= " -dtime_relphot $dtime_resort" if defined $dtime_resort; 192 $command .= " -dtime_relphot $dtime_merge" if defined $dtime_merge; 193 $command .= " -dbname $dbname" if defined $dbname; 194 #print $command; 195 system ($command); 196 197 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 198 run(command => $command, verbose => $verbose); 199 unless ($success) { 200 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 201 &my_die("Unable to add to minidvodbprocessed: $error_code", $mergedvodb, $error_code); 202 } 203 204 } 174 } 175 176 177 { 178 my $command = "addtool -minidvodb_id $minidvodb_id"; 179 $command .= " -addminidvodbprocessed"; 180 $command .= " -mergedvodb_path $mergedvodbReal" if defined $mergedvodbReal; 181 $command .= " -minidvodb_group $minidvodb_group"; 182 $command .= " -dtime_relphot $dtime_relphot" if defined $dtime_relphot; 183 $command .= " -dtime_relphot $dtime_resort" if defined $dtime_resort; 184 $command .= " -dtime_relphot $dtime_merge" if defined $dtime_merge; 185 $command .= " -dbname $dbname" if defined $dbname; 186 #print $command; 187 188 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 189 run(command => $command, verbose => $verbose); 190 unless ($success) { 191 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 192 &my_die("Unable to add to minidvodbprocessed: $error_code", $mergedvodb, $error_code); 193 } 194 } 205 195 206 196 } else { … … 217 207 { 218 208 my $msg = shift; # Warning message on die 219 my $minidbvodb_id = shift; 209 my $minidbvodb_id = shift; 220 210 my $exit_code = shift; # Exit code to add 221 211 … … 223 213 224 214 if (defined $minidvodb_id ) { 225 215 226 216 my $command = "addtool -minidvodb_id $minidvodb_id"; 227 217 $command .= " -addminidvodbprocessed"; 228 218 $command .= " -fault $exit_code"; 229 $command .= " -mergedvodb_path $mergedvodbReal" if defined $mergedvodbReal;230 $command .= " -minidvodb_group $minidvodb_group";219 $command .= " -mergedvodb_path $mergedvodbReal" if defined $mergedvodbReal; 220 $command .= " -minidvodb_group $minidvodb_group"; 231 221 $command .= " -dtime_relphot $dtime_relphot" if defined $dtime_relphot; 232 222 $command .= " -dtime_relphot $dtime_resort" if defined $dtime_resort; 233 223 $command .= " -dtime_relphot $dtime_merge" if defined $dtime_merge; 234 224 $command .= " -dbname $dbname" if defined $dbname; 235 236 225 226 237 227 238 228 #print $command;
Note:
See TracChangeset
for help on using the changeset viewer.
