IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 42602


Ignore:
Timestamp:
Jan 28, 2024, 2:24:07 PM (2 years ago)
Author:
eugene
Message:

fixes to get xcstack and related scripts working

Location:
branches/eam_branches/ipp-20230313/ippScripts
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20230313/ippScripts/Build.PL

    r42581 r42602  
    159159        scripts/xcsky.pl
    160160        scripts/xccal.pl
     161        scripts/xcff_warp.pl
    161162    )],
    162163    dist_abstract => 'Scripts for running the Pan-STARRS IPP',
  • branches/eam_branches/ipp-20230313/ippScripts/scripts/xccal.pl

    r42581 r42602  
    4545    print "USAGE: xccal.pl --xccal_id (xccal_id) --outroot (root) --camera (camera) [options]\n";
    4646    print "  --xccal_id (xccal_id) : run identifier\n";
     47    print "  --xcstack_id (xcstack_id) : run identifier\n";
    4748    print "  --camera (camera)       : Camera name\n";
    4849    print "  --dbname (dbname)       : Database name\n";
  • branches/eam_branches/ipp-20230313/ippScripts/scripts/xcsky.pl

    r42580 r42602  
    135135
    136136{
    137         my $recipe_psphot  = $ipprc->reduction($reduction, 'STACKPHOT_PSPHOT'); # Recipe to use for psphot
    138         my $recipe_ppsub   = $ipprc->reduction($reduction, 'STACKPHOT_PPSUB'); # Recipe to use for ppsub
    139         my $recipe_ppstack = $ipprc->reduction($reduction, 'STACKPHOT_PPSTACK'); # Recipe to use for ppstack
     137        my $recipe_psphot  = $ipprc->reduction($reduction, 'XCSTACK_PSPHOT'); # Recipe to use for psphot
     138        # my $recipe_ppsub   = $ipprc->reduction($reduction, 'XCSTACK_PPSUB'); # Recipe to use for ppsub
     139        # my $recipe_ppstack = $ipprc->reduction($reduction, 'XCSTACK_PPSTACK'); # Recipe to use for ppstack
    140140        unless ($recipe_psphot) {
    141             &my_die("Couldn't find selected reduction for STACKPHOT: $reduction\n", $xcsky_id, $PS_EXIT_CONFIG_ERROR);
     141            &my_die("Couldn't find selected reduction for XCSTACK_PSPHOT: $reduction\n", $xcsky_id, $PS_EXIT_CONFIG_ERROR);
    142142        }
    143143
    144144        print "reduction:      $reduction\n";
    145145        print "recipe_psphot:  $recipe_psphot\n";
    146         print "recipe_ppsub:   $recipe_ppsub\n";
    147         print "recipe_ppstack: $recipe_ppstack\n";
     146        # print "recipe_ppsub:   $recipe_ppsub\n";
     147        # print "recipe_ppstack: $recipe_ppstack\n";
    148148        my $configuration = $ipprc->filename("PSPHOT.STACK.CONFIG", $outroot);
    149149
     
    261261            $command .= " -threads $threads" if defined $threads;
    262262            $command .= " -recipe PSPHOT  $recipe_psphot";
    263             $command .= " -recipe PPSUB   $recipe_ppsub";
    264             $command .= " -recipe PPSTACK $recipe_ppstack";
     263            # $command .= " -recipe PPSUB   $recipe_ppsub";
     264            # $command .= " -recipe PPSTACK $recipe_ppstack";
    265265            $command .= " -dumpconfig $configuration" if !$updatemode;
    266266            $command .= " -tracedest $traceDest -log $logDest";
     
    274274                }
    275275
     276                # XXX need to enable the STATS output in psphotStack, then read the results here:
    276277                # my $outputStatsReal = $ipprc->file_resolve($outputStats);
    277278                # &my_die("Couldn't find expected output file: $outputStats", $xcsky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputStatsReal);
  • branches/eam_branches/ipp-20230313/ippScripts/scripts/xcstack_skycell.pl

    r42560 r42602  
    1919
    2020use IPC::Cmd 0.36 qw( can_run run );
     21use Scalar::Util qw(looks_like_number);
    2122use PS::IPP::Metadata::Config;
    2223use PS::IPP::Metadata::List qw( parse_md_list );
     
    244245
    245246    # cannot use run_command here (no metadata output to parse)
    246     my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    247         run(command => $command, verbose => $verbose);
     247    my ( $success, $error_msg, $full_buf, $stdout_buf, $stderr_buf ) = run(command => $command, verbose => $verbose);
     248    my $error_code = &parse_error_message ($success, $error_msg, $command);
    248249    unless ($success) {
    249         $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    250         &my_die("Unable to perform ppStack: $error_code", $xcstack_id, $error_code);
     250        &my_die("Unable to perform $command: $error_msg", $xcstack_id, $error_code);
    251251    }
    252252
     
    259259        # measure stats
    260260        $command = "$ppStatsFromMetadata $outputStatsReal - XCSTACK_SKYCELL";
    261         ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = run(command => $command, verbose => $verbose);
     261        ( $success, $error_msg, $full_buf, $stdout_buf, $stderr_buf ) = run(command => $command, verbose => $verbose);
     262        my $error_code = &parse_error_message ($success, $error_msg, $command);
    262263        unless ($success) {
    263             $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    264             &my_die("Unable to perform ppStatsFromMetadata: $error_code", $xcstack_id, $error_code);
     264            &my_die("Unable to perform $command: $error_msg", $xcstack_id, $error_code);
    265265        }
    266266        foreach my $line (@$stdout_buf) { $cmdflags .= " $line"; }
     
    295295        $command .= " -dbname $dbname" if defined $dbname;
    296296
    297         my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    298             run(command => $command, verbose => $verbose);
     297        my ( $success, $error_msg, $full_buf, $stdout_buf, $stderr_buf ) = run(command => $command, verbose => $verbose);
     298        my $error_code = &parse_error_message ($success, $error_msg, $command);
    299299        unless ($success) {
    300             $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    301             &my_die("Unable to perform xcstacktool $mode $error_code", $xcstack_id, $error_code);
     300            &my_die("Unable to perform $command: $error_msg", $xcstack_id, $error_code);
    302301        }
    303302    }
    304 
    305303}
    306304
    307305print "I've updated the database: $xcstack_id\n";
    308 
    309306print "I've reached the end of processing with a code of $?: $xcstack_id\n";
    310307
     
    411408    my $mdcParser = PS::IPP::Metadata::Config->new; # Parser for metadata config files
    412409
    413     my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = run(command => $command, verbose => $verbose);
     410    my ( $success, $error_msg, $full_buf, $stdout_buf, $stderr_buf ) = run(command => $command, verbose => $verbose);
     411    my $error_code = &parse_error_message ($success, $error_msg, $command);
    414412    unless ($success) {
    415         $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    416         &my_die("Unable to perform $command", $xcstack_id, $error_code);
     413        &my_die("Unable to perform $command: $error_msg", $xcstack_id, $error_code);
    417414    }
    418415
     
    435432}
    436433
     434# if the program exited normally, the exit value is returned
     435# if the program exited with a signal (abort, crash, etc), PS_EXIT_PROG_ERROR (4) is returned
     436# if the program failed to run, -PS_EXIT_PROG_ERROR (-4) is returned
     437sub parse_error_message {
     438    my $success = shift;
     439    my $error_msg = shift;
     440    my $command = shift;
     441
     442    if ($success) { return 0; }
     443
     444    print "raw error_msg: $error_msg\n";
     445    print "full command: $command\n";
     446
     447    if (&looks_like_number($error_msg)) { return (($error_msg >> 8) or ($PS_EXIT_PROG_ERROR)); }
     448       
     449    # which of these match?
     450    my ($error_code) = $error_msg =~ m/exited with value (\d+)/;
     451    if (defined $error_code) { return $error_code; }
     452   
     453    ($error_code) = $error_msg =~ m/died with signal (\d+)/;
     454#   if (defined $error_code) { return (128 + $error_code); }
     455    if (defined $error_code) { return ($PS_EXIT_PROG_ERROR); }
     456   
     457    # probably failed to execute:
     458    return (-1*$PS_EXIT_PROG_ERROR);
     459}
     460
    437461__END__
    438462
Note: See TracChangeset for help on using the changeset viewer.