Changeset 34475 for trunk/ippScripts/scripts/publish_file.pl
- Timestamp:
- Sep 26, 2012, 3:23:03 PM (14 years ago)
- File:
-
- 1 edited
-
trunk/ippScripts/scripts/publish_file.pl (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippScripts/scripts/publish_file.pl
r30376 r34475 32 32 my $pubtool = can_run('pubtool') or (warn "Can't find pubtool" and $missing_tools = 1); 33 33 my $camtool = can_run('camtool') or (warn "Can't find camtool" and $missing_tools = 1); 34 my $regtool = can_run('regtool') or (warn "Can't find regtool" and $missing_tools = 1); 34 35 my $difftool = can_run('difftool') or (warn "Can't find difftool" and $missing_tools = 1); 35 36 my $ppMops = can_run('ppMops') or (warn "Can't find ppMops" and $missing_tools = 1); … … 44 45 my ( $pub_id, $camera, $stage, $stage_id, $fileset, $format, $product, $workdir, $need_magic ); 45 46 my ( $dbname, $verbose, $no_update, $no_op, $save_temps, $redirect ); 46 my ( $output_format );47 my ( $output_format, $difftype ); 47 48 48 49 GetOptions( … … 62 63 'redirect-output' => \$redirect, # Redirect output to log file? 63 64 'output_format=i' => \$output_format, # Output format for ppMops 65 'difftype=s' => \$difftype, # "WW" / "WS" / "SW" 64 66 ) or pod2usage( 2 ); 65 67 … … 195 197 $filename = $resolved; 196 198 199 my $cam_id = $comp->{cam_id_1}; 200 my $cam_command = "$camtool -processedexp -cam_id $cam_id"; 201 $cam_command .= " -dbname $dbname" if defined $dbname; 202 my ( $cam_success, $cam_error_code, $cam_full_buf, $cam_stdout_buf, $cam_stderr_buf ) = 203 run(command => $cam_command, verbose => $verbose); 204 &my_die( "Unable to retrieve filename", $pub_id, $PS_EXIT_SYS_ERROR) unless $cam_success; 205 my $cam_metadata = $mdcParser->parse(join "", @$cam_stdout_buf) or 206 &my_die("Unable to parse metadata config", $pub_id, $PS_EXIT_PROG_ERROR); 207 my $cam_components = parse_md_list($cam_metadata) or 208 &my_die("Unable to parse metadata list", $pub_id, $PS_EXIT_PROG_ERROR); 209 &my_die("More than one entry for cam_id $stage_id", $pub_id, $PS_EXIT_PROG_ERROR) if scalar @$cam_components > 1; 210 my $cam_comp = $$cam_components[0]; 211 212 my $exp_id = $comp->{exp_id_1}; 213 my $reg_command = "$regtool -processedimfile -exp_id $exp_id"; 214 $reg_command .= " -dbname $dbname" if defined $dbname; 215 my ( $reg_success, $reg_error_code, $reg_full_buf, $reg_stdout_buf, $reg_stderr_buf ) = 216 run(command => $reg_command, verbose => $verbose); 217 &my_die( "Unable to retrieve filename", $pub_id, $PS_EXIT_SYS_ERROR) unless $reg_success; 218 my $reg_metadata = $mdcParser->parse(join "", @$reg_stdout_buf) or 219 &my_die("Unable to parse metadata config", $pub_id, $PS_EXIT_PROG_ERROR); 220 my $reg_components = parse_md_list($reg_metadata) or 221 &my_die("Unable to parse metadata list", $pub_id, $PS_EXIT_PROG_ERROR); 222 my $reg_comp = $$reg_components[0]; 223 197 224 my $data = { zp => $zp, 198 225 zp_err => $comp->{zpt_stdev}, … … 207 234 output_format => $comp->{output_format}, 208 235 direction => 1, 236 comment => $reg_comp->{comment}, 237 obsmode => $reg_comp->{obs_mode}, 238 difftype => $difftype, 239 sky => $cam_comp->{bg}, 240 shutoutc => $comp->{dateobs}, 209 241 }; 210 242 … … 239 271 diff_id => $comp->{diff_id}, 240 272 direction => 0, 273 comment => $reg_comp->{comment}, 274 obsmode => $reg_comp->{obs_mode}, 275 difftype => $difftype, 276 sky => $cam_comp->{bg}, 277 shutoutc => $comp->{dateobs}, 241 278 }; 242 279 … … 288 325 &my_die( "Unable to register with data store", $pub_id, $PS_EXIT_SYS_ERROR) unless $success; 289 326 } 290 291 292 327 293 328 ### Pau. … … 311 346 $data->{diff_id} = $comp->{diff_id} unless defined $data->{diff_id}; 312 347 $data->{direction} = $comp->{direction} unless defined $data->{direction}; 348 $data->{comment} = $comp->{comment} unless defined $data->{comment}; 349 $data->{obsmode} = $comp->{obsmode} unless defined $data->{obsmode}; 350 $data->{difftype} = $comp->{difftype} unless defined $data->{difftype}; 351 $data->{sky} = $comp->{sky} unless defined $data->{sky}; 352 $data->{shutoutc} = $comp->{shutoutc} unless defined $data->{shutoutc}; 313 353 314 354 &my_die("zp value for $name doesn't match", $pub_id, $PS_EXIT_SYS_ERROR) if defined $data->{zp} and $comp->{zp} != $data->{zp}; … … 323 363 &my_die("diff_id value for $name doesn't match", $pub_id, $PS_EXIT_SYS_ERROR) if defined $data->{diff_id} and $comp->{diff_id} != $data->{diff_id}; 324 364 &my_die("direction value for $name doesn't match", $pub_id, $PS_EXIT_SYS_ERROR) if defined $data->{direction} and $comp->{direction} != $data->{direction}; 365 &my_die("comment value for $name doesn't match", $pub_id, $PS_EXIT_SYS_ERROR) if defined $data->{comment} and $comp->{comment} != $data->{comment}; 366 &my_die("obsmode value for $name doesn't match", $pub_id, $PS_EXIT_SYS_ERROR) if defined $data->{obsmode} and $comp->{obsmode} != $data->{obsmode}; 367 &my_die("difftype value for $name doesn't match", $pub_id, $PS_EXIT_SYS_ERROR) if defined $data->{difftype} and $comp->{difftype} != $data->{difftype}; 368 &my_die("sky value for $name doesn't match", $pub_id, $PS_EXIT_SYS_ERROR) if defined $data->{sky} and $comp->{sky} != $data->{sky}; 369 &my_die("shutoutc value for $name doesn't match", $pub_id, $PS_EXIT_SYS_ERROR) if defined $data->{shutoutc} and $comp->{shutoutc} != $data->{shutoutc}; 325 370 326 371 return 1; … … 350 395 $command .= " -astrom_rms " . $data->{astrom} if defined $data->{astrom}; 351 396 $command .= " -version " . $data->{output_format} if defined $data->{output_format}; 397 $command .= " -comment " . $data->{comment} if defined $data->{comment}; 398 $command .= " -obsmode " . $data->{obsmode} if defined $data->{obsmode}; 399 $command .= " -difftype " . $data->{difftype} if defined $data->{difftype}; 400 $command .= " -sky " . $data->{sky} if defined $data->{sky}; 401 $command .= " -shutoutc " . $data->{shutoutc} if defined $data->{shutoutc}; 352 402 353 403 unless ($no_op) {
Note:
See TracChangeset
for help on using the changeset viewer.
