Changeset 27718
- Timestamp:
- Apr 21, 2010, 11:35:15 AM (16 years ago)
- Location:
- trunk/ippScripts/scripts
- Files:
-
- 45 edited
-
addstar_run.pl (modified) (1 diff)
-
calibrate_dvo.pl (modified) (1 diff)
-
camera_exp.pl (modified) (1 diff)
-
chip_imfile.pl (modified) (1 diff)
-
detrend_correct_imfile.pl (modified) (1 diff)
-
detrend_norm_apply.pl (modified) (1 diff)
-
detrend_norm_calc.pl (modified) (2 diffs)
-
detrend_norm_exp.pl (modified) (1 diff)
-
detrend_process_exp.pl (modified) (1 diff)
-
detrend_process_imfile.pl (modified) (1 diff)
-
detrend_reject_exp.pl (modified) (1 diff)
-
detrend_resid_imfile.pl (modified) (1 diff)
-
detrend_stack.pl (modified) (1 diff)
-
diff_skycell.pl (modified) (1 diff)
-
dist_advancerun.pl (modified) (2 diffs)
-
dist_bundle.pl (modified) (7 diffs)
-
dist_cleanup.pl (modified) (1 diff)
-
dist_component.pl (modified) (1 diff)
-
dist_defineruns.pl (modified) (1 diff)
-
dist_make_fileset.pl (modified) (4 diffs)
-
dqstats_bundle.pl (modified) (6 diffs)
-
fake_imfile.pl (modified) (1 diff)
-
flatcorr_init.pl (modified) (9 diffs)
-
flatcorr_proc.pl (modified) (13 diffs)
-
ipp_detrend_combine.pl (modified) (8 diffs)
-
lossy_compress_imfile.pl (modified) (6 diffs)
-
magic_destreak.pl (modified) (1 diff)
-
magic_destreak_cleanup.pl (modified) (1 diff)
-
magic_destreak_defineruns.pl (modified) (1 diff)
-
magic_destreak_revert.pl (modified) (1 diff)
-
magic_process.pl (modified) (1 diff)
-
magic_tree.pl (modified) (1 diff)
-
publish_file.pl (modified) (1 diff)
-
rcserver_checkstatus.pl (modified) (1 diff)
-
receive_advance.pl (modified) (1 diff)
-
receive_file.pl (modified) (6 diffs)
-
receive_fileset.pl (modified) (1 diff)
-
receive_setstatus.pl (modified) (2 diffs)
-
receive_source.pl (modified) (1 diff)
-
register_exp.pl (modified) (1 diff)
-
register_imfile.pl (modified) (2 diffs)
-
stack_skycell.pl (modified) (1 diff)
-
tdl_generate.pl (modified) (2 diffs)
-
warp_overlap.pl (modified) (1 diff)
-
warp_skycell.pl (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippScripts/scripts/addstar_run.pl
r26112 r27718 8 8 use Sys::Hostname; 9 9 my $host = hostname(); 10 my $date = `date`; 10 11 print "\n\n"; 11 print "Starting script $0 on $host \n\n";12 print "Starting script $0 on $host at $date\n\n"; 12 13 13 14 use DateTime; -
trunk/ippScripts/scripts/calibrate_dvo.pl
r23186 r27718 8 8 use Sys::Hostname; 9 9 my $host = hostname(); 10 my $date = `date`; 10 11 print "\n\n"; 11 print "Starting script $0 on $host \n\n";12 print "Starting script $0 on $host at $date\n\n"; 12 13 13 14 use vars qw( $VERSION ); -
trunk/ippScripts/scripts/camera_exp.pl
r27555 r27718 8 8 use Sys::Hostname; 9 9 my $host = hostname(); 10 my $date = `date`; 10 11 print "\n\n"; 11 print "Starting script $0 on $host \n\n";12 print "Starting script $0 on $host at $date\n\n"; 12 13 13 14 use DateTime; -
trunk/ippScripts/scripts/chip_imfile.pl
r27180 r27718 8 8 use Sys::Hostname; 9 9 my $host = hostname(); 10 my $date = `date`; 10 11 print "\n\n"; 11 print "Starting script $0 on $host \n\n";12 print "Starting script $0 on $host at $date\n\n"; 12 13 13 14 use DateTime; -
trunk/ippScripts/scripts/detrend_correct_imfile.pl
r27180 r27718 8 8 use Sys::Hostname; 9 9 my $host = hostname(); 10 my $date = `date`; 10 11 print "\n\n"; 11 print "Starting script $0 on $host\n\n"; 12 print "command: @ARGV\n\n"; 12 print "Starting script $0 on $host at $date\n\n"; 13 13 14 14 use vars qw( $VERSION ); -
trunk/ippScripts/scripts/detrend_norm_apply.pl
r27180 r27718 8 8 use Sys::Hostname; 9 9 my $host = hostname(); 10 my $date = `date`; 10 11 print "\n\n"; 11 print "Starting script $0 on $host \n\n";12 print "Starting script $0 on $host at $date\n\n"; 12 13 13 14 use vars qw( $VERSION ); -
trunk/ippScripts/scripts/detrend_norm_calc.pl
r26514 r27718 8 8 use Sys::Hostname; 9 9 my $host = hostname(); 10 my $date = `date`; 10 11 print "\n\n"; 11 print "Starting script $0 on $host \n\n";12 print "Starting script $0 on $host at $date\n\n"; 12 13 13 14 use vars qw( $VERSION ); … … 56 57 57 58 # force det_type to be upper-case in this script 58 my$det_type = uc($det_type);59 $det_type = uc($det_type); 59 60 60 61 my $ipprc = PS::IPP::Config->new() or my_die( "Unable to set up", $det_id, $iter, $PS_EXIT_CONFIG_ERROR ); # IPP configuration -
trunk/ippScripts/scripts/detrend_norm_exp.pl
r27180 r27718 8 8 use Sys::Hostname; 9 9 my $host = hostname(); 10 my $date = `date`; 10 11 print "\n\n"; 11 print "Starting script $0 on $host \n\n";12 print "Starting script $0 on $host at $date\n\n"; 12 13 13 14 use vars qw( $VERSION ); -
trunk/ippScripts/scripts/detrend_process_exp.pl
r27180 r27718 8 8 use Sys::Hostname; 9 9 my $host = hostname(); 10 my $date = `date`; 10 11 print "\n\n"; 11 print "Starting script $0 on $host \n\n";12 print "Starting script $0 on $host at $date\n\n"; 12 13 13 14 use vars qw( $VERSION ); -
trunk/ippScripts/scripts/detrend_process_imfile.pl
r27180 r27718 8 8 use Sys::Hostname; 9 9 my $host = hostname(); 10 my $date = `date`; 10 11 print "\n\n"; 11 print "Starting script $0 on $host \n\n";12 print "Starting script $0 on $host at $date\n\n"; 12 13 13 14 use vars qw( $VERSION ); -
trunk/ippScripts/scripts/detrend_reject_exp.pl
r24764 r27718 8 8 use Sys::Hostname; 9 9 my $host = hostname(); 10 my $date = `date`; 10 11 print "\n\n"; 11 print "Starting script $0 on $host \n\n";12 print "Starting script $0 on $host at $date\n\n"; 12 13 13 14 use vars qw( $VERSION ); -
trunk/ippScripts/scripts/detrend_resid_imfile.pl
r27180 r27718 8 8 use Sys::Hostname; 9 9 my $host = hostname(); 10 my $date = `date`; 10 11 print "\n\n"; 11 print "Starting script $0 on $host \n\n";12 print "Starting script $0 on $host at $date\n\n"; 12 13 13 14 use vars qw( $VERSION ); -
trunk/ippScripts/scripts/detrend_stack.pl
r27180 r27718 8 8 use Sys::Hostname; 9 9 my $host = hostname(); 10 my $date = `date`; 10 11 print "\n\n"; 11 print "Starting script $0 on $host \n\n";12 print "Starting script $0 on $host at $date\n\n"; 12 13 13 14 use vars qw( $VERSION ); -
trunk/ippScripts/scripts/diff_skycell.pl
r27596 r27718 7 7 use Sys::Hostname; 8 8 my $host = hostname(); 9 my $date = `date`; 9 10 print "\n\n"; 10 print "Starting script $0 on $host \n\n";11 print "Starting script $0 on $host at $date\n\n"; 11 12 12 13 use DateTime; -
trunk/ippScripts/scripts/dist_advancerun.pl
r27016 r27718 8 8 use Sys::Hostname; 9 9 my $host = hostname(); 10 my $date = `date`; 10 11 print "\n\n"; 11 print "Starting script $0 on $host \n\n";12 print "Starting script $0 on $host at $date\n\n"; 12 13 13 14 use vars qw( $VERSION ); … … 174 175 } 175 176 &my_die("unable to find path", $dist_id, $PS_EXIT_UNKNOWN_ERROR) if !$path; 176 my $component_dir = find_componentdir($destdir, $path); 177 my $component_dir = find_componentdir($destdir, $path); 177 178 # print MANIFEST "$component METADATA\n"; 178 179 print MANIFEST "\t" , "$component", "\tSTR\t", $component_dir, "\n"; 179 180 } 180 181 print MANIFEST "END\n\n"; 181 close MANIFEST or 182 close MANIFEST or 182 183 &my_die("Unable to close dirinfo file $dirinfo", $dist_id, $PS_EXIT_UNKNOWN_ERROR); 183 184 } -
trunk/ippScripts/scripts/dist_bundle.pl
r27449 r27718 8 8 use Sys::Hostname; 9 9 my $host = hostname(); 10 my $date = `date`; 10 11 # print "\n\n"; 11 # print "Starting script $0 on $host \n\n";12 # print "Starting script $0 on $host at $date\n\n"; 12 13 13 14 use vars qw( $VERSION ); … … 115 116 116 117 # Get the list of data products for this component 117 # note: We my_die in get_file_list if something goes wrong. 118 # note: We my_die in get_file_list if something goes wrong. 118 119 119 120 my $file_list = get_file_list($stage, $component, $path_base, $clean); … … 193 194 $num_files++; 194 195 if ($image_type && $nan_masked_pixels) { 195 # save the 196 # save the 196 197 if ($image_type eq 'image') { 197 198 $image = $file_name; … … 222 223 # One last check as to whether magic has been applied to the inputs 223 224 224 # Note: the sql for disttool -pendingcomponent won't select a component that 225 # Note: the sql for disttool -pendingcomponent won't select a component that 225 226 # requires magic and hasn't been magicked, but we check again here 226 227 … … 327 328 ### Pau. 328 329 329 # return the image type (image, mask, or variance) if this file rule refers to 330 # return the image type (image, mask, or variance) if this file rule refers to 330 331 # one of the big fits files that are not included in a clean distribution 331 332 sub get_image_type { … … 360 361 sub open_with_retries { 361 362 my $name = shift; 362 363 363 364 my $tries = 1; 364 365 my $max_tries = 5; … … 372 373 } 373 374 } 374 375 375 376 &my_die("failed to open $name after $max_tries tries\n", $component, 376 377 $PS_EXIT_DATA_ERROR) if (!$opened); -
trunk/ippScripts/scripts/dist_cleanup.pl
r26096 r27718 8 8 use Sys::Hostname; 9 9 my $host = hostname(); 10 my $date = `date`; 10 11 print "\n\n"; 11 print "Starting script $0 on $host \n\n";12 print "Starting script $0 on $host at $date\n\n"; 12 13 13 14 use vars qw( $VERSION ); -
trunk/ippScripts/scripts/dist_component.pl
r27449 r27718 8 8 use Sys::Hostname; 9 9 my $host = hostname(); 10 my $date = `date`; 10 11 print "\n\n"; 11 print "Starting script $0 on $host \n\n";12 print "Starting script $0 on $host at $date\n\n"; 12 13 13 14 use vars qw( $VERSION ); -
trunk/ippScripts/scripts/dist_defineruns.pl
r26998 r27718 11 11 use Sys::Hostname; 12 12 my $host = hostname(); 13 my $date = `date`; 13 14 print "\n\n"; 14 print "Starting script $0 on $host \n\n";15 print "Starting script $0 on $host at $date\n\n"; 15 16 16 17 use vars qw( $VERSION ); -
trunk/ippScripts/scripts/dist_make_fileset.pl
r27014 r27718 8 8 use Sys::Hostname; 9 9 my $host = hostname(); 10 my $date = `date`; 10 11 print "\n\n"; 11 print "Starting script $0 on $host \n\n";12 print "Starting script $0 on $host at $date\n\n"; 12 13 13 14 use vars qw( $VERSION ); … … 46 47 'dist_id=s' => \$dist_id, # distribution run identifier 47 48 'dist_dir=s' => \$dist_dir, # directory containing dist run outputs 48 'target_id=s' => \$target_id, # 49 'target_id=s' => \$target_id, # 49 50 'stage=s' => \$stage, # raw, chip, camera, fake, warp, stack, or diff 50 51 'stage_id=s' => \$stage_id, # exp_id, chip_id, etc. … … 209 210 my $dsn = "DBI:mysql:host=$dbserver;database=$dbname"; 210 211 211 my $dbh = DBI->connect($dsn, $dbuser, $dbpassword) 212 my $dbh = DBI->connect($dsn, $dbuser, $dbpassword) 212 213 or die "Cannot connect to database.\n"; 213 214 … … 227 228 228 229 # 229 # we are a long ways away from the rawExp in the pipeline. Rather than do some 230 # we are a long ways away from the rawExp in the pipeline. Rather than do some 230 231 # very long joins in disttool, we look up the exp_name in the database using DBI 231 232 # 232 233 my $dbh = getDBHandle($ipprc, $dbname); 233 234 234 my $query; 235 my $query; 235 236 236 237 if ($stage eq 'raw') { -
trunk/ippScripts/scripts/dqstats_bundle.pl
r27308 r27718 8 8 use Sys::Hostname; 9 9 my $host = hostname(); 10 my $date = `date`; 10 11 print "\n\n"; 11 print "Starting script $0 on $host \n\n";12 print "Starting script $0 on $host at $date\n\n"; 12 13 13 14 use DateTime; … … 37 38 my ( $dqstats_id, $camera, $uri, $dbname, $verbose, $no_update, $no_op, $redirect, $save_temps); 38 39 GetOptions( 39 'dqstats_id=s' => \$dqstats_id, # dqstatsrun ID40 'camera|c=s' => \$camera, # camera41 'dbname|d=s' => \$dbname, # database name42 'uri=s' => \$uri, # output file destination43 'verbose' => \$verbose, # print to stdout44 'no-update' => \$no_update, # Update the database45 'no-op' => \$no_op, # don't do the operations46 'redirect-output' => \$redirect, 47 'save-temps' => \$save_temps, # save temporary files48 ) or pod2usage( 2 );40 'dqstats_id=s' => \$dqstats_id, # dqstatsrun ID 41 'camera|c=s' => \$camera, # camera 42 'dbname|d=s' => \$dbname, # database name 43 'uri=s' => \$uri, # output file destination 44 'verbose' => \$verbose, # print to stdout 45 'no-update' => \$no_update, # Update the database 46 'no-op' => \$no_op, # don't do the operations 47 'redirect-output' => \$redirect, 48 'save-temps' => \$save_temps, # save temporary files 49 ) or pod2usage( 2 ); 49 50 50 51 pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV; 51 52 pod2usage( -msg => "Required options --dqstats_id --camera", 52 -exitval => 3,53 ) unless53 -exitval => 3, 54 ) unless 54 55 defined $dqstats_id and 55 56 defined $camera; 56 57 57 my $ipprc = PS::IPP::Config->new( $camera ) 58 my $ipprc = PS::IPP::Config->new( $camera ) 58 59 or my_die( "Unable to set up", $dqstats_id, $PS_EXIT_CONFIG_ERROR ); # IPP config 59 #my $logDest = $ipprc->filename("LOG.EXP", $uri) 60 #my $logDest = $ipprc->filename("LOG.EXP", $uri) 60 61 # or my_die("Missing entry from camera config", $dqstats_id, $PS_EXIT_CONFIG_ERROR); 61 62 62 63 if ($redirect) { 63 # $ipprc->redirect_output($logDest) 64 # or my_die( "Unable to redirect output", $dqstats_id, $PS_EXIT_SYS_ERROR );64 # $ipprc->redirect_output($logDest) 65 # or my_die( "Unable to redirect output", $dqstats_id, $PS_EXIT_SYS_ERROR ); 65 66 print "\n\n"; 66 67 print "Starting script $0 on $host\n\n"; … … 84 85 unless ($no_op) { 85 86 # This bit needs to make the bundle. 86 87 87 88 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 88 run(command => $bundle_command, verbose => $verbose);89 run(command => $bundle_command, verbose => $verbose); 89 90 unless ($success) { 90 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);91 &my_die("Unable to create the bundle.: $error_code", $dqstats_id, $error_code);91 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 92 &my_die("Unable to create the bundle.: $error_code", $dqstats_id, $error_code); 92 93 } 93 94 94 95 # Parse stdout_buf to get output file name 95 96 ## Begin partial 96 97 my ($tempFile, $tempName) = tempfile( "/tmp/dqstats.XXXX", 97 UNLINK => !$save_temps, SUFFIX => 'dsin' );98 UNLINK => !$save_temps, SUFFIX => 'dsin' ); 98 99 print $tempFile $uri . '|||notset' . "\n"; 99 100 … … 102 103 # It can't be that simple, can it? This should probably add a fault on failure. 103 104 ($success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 104 run(command => $register_cmd, verbose => $verbose);105 run(command => $register_cmd, verbose => $verbose); 105 106 unless ($success) { 106 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);107 &my_die("Unable to register the bundle.: $error_code", $dqstats_id, $error_code);107 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 108 &my_die("Unable to register the bundle.: $error_code", $dqstats_id, $error_code); 108 109 } 109 110 110 111 # We no longer need the file generated by dqstatstool. 111 112 unlink($uri); … … 118 119 # This bit needs to set the database state to full 119 120 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 120 run(command => $update_command, verbose => $verbose);121 run(command => $update_command, verbose => $verbose); 121 122 unless ($success) { 122 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);123 warn("Unable to add result to database: $error_code\n");124 exit($error_code);123 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 124 warn("Unable to add result to database: $error_code\n"); 125 exit($error_code); 125 126 } 126 127 } else { … … 139 140 carp($msg); 140 141 if (defined $dqstats_id and not $no_update) { 141 # There is no fault handling, which may be a mistake. This is where a fault coding would be.142 # There is no fault handling, which may be a mistake. This is where a fault coding would be. 142 143 # my $command = "$addtool -add_id $add_id"; 143 144 # $command .= " -addprocessedexp"; -
trunk/ippScripts/scripts/fake_imfile.pl
r23688 r27718 24 24 use Sys::Hostname; 25 25 my $host = hostname(); 26 my $date = `date`; 26 27 print "\n\n"; 27 print "Starting script $0 on $host \n\n";28 print "Starting script $0 on $host at $date\n\n"; 28 29 29 30 use DateTime; -
trunk/ippScripts/scripts/flatcorr_init.pl
r20100 r27718 1 1 #!/usr/bin/env perl 2 2 3 ## USAGE:flatcorr_init.pl 3 ## USAGE:flatcorr_init.pl 4 4 ## given dbname, dvodb, filter, time range, camera, telescope, etc? 5 5 ## select matching images and register as a new flatcorr run … … 24 24 use Sys::Hostname; 25 25 my $host = hostname(); 26 my $date = `date`; 26 27 print "\n\n"; 27 print "Starting script $0 on $host \n\n";28 print "Starting script $0 on $host at $date\n\n"; 28 29 29 30 use vars qw( $VERSION ); … … 68 69 my $caltool = can_run('caltool') or (warn "Can't find caltool" and $missing_tools = 1); 69 70 70 if ($missing_tools) { 71 if ($missing_tools) { 71 72 warn ("Can't find required tools"); 72 exit($PS_EXIT_CONFIG_ERROR); 73 exit($PS_EXIT_CONFIG_ERROR); 73 74 } 74 75 … … 90 91 cache_run(command => $command, verbose => 1); 91 92 92 unless ($success) { 93 unless ($success) { 93 94 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 94 95 &my_die ("Unable to perform addstar -resort on region $region: $error_code", $dvo_id, $region, "RESORT", $status, $dbname); … … 99 100 { 100 101 foreach my $filter (@filters) { 101 my $command = "$relphot $filter";102 $command .= "-D CATDIR $catdir";103 $command .= "-region $RAs $RAe $DECs $DECe";104 105 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =106 cache_run(command => $command, verbose => 1);107 108 unless ($success) { 109 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);110 &my_die ("Unable to perform addstar -resort on region $region: $error_code", $dvo_id, $region, "RELPHOT", $status, $dbname);111 }102 my $command = "$relphot $filter"; 103 $command .= "-D CATDIR $catdir"; 104 $command .= "-region $RAs $RAe $DECs $DECe"; 105 106 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 107 cache_run(command => $command, verbose => 1); 108 109 unless ($success) { 110 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 111 &my_die ("Unable to perform addstar -resort on region $region: $error_code", $dvo_id, $region, "RELPHOT", $status, $dbname); 112 } 112 113 } 113 114 } … … 117 118 if (0) { 118 119 foreach my $filter (@filters) { 119 my $command = "$uniphot $filter";120 $command .= "-D CATDIR $catdir";121 $command .= "-region $RAs $RAe $DECs $DECe";122 123 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =124 cache_run(command => $command, verbose => 1);125 126 unless ($success) { 127 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);128 &my_die ("Unable to perform addstar -resort on region $region: $error_code", $dvo_id, $region, "UNIPHOT", $status, $dbname);129 }120 my $command = "$uniphot $filter"; 121 $command .= "-D CATDIR $catdir"; 122 $command .= "-region $RAs $RAe $DECs $DECe"; 123 124 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 125 cache_run(command => $command, verbose => 1); 126 127 unless ($success) { 128 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 129 &my_die ("Unable to perform addstar -resort on region $region: $error_code", $dvo_id, $region, "UNIPHOT", $status, $dbname); 130 } 130 131 } 131 132 } … … 137 138 138 139 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 139 cache_run(command => $command, verbose => 1);140 141 unless ($success) { 142 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);143 &my_die ("Unable to perform addstar -resort on region $region: $error_code", $dvo_id, $region, "RELASTRO.OBJECTS", $status, $dbname);140 cache_run(command => $command, verbose => 1); 141 142 unless ($success) { 143 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 144 &my_die ("Unable to perform addstar -resort on region $region: $error_code", $dvo_id, $region, "RELASTRO.OBJECTS", $status, $dbname); 144 145 } 145 146 } … … 151 152 152 153 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 153 cache_run(command => $command, verbose => 1);154 155 unless ($success) { 156 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);157 &my_die ("Unable to perform addstar -resort on region $region: $error_code", $dvo_id, $region, "RELASTRO.IMAGES", $status, $dbname);154 cache_run(command => $command, verbose => 1); 155 156 unless ($success) { 157 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 158 &my_die ("Unable to perform addstar -resort on region $region: $error_code", $dvo_id, $region, "RELASTRO.IMAGES", $status, $dbname); 158 159 } 159 160 } … … 185 186 my $region = shift; 186 187 my $last_step = shift; 187 my $status = shift;188 my $dbname = shift;188 my $status = shift; 189 my $dbname = shift; 189 190 190 191 carp($msg); 191 192 if (defined $dvo_id && defined $region && defined $last_step && defined $status and not $no_update) { 192 193 my $command = "$caltool -addcalrun"; 193 $command .= " -dvo_id $dvo_id";194 $command .= " -dvo_id $dvo_id"; 194 195 $command .= " -region $region"; 195 $command .= " -last_step $last_step";196 $command .= " -status $status";196 $command .= " -last_step $last_step"; 197 $command .= " -status $status"; 197 198 $command .= " -dbname $dbname" if defined $dbname; 198 199 system ($command); -
trunk/ippScripts/scripts/flatcorr_proc.pl
r25916 r27718 11 11 # dvoMakeCorr -file outgrid.fits -ref ref.fits outcorr 12 12 13 # dettool -register -det_type FLATCORR -filelevel (level) -workdir -inst, etc 14 15 # foreach $imfile () 13 # dettool -register -det_type FLATCORR -filelevel (level) -workdir -inst, etc 14 15 # foreach $imfile () 16 16 # dettool -register_imfile -uri, etc, etc 17 17 … … 23 23 use Sys::Hostname; 24 24 my $host = hostname(); 25 my $date = `date`; 25 26 print "\n\n"; 26 print "Starting script $0 on $host \n\n";27 print "Starting script $0 on $host at $date\n\n"; 27 28 28 29 use vars qw( $VERSION ); … … 74 75 my $addstar = can_run('addstar') or (warn "Can't find addstar" and $missing_tools = 1); 75 76 my $dvoMakeCorr = can_run('dvoMakeCorr') or (warn "Can't find dvoMakeCorr" and $missing_tools = 1); 76 my $detselect = can_run('detselect') or (warn "Can't find detselect" and $missing_tools = 1);77 my $dettool = can_run('dettool') or (warn "Can't find dettool" and $missing_tools = 1);78 my $flatcorr = can_run('flatcorr') or (warn "Can't find flatcorr" and $missing_tools = 1);79 80 if ($missing_tools) { 77 my $detselect = can_run('detselect') or (warn "Can't find detselect" and $missing_tools = 1); 78 my $dettool = can_run('dettool') or (warn "Can't find dettool" and $missing_tools = 1); 79 my $flatcorr = can_run('flatcorr') or (warn "Can't find flatcorr" and $missing_tools = 1); 80 81 if ($missing_tools) { 81 82 warn ("Can't find required tools"); 82 exit($PS_EXIT_CONFIG_ERROR); 83 exit($PS_EXIT_CONFIG_ERROR); 83 84 } 84 85 … … 95 96 $ipprc->outroot_prepare($outcorr); 96 97 97 if (not -e "$dvodb/flatcorr") { 98 if (not -e "$dvodb/flatcorr") { 98 99 mkdir "$dvodb/flatcorr" or &my_die ("Unable to make output directory for relphot $dvodb/flatcorr", $corr_id, 3); 99 100 } … … 104 105 my ($DECs, $DECe) = split (",", $coords[1]); 105 106 106 # Run addstar -resort to ensure the db is indexed 107 # Run addstar -resort to ensure the db is indexed 107 108 # XXX addstar should be able to recognize and skip indexed tables 108 109 { 109 my $command = "$addstar -resort"; 110 my $command = "$addstar -resort"; 110 111 $command .= " -D CATDIR $dvodb"; 111 112 $command .= " -region $RAs $RAe $DECs $DECe"; 112 113 113 114 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 114 run(command => $command, verbose => $verbose);115 116 unless ($success) { 117 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);118 &my_die ("Unable to perform addstar -resort for dvodb $dvodb on region $region: $error_code", $corr_id, $error_code);115 run(command => $command, verbose => $verbose); 116 117 unless ($success) { 118 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 119 &my_die ("Unable to perform addstar -resort for dvodb $dvodb on region $region: $error_code", $corr_id, $error_code); 119 120 } 120 121 } … … 135 136 136 137 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 137 run(command => $command, verbose => $verbose);138 139 unless ($success) { 140 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);141 &my_die ("Unable to perform relphot -grid for dvodb $dvodb on region $region: $error_code", $corr_id, $error_code);138 run(command => $command, verbose => $verbose); 139 140 unless ($success) { 141 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 142 &my_die ("Unable to perform relphot -grid for dvodb $dvodb on region $region: $error_code", $corr_id, $error_code); 142 143 } 143 144 } … … 176 177 177 178 # Push the results into the database 178 { 179 { 179 180 my $command = "$flatcorr -addprocess"; 180 181 $command .= " -corr_id $corr_id"; … … 184 185 unless ($no_update) { 185 186 186 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =187 run(command => $command, verbose => $verbose);188 unless ($success) {189 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);190 warn ("Unable to perform regtool -addprocessedimfile: $error_code");191 exit($error_code);192 }187 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 188 run(command => $command, verbose => $verbose); 189 unless ($success) { 190 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 191 warn ("Unable to perform regtool -addprocessedimfile: $error_code"); 192 exit($error_code); 193 } 193 194 } else { 194 print "skipping command: $command\n";195 print "skipping command: $command\n"; 195 196 } 196 197 } … … 218 219 &my_die("Unable to parse metadata list", $corr_id, $PS_EXIT_PROG_ERROR); 219 220 220 # check for existence 221 # check for existence 221 222 my $file = $$files[0]; 222 223 my $chip_id = $file->{chip_id}; … … 228 229 # flatcorr -inputimfile -chip_id $chip_id 229 230 sub get_imfiles { 230 my $chip_id = shift; 231 my $chip_id = shift; 231 232 232 233 my $command = "$flatcorr -inputimfile"; … … 273 274 274 275 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 275 run(command => $command, verbose => $verbose);276 277 unless ($success) { 278 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);279 &my_die ("Unable to register new detrend: $error_code", $corr_id, $PS_EXIT_PROG_ERROR);276 run(command => $command, verbose => $verbose); 277 278 unless ($success) { 279 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 280 &my_die ("Unable to register new detrend: $error_code", $corr_id, $PS_EXIT_PROG_ERROR); 280 281 } 281 282 … … 298 299 299 300 foreach my $file (@$files) { 300 # create the detrend correction for the imfiles based on the input imfiles301 my $reffile = $file->{uri};302 my $class_id = $file->{class_id};303 304 my $uri = $ipprc->filename("DVOCORR.OUTPUT", $outcorr, $class_id);305 unless ($uri) {306 &my_die ("Unable to find DVOCORR.OUTPUT in filerules", $corr_id, $PS_EXIT_PROG_ERROR);307 }308 309 my $command = "$dvoMakeCorr $outcorr";310 $command .= " -file $outgrid.fits";311 $command .= " -ref $reffile";312 313 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =314 run(command => $command, verbose => $verbose);315 316 unless ($success) { 317 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);318 &my_die ("Unable to perform dvoMakeCorr: $error_code", $corr_id, $PS_EXIT_PROG_ERROR);319 }320 321 # register the detrend correction imfile322 $command = "$dettool -register_detrend_imfile";323 $command .= " -det_id $det_id";324 $command .= " -class_id $class_id";325 $command .= " -uri $uri";326 $command .= " -dbname $dbname" if defined $dbname;327 328 ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =329 run(command => $command, verbose => $verbose);330 331 unless ($success) { 332 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);333 &my_die ("Unable to register new detrend: $error_code", $corr_id, $PS_EXIT_PROG_ERROR);334 }301 # create the detrend correction for the imfiles based on the input imfiles 302 my $reffile = $file->{uri}; 303 my $class_id = $file->{class_id}; 304 305 my $uri = $ipprc->filename("DVOCORR.OUTPUT", $outcorr, $class_id); 306 unless ($uri) { 307 &my_die ("Unable to find DVOCORR.OUTPUT in filerules", $corr_id, $PS_EXIT_PROG_ERROR); 308 } 309 310 my $command = "$dvoMakeCorr $outcorr"; 311 $command .= " -file $outgrid.fits"; 312 $command .= " -ref $reffile"; 313 314 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 315 run(command => $command, verbose => $verbose); 316 317 unless ($success) { 318 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 319 &my_die ("Unable to perform dvoMakeCorr: $error_code", $corr_id, $PS_EXIT_PROG_ERROR); 320 } 321 322 # register the detrend correction imfile 323 $command = "$dettool -register_detrend_imfile"; 324 $command .= " -det_id $det_id"; 325 $command .= " -class_id $class_id"; 326 $command .= " -uri $uri"; 327 $command .= " -dbname $dbname" if defined $dbname; 328 329 ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 330 run(command => $command, verbose => $verbose); 331 332 unless ($success) { 333 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 334 &my_die ("Unable to register new detrend: $error_code", $corr_id, $PS_EXIT_PROG_ERROR); 335 } 335 336 } 336 337 } … … 345 346 if (not $no_update) { 346 347 my $command = "$flatcorr -addprocess"; 347 $command .= " -corr_id $corr_id";348 $command .= " -corr_id $corr_id"; 348 349 $command .= " -fault $exit_code"; 349 350 $command .= " -hostname $host" if defined $host; -
trunk/ippScripts/scripts/ipp_detrend_combine.pl
r17671 r27718 7 7 use Sys::Hostname; 8 8 my $host = hostname(); 9 my $date = `date`; 9 10 print "\n\n"; 10 print "Starting script $0 on $host \n\n";11 print "Starting script $0 on $host at $date\n\n"; 11 12 12 13 use vars qw( $VERSION ); … … 32 33 $workdir, $dbname, $no_update); 33 34 GetOptions( 34 'det_type=s' => \$det_type, # Detrend type for new detrend35 'filelevel=s' => \$filelevel, # File level for new detrend36 'inst=s' => \$inst, # Instrument for new detrend37 'telescope=s' => \$telescope, # Telescope for new detrend38 'filter=s' => \$filter,# Filter name for new detrend39 'det_id1=s'=> \$det_id1, # Detrend id for detrend 140 'iteration1=s' => \$iter1, # Iteration for detrend 141 'det_id2=s'=> \$det_id2, # Detrend id for detrend 242 'iteration2=s' => \$iter2, # Iteration for detrend 243 'operation=s' => \$operation, # Operation to perform on files44 'mask' => \$mask, # Operation is on a mask45 'workdir=s' => \$workdir, # Working directory for output files46 'dbname=s' => \$dbname,# Database name47 'no-update' => \$no_update, # Don't update the database48 ) or pod2usage( 2 );35 'det_type=s' => \$det_type, # Detrend type for new detrend 36 'filelevel=s' => \$filelevel, # File level for new detrend 37 'inst=s' => \$inst, # Instrument for new detrend 38 'telescope=s' => \$telescope, # Telescope for new detrend 39 'filter=s' => \$filter, # Filter name for new detrend 40 'det_id1=s' => \$det_id1, # Detrend id for detrend 1 41 'iteration1=s' => \$iter1, # Iteration for detrend 1 42 'det_id2=s' => \$det_id2, # Detrend id for detrend 2 43 'iteration2=s' => \$iter2, # Iteration for detrend 2 44 'operation=s' => \$operation, # Operation to perform on files 45 'mask' => \$mask, # Operation is on a mask 46 'workdir=s' => \$workdir, # Working directory for output files 47 'dbname=s' => \$dbname, # Database name 48 'no-update' => \$no_update, # Don't update the database 49 ) or pod2usage( 2 ); 49 50 50 51 pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV; 51 52 pod2usage( -msg => "Required options --det_type --filelevel --inst --telescope --det_id1 --iteration1 --det_id2 --iteration2 --workdir", 52 -exitval => 3,53 )53 -exitval => 3, 54 ) 54 55 unless defined $det_type 55 56 and defined $filelevel … … 65 66 $ipprc->define_camera($inst); 66 67 67 my $STATS = 68 [ 68 my $STATS = 69 [ 69 70 # PPSTATS KEYWORD STATISTIC CHIPTOOL FLAG 70 71 { name => "ROBUST_MEDIAN", type => "mean", flag => "-bg", dtype => "float" }, … … 90 91 die("File lists for detrends have differing lengths") unless scalar keys %$files1 == scalar keys %$files2; 91 92 92 my ($det_id, $iter); # Detrend identifier for the new detrend93 my ($det_id, $iter); # Detrend identifier for the new detrend 93 94 unless ($no_update) { 94 95 my $command = "$dettool -register_detrend -det_type $det_type -filelevel $filelevel -workdir $workdir " . 95 "-inst $inst -telescope $telescope"; # Command to run96 "-inst $inst -telescope $telescope"; # Command to run 96 97 $command .= " -filter $filter" if defined $filter; 97 98 $command .= " -dbname $dbname" if defined $dbname; 98 99 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 99 run(command => $command, verbose => 1);100 run(command => $command, verbose => 1); 100 101 unless ($success) { 101 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);102 die("Unable to run dettool -register_detrend: $error_code");102 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 103 die("Unable to run dettool -register_detrend: $error_code"); 103 104 } 104 105 … … 137 138 $command .= " -dbname $dbname" if defined $dbname; 138 139 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 139 run(command => $command, verbose => 1);140 run(command => $command, verbose => 1); 140 141 unless ($success) { 141 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);142 die("Unable to run ppArith: $error_code");142 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 143 die("Unable to run ppArith: $error_code"); 143 144 } 144 145 … … 149 150 my $stats = PS::IPP::Metadata::Stats->new($STATS); # Stats parser 150 151 { 151 my $statsFile;# File handle152 open $statsFile, $ipprc->file_resolve($outStats) or die("Can't open stats file $outStats: $!");153 my @contents = <$statsFile>; # Contents of file154 close $statsFile;155 156 my $metadata = $mdcParser->parse(join "", @contents) or die("Unable to parse metadata config doc");157 158 unless ($stats->parse($metadata)) {159 &my_die("Failure extracting metadata from the statistics output file.\n");160 }152 my $statsFile; # File handle 153 open $statsFile, $ipprc->file_resolve($outStats) or die("Can't open stats file $outStats: $!"); 154 my @contents = <$statsFile>; # Contents of file 155 close $statsFile; 156 157 my $metadata = $mdcParser->parse(join "", @contents) or die("Unable to parse metadata config doc"); 158 159 unless ($stats->parse($metadata)) { 160 &my_die("Failure extracting metadata from the statistics output file.\n"); 161 } 161 162 } 162 163 163 164 # Register the imfile 164 165 unless ($no_update) { 165 my $command = "$dettool -register_detrend_imfile -det_id $det_id "; # Command to run166 $command .= " -class_id $class_id -uri $outName -path_base $outRoot";167 $command .= $stats->cmdflags();168 $command .= " -dbname $dbname" if defined $dbname;169 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =170 run(command => $command, verbose => 1);171 unless ($success) {172 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);173 die("Unable to run dettool -register_detrend_imfile: $error_code");174 }166 my $command = "$dettool -register_detrend_imfile -det_id $det_id "; # Command to run 167 $command .= " -class_id $class_id -uri $outName -path_base $outRoot"; 168 $command .= $stats->cmdflags(); 169 $command .= " -dbname $dbname" if defined $dbname; 170 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 171 run(command => $command, verbose => 1); 172 unless ($success) { 173 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 174 die("Unable to run dettool -register_detrend_imfile: $error_code"); 175 } 175 176 } 176 177 } … … 183 184 sub filelist 184 185 { 185 my $det_id = shift; # Detrend identifier186 my $iter = shift; # Iteration186 my $det_id = shift; # Detrend identifier 187 my $iter = shift; # Iteration 187 188 188 189 my $command = "$detselect -select -det_id $det_id -iteration $iter"; # Command to run 189 190 $command .= " -dbname $dbname" if defined $dbname; 190 191 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 191 run(command => $command, verbose => 1);192 run(command => $command, verbose => 1); 192 193 unless ($success) { 193 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);194 die("Unable to run detselect: $error_code");194 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 195 die("Unable to run detselect: $error_code"); 195 196 } 196 197 … … 202 203 203 204 foreach my $item ( @$list ) { 204 my $class_id = $item->{class_id};205 die("Multiple definitions of class_id=$class_id found for det_id=$det_id, iteration=$iter\n") if206 defined $files{$class_id};207 $files{$class_id} = parse_md_list($md);205 my $class_id = $item->{class_id}; 206 die("Multiple definitions of class_id=$class_id found for det_id=$det_id, iteration=$iter\n") if 207 defined $files{$class_id}; 208 $files{$class_id} = parse_md_list($md); 208 209 } 209 210 -
trunk/ippScripts/scripts/lossy_compress_imfile.pl
r27193 r27718 8 8 use Sys::Hostname; 9 9 my $host = hostname(); 10 my $date = `date`; 10 11 print "\n\n"; 11 print "Starting script $0 on $host \n\n";12 print "Starting script $0 on $host at $date\n\n"; 12 13 13 14 use vars qw( $VERSION ); … … 86 87 if ($state eq 'goto_compressed') { 87 88 # Find the actual filename for this run: 88 &my_die("Couldn't find input file: $uri\n", $exp_id,$exp_name,$class_id,$uri,$PS_EXIT_SYS_ERROR) 89 unless ($ipprc->file_exists($uri));89 &my_die("Couldn't find input file: $uri\n", $exp_id,$exp_name,$class_id,$uri,$PS_EXIT_SYS_ERROR) 90 unless ($ipprc->file_exists($uri)); 90 91 my $uriReal = $ipprc->file_resolve( $uri ); 91 92 92 93 # Create a compressed version: 93 94 my $compUri = $uri . ".fz"; 94 &my_die("Output compressed file already exists: $compUri\n", $exp_id,$exp_name,$class_id,$uri,$PS_EXIT_SYS_ERROR) 95 if ($ipprc->file_exists($compUri));95 &my_die("Output compressed file already exists: $compUri\n", $exp_id,$exp_name,$class_id,$uri,$PS_EXIT_SYS_ERROR) 96 if ($ipprc->file_exists($compUri)); 96 97 my $compReal= $ipprc->file_resolve( $compUri, 'create'); 97 98 # Apparently we need to funpack before fpacking. Probably should have realized that beforehand. 98 99 my $tempfile = new File::Temp ( TEMPLATE => "${exp_name}.XXXX", 99 DIR => '/tmp/',100 UNLINK => !$save_temps,101 SUFFIX => '.fits');100 DIR => '/tmp/', 101 UNLINK => !$save_temps, 102 SUFFIX => '.fits'); 102 103 my $tempReal = $tempfile->filename; 103 104 104 105 my $uncompress_command = "$funpack -S $uriReal > $tempReal"; 105 106 my ($success, $error_code, $full_buf, $stdout_buf, $stderr_buf) = 106 run(command => $uncompress_command, verbose => $verbose);107 run(command => $uncompress_command, verbose => $verbose); 107 108 unless ($success) { 108 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);109 &my_die("Unable to uncompress file: $uri -> $compUri: $error_code", 110 $exp_id,$exp_name,$class_id,$uri, $PS_EXIT_SYS_ERROR);109 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 110 &my_die("Unable to uncompress file: $uri -> $compUri: $error_code", 111 $exp_id,$exp_name,$class_id,$uri, $PS_EXIT_SYS_ERROR); 111 112 } 112 113 my $compress_command = "$fpack -h -s 8 -S $tempReal > $compReal"; 113 114 print STDERR "$compReal $uriReal $compress_command\n"; 114 115 ($success, $error_code, $full_buf, $stdout_buf, $stderr_buf) = 115 run(command => $compress_command, verbose => $verbose);116 run(command => $compress_command, verbose => $verbose); 116 117 unless ($success) { 117 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);118 &my_die("Unable to compress file: $uri -> $compUri: $error_code", 119 $exp_id,$exp_name,$class_id,$uri, $PS_EXIT_SYS_ERROR);118 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 119 &my_die("Unable to compress file: $uri -> $compUri: $error_code", 120 $exp_id,$exp_name,$class_id,$uri, $PS_EXIT_SYS_ERROR); 120 121 } 121 122 my $database_command = "$regtool -updateprocessedimfile -exp_id $exp_id -class_id $class_id -set_state compressed"; … … 123 124 124 125 &my_die("Expected output compressed file not found: $compUri\n", $exp_id,$exp_name,$class_id, $uri,$PS_EXIT_SYS_ERROR) 125 unless ($ipprc->file_exists($compUri));126 unless ($ipprc->file_exists($compUri)); 126 127 127 128 if ($no_update || $no_op) { 128 print STDERR "NOUPDATE: $database_command\n";129 print STDERR "NOUPDATE: $database_command\n"; 129 130 } 130 131 else { 131 ($success, $error_code, $full_buf, $stdout_buf, $stderr_buf) =132 run(command => $database_command, verbose => $verbose);133 unless ($success) {134 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);135 &my_die("Unable to update database file: $uri -> $compUri: $error_code", 136 $exp_id,$exp_name,$class_id,$uri, $PS_EXIT_SYS_ERROR);137 }132 ($success, $error_code, $full_buf, $stdout_buf, $stderr_buf) = 133 run(command => $database_command, verbose => $verbose); 134 unless ($success) { 135 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 136 &my_die("Unable to update database file: $uri -> $compUri: $error_code", 137 $exp_id,$exp_name,$class_id,$uri, $PS_EXIT_SYS_ERROR); 138 } 138 139 } 139 140 exit(0); … … 149 150 # Confirm we have both files 150 151 &my_die("Couldn't find original file: $uri\n", $exp_id,$exp_name,$class_id,$uri,$PS_EXIT_SYS_ERROR) 151 unless($ipprc->file_exists($uri));152 unless($ipprc->file_exists($uri)); 152 153 my $uriReal = $ipprc->file_resolve( $uri ); 153 154 154 155 my $compUri = $uri . ".fz"; 155 156 unless($ipprc->file_exists($compUri)) { 156 &my_die("Couldn't find compressed version of the file: $compUri\n", 157 $exp_id,$exp_name,$class_id,$uri,$PS_EXIT_SYS_ERROR);158 159 # If that die is removed, this will compress things as well.160 # 161 # &my_die("Output compressed file already exists: $compUri\n",162 # $exp_id,$exp_name,$class_id,$uri,$PS_EXIT_SYS_ERROR)163 # if ($ipprc->file_exists($compUri));164 # my $compReal= $ipprc->file_resolve( $compUri, 'create');165 166 # my $compress_command = "$fpack -h -s 8 -S $uriReal > $compReal";167 # print STDERR "$compReal $uriReal $compress_command\n";168 # my ($success, $error_code, $full_buf, $stdout_buf, $stderr_buf) =169 # run(command => $compress_command, verbose => $verbose);170 # unless ($success) {171 # $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);172 # &my_die("Unable to compress file: $uri -> $compUri: $error_code",173 # $exp_id,$exp_name,$class_id,$uri, $PS_EXIT_SYS_ERROR);174 # }157 &my_die("Couldn't find compressed version of the file: $compUri\n", 158 $exp_id,$exp_name,$class_id,$uri,$PS_EXIT_SYS_ERROR); 159 160 # If that die is removed, this will compress things as well. 161 # 162 # &my_die("Output compressed file already exists: $compUri\n", 163 # $exp_id,$exp_name,$class_id,$uri,$PS_EXIT_SYS_ERROR) 164 # if ($ipprc->file_exists($compUri)); 165 # my $compReal= $ipprc->file_resolve( $compUri, 'create'); 166 167 # my $compress_command = "$fpack -h -s 8 -S $uriReal > $compReal"; 168 # print STDERR "$compReal $uriReal $compress_command\n"; 169 # my ($success, $error_code, $full_buf, $stdout_buf, $stderr_buf) = 170 # run(command => $compress_command, verbose => $verbose); 171 # unless ($success) { 172 # $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 173 # &my_die("Unable to compress file: $uri -> $compUri: $error_code", 174 # $exp_id,$exp_name,$class_id,$uri, $PS_EXIT_SYS_ERROR); 175 # } 175 176 } 176 177 … … 181 182 182 183 unless ($no_op) { 183 $neb->replicate($compUri);184 $neb->swap($uri,$compUri) or185 &my_die("Nebulous swap failed between $uri and $compUri", 186 $exp_id,$exp_name,$class_id,$uri,$PS_EXIT_SYS_ERROR);187 } 188 # Update database 184 $neb->replicate($compUri); 185 $neb->swap($uri,$compUri) or 186 &my_die("Nebulous swap failed between $uri and $compUri", 187 $exp_id,$exp_name,$class_id,$uri,$PS_EXIT_SYS_ERROR); 188 } 189 # Update database 189 190 190 191 my $database_command = "$regtool -updateprocessedimfile -exp_id $exp_id -class_id $class_id -set_state lossy "; … … 192 193 193 194 $database_command .= " -dbname $dbname" if defined $dbname; 194 195 195 196 if ($no_update || $no_op) { 196 print STDERR "NOUPDATE: $database_command\n";197 print STDERR "NOUPDATE: $database_command\n"; 197 198 } 198 199 else { 199 my ($success, $error_code, $full_buf, $stdout_buf, $stderr_buf) =200 run(command => $database_command, verbose => $verbose);201 unless($success) {202 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);203 $neb->swap($uri,$compUri) or204 &my_die("DB update failed and Nebulous swap-back failed between $uri and $compUri", 205 $exp_id,$exp_name,$class_id,$uri,$PS_EXIT_SYS_ERROR);206 &my_die("Unable to update database file: $uri -> $compUri: $error_code", 207 $exp_id,$exp_name,$class_id,$uri, $PS_EXIT_SYS_ERROR);208 }209 # remove original version200 my ($success, $error_code, $full_buf, $stdout_buf, $stderr_buf) = 201 run(command => $database_command, verbose => $verbose); 202 unless($success) { 203 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 204 $neb->swap($uri,$compUri) or 205 &my_die("DB update failed and Nebulous swap-back failed between $uri and $compUri", 206 $exp_id,$exp_name,$class_id,$uri,$PS_EXIT_SYS_ERROR); 207 &my_die("Unable to update database file: $uri -> $compUri: $error_code", 208 $exp_id,$exp_name,$class_id,$uri, $PS_EXIT_SYS_ERROR); 209 } 210 # remove original version 210 211 $neb->delete($compUri); 211 212 } -
trunk/ippScripts/scripts/magic_destreak.pl
r27396 r27718 8 8 use Sys::Hostname; 9 9 my $host = hostname(); 10 my $date = `date`; 10 11 print "\n\n"; 11 print "Starting script $0 on $host \n\n";12 print "Starting script $0 on $host at $date\n\n"; 12 13 13 14 use vars qw( $VERSION ); -
trunk/ippScripts/scripts/magic_destreak_cleanup.pl
r27604 r27718 8 8 use Sys::Hostname; 9 9 my $host = hostname(); 10 my $date = `date`; 10 11 print "\n\n"; 11 print "Starting script $0 on $host \n\n";12 print "Starting script $0 on $host at $date\n\n"; 12 13 13 14 use vars qw( $VERSION ); -
trunk/ippScripts/scripts/magic_destreak_defineruns.pl
r26030 r27718 11 11 use Sys::Hostname; 12 12 my $host = hostname(); 13 my $date = `date`; 13 14 print "\n\n"; 14 print "Starting script $0 on $host \n\n";15 print "Starting script $0 on $host at $date\n\n"; 15 16 16 17 use vars qw( $VERSION ); -
trunk/ippScripts/scripts/magic_destreak_revert.pl
r27598 r27718 8 8 use Sys::Hostname; 9 9 my $host = hostname(); 10 my $date = `date`; 10 11 print "\n\n"; 11 print "Starting script $0 on $host \n\n";12 print "Starting script $0 on $host at $date\n\n"; 12 13 13 14 use vars qw( $VERSION ); -
trunk/ippScripts/scripts/magic_process.pl
r27634 r27718 8 8 use Sys::Hostname; 9 9 my $host = hostname(); 10 my $date = `date`; 10 11 print "\n\n"; 11 print "Starting script $0 on $host \n\n";12 print "Starting script $0 on $host at $date\n\n"; 12 13 13 14 use vars qw( $VERSION ); -
trunk/ippScripts/scripts/magic_tree.pl
r27596 r27718 8 8 use Sys::Hostname; 9 9 my $host = hostname(); 10 my $date = `date`; 10 11 print "\n\n"; 11 print "Starting script $0 on $host \n\n";12 print "Starting script $0 on $host at $date\n\n"; 12 13 13 14 use vars qw( $VERSION ); -
trunk/ippScripts/scripts/publish_file.pl
r27286 r27718 7 7 use Sys::Hostname; 8 8 my $host = hostname(); 9 print "Starting script $0 on $host\n\n"; 9 my $date = `date`; 10 print "\n\n"; 11 print "Starting script $0 on $host at $date\n\n"; 10 12 11 13 use DateTime; -
trunk/ippScripts/scripts/rcserver_checkstatus.pl
r25567 r27718 8 8 use Sys::Hostname; 9 9 my $host = hostname(); 10 my $date = `date`; 10 11 print "\n\n"; 11 print "Starting script $0 on $host \n\n";12 print "Starting script $0 on $host at $date\n\n"; 12 13 13 14 use vars qw( $VERSION ); -
trunk/ippScripts/scripts/receive_advance.pl
r24127 r27718 7 7 use Sys::Hostname; 8 8 my $host = hostname(); 9 print "Starting script $0 on $host\n\n"; 9 my $date = `date`; 10 print "\n\n"; 11 print "Starting script $0 on $host at $date\n\n"; 10 12 11 13 use DateTime; -
trunk/ippScripts/scripts/receive_file.pl
r25940 r27718 7 7 use Sys::Hostname; 8 8 my $host = hostname(); 9 print "Starting script $0 on $host\n\n"; 9 my $date = `date`; 10 print "\n\n"; 11 print "Starting script $0 on $host at $date\n\n"; 10 12 11 13 use DateTime; … … 124 126 print "dirinfo resolved is: $resolved\n" if $verbose; 125 127 126 open OUT, ">$resolved" 128 open OUT, ">$resolved" 127 129 or &my_die( "failed to open $resolved\n", $file_id, $PS_EXIT_UNKNOWN_ERROR); 128 130 print OUT @$dirinfo_lines … … 130 132 close OUT 131 133 or &my_die( "failed to close $resolved\n", $file_id, $PS_EXIT_UNKNOWN_ERROR); 132 134 133 135 # update the fileset to allow processing of other files 134 136 my $command = "$receivetool -updatefileset -fileset_id $fileset_id"; … … 160 162 &my_die( "failed to resolve $dbinfo_uri\n", $file_id, $PS_EXIT_UNKNOWN_ERROR) if !$resolved; 161 163 162 open OUT, ">$resolved" 164 open OUT, ">$resolved" 163 165 or &my_die( "failed to open $resolved\n", $file_id, $PS_EXIT_UNKNOWN_ERROR); 164 166 … … 227 229 $current_component = $value; 228 230 $component_dir = $components->{$current_component}; 229 &my_die( "$component_dir is null for $value in $filename: $runType\n", 231 &my_die( "$component_dir is null for $value in $filename: $runType\n", 230 232 $file_id, $PS_EXIT_UNKNOWN_ERROR) if !$component_dir; 231 233 } elsif ($name eq 'workdir') { … … 237 239 $new_value = basename($value); 238 240 } elsif ((($name eq 'uri') or ($name eq 'path_base')) and ($value ne 'NULL')) { 239 &my_die( "$component_dir is null and we need it for $name", 241 &my_die( "$component_dir is null and we need it for $name", 240 242 $file_id, $PS_EXIT_PROG_ERROR) if !$component_dir; 241 243 -
trunk/ippScripts/scripts/receive_fileset.pl
r24786 r27718 7 7 use Sys::Hostname; 8 8 my $host = hostname(); 9 print "Starting script $0 on $host\n\n"; 9 my $date = `date`; 10 print "\n\n"; 11 print "Starting script $0 on $host at $date\n\n"; 10 12 11 13 use DateTime; -
trunk/ippScripts/scripts/receive_setstatus.pl
r24038 r27718 8 8 use Sys::Hostname; 9 9 my $host = hostname(); 10 my $date = `date`; 10 11 print "\n\n"; 11 print "Starting script $0 on $host \n\n";12 print "Starting script $0 on $host at $date\n\n"; 12 13 13 14 use vars qw( $VERSION ); … … 74 75 $fileargs = " --list - --copy --abspath"; 75 76 } 76 77 77 78 # XXX need to create a fileset type for this 78 79 my $command = "echo $regline | dsreg --add $status_fs_name --product $status_product --type notset"; -
trunk/ippScripts/scripts/receive_source.pl
r24744 r27718 7 7 use Sys::Hostname; 8 8 my $host = hostname(); 9 print "Starting script $0 on $host\n\n"; 9 my $date = `date`; 10 print "\n\n"; 11 print "Starting script $0 on $host at $date\n\n"; 10 12 11 13 use DateTime; -
trunk/ippScripts/scripts/register_exp.pl
r23688 r27718 8 8 use Sys::Hostname; 9 9 my $host = hostname(); 10 my $date = `date`; 10 11 print "\n\n"; 11 print "Starting script $0 on $host \n\n";12 print "Starting script $0 on $host at $date\n\n"; 12 13 13 14 use vars qw( $VERSION ); -
trunk/ippScripts/scripts/register_imfile.pl
r26378 r27718 8 8 use Sys::Hostname; 9 9 my $host = hostname(); 10 my $date = `date`; 10 11 print "\n\n"; 11 print "Starting script $0 on $host \n\n";12 print "Starting script $0 on $host at $date\n\n"; 12 13 13 14 use vars qw( $VERSION ); … … 115 116 my $burntoolStateGood = 0; 116 117 foreach my $line (split /\n/, $out1) { 117 if ($line =~ /FPA.BURNTOOL.APPLIED/) {118 $line =~ s/^\s+//;119 $burntoolState = (split /\s+/, $line)[2];120 }121 if ($line =~ /FPA.CAMERA/) {122 $line =~ s/^\s+//;123 if ((split /\s+/, $line)[2] eq 'GPC1') {124 $isGPC1 = 1;125 }126 }118 if ($line =~ /FPA.BURNTOOL.APPLIED/) { 119 $line =~ s/^\s+//; 120 $burntoolState = (split /\s+/, $line)[2]; 121 } 122 if ($line =~ /FPA.CAMERA/) { 123 $line =~ s/^\s+//; 124 if ((split /\s+/, $line)[2] eq 'GPC1') { 125 $isGPC1 = 1; 126 } 127 } 127 128 } 128 129 if ($isGPC1 != 1) { 129 $burntoolState = 0; # If it's not GPC1, you shouldn't have run burntool.130 $burntoolState = 0; # If it's not GPC1, you shouldn't have run burntool. 130 131 } 131 132 elsif (($isGPC1 == 1) && ($burntoolState == 1)) { 132 # print STDERR "In the good region: >>$burntoolState<<\n";133 my $ppConfigDump_cmd = "$ppConfigDump -camera GPC1 -dump-camera -";134 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =135 IPC::Cmd::run(command => $ppConfigDump_cmd, verbose => $verbose);136 unless ($success) {137 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);138 warn ("Unable to perform ppConfigDump");139 exit($error_code);140 }141 142 # This is ugly, but doing a full parse for one entry is a bit wasteful.143 foreach my $line (split /\n/, (join "", @$stdout_buf)) {144 if ($line =~ /BURNTOOL.STATE.GOOD/) {145 $line =~ s/^\s+//;146 $burntoolStateGood = (split /\s+/, $line)[2];147 last;148 }149 }150 $burntoolState = $burntoolStateGood; # Positive because this has the header table.151 133 # print STDERR "In the good region: >>$burntoolState<<\n"; 134 my $ppConfigDump_cmd = "$ppConfigDump -camera GPC1 -dump-camera -"; 135 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 136 IPC::Cmd::run(command => $ppConfigDump_cmd, verbose => $verbose); 137 unless ($success) { 138 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 139 warn ("Unable to perform ppConfigDump"); 140 exit($error_code); 141 } 142 143 # This is ugly, but doing a full parse for one entry is a bit wasteful. 144 foreach my $line (split /\n/, (join "", @$stdout_buf)) { 145 if ($line =~ /BURNTOOL.STATE.GOOD/) { 146 $line =~ s/^\s+//; 147 $burntoolStateGood = (split /\s+/, $line)[2]; 148 last; 149 } 150 } 151 $burntoolState = $burntoolStateGood; # Positive because this has the header table. 152 152 153 } 153 154 $cmdflags .= " -burntool_state $burntoolState "; -
trunk/ippScripts/scripts/stack_skycell.pl
r27180 r27718 8 8 use Sys::Hostname; 9 9 my $host = hostname(); 10 my $date = `date`; 10 11 print "\n\n"; 11 print "Starting script $0 on $host \n\n";12 print "Starting script $0 on $host at $date\n\n"; 12 13 13 14 use DateTime; -
trunk/ippScripts/scripts/tdl_generate.pl
r21202 r27718 13 13 use Sys::Hostname; 14 14 my $host = hostname(); 15 my $date = `date`; 15 16 #print "\n\n"; 16 #print "Starting script $0 on $host \n\n";17 #print "Starting script $0 on $host at $date\n\n"; 17 18 18 19 use vars qw( $VERSION ); … … 58 59 # resolve any path:// or file:// in outroot 59 60 $outroot = $ipprc->file_resolve($outroot); 60 61 61 62 # Look for programs we need 62 63 my $missing_tools; -
trunk/ippScripts/scripts/warp_overlap.pl
r23688 r27718 8 8 use Sys::Hostname; 9 9 my $host = hostname(); 10 my $date = `date`; 10 11 print "\n\n"; 11 print "Starting script $0 on $host \n\n";12 print "Starting script $0 on $host at $date\n\n"; 12 13 13 14 use vars qw( $VERSION ); -
trunk/ippScripts/scripts/warp_skycell.pl
r27180 r27718 7 7 use Sys::Hostname; 8 8 my $host = hostname(); 9 my $date = `date`; 9 10 print "\n\n"; 10 print "Starting script $0 on $host \n\n";11 print "Starting script $0 on $host at $date\n\n"; 11 12 12 13 use DateTime;
Note:
See TracChangeset
for help on using the changeset viewer.
