IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 5, 2009, 11:13:29 AM (17 years ago)
Author:
beaumont
Message:

Finished ppStack visualization. Unified the way in which visualizations are invoked, plotting windows are closed, etc

Location:
branches/cnb_branches/cnb_branch_20090215
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/cnb_branches/cnb_branch_20090215

  • branches/cnb_branches/cnb_branch_20090215/ippScripts/scripts/register_imfile.pl

    r22419 r23197  
    1717use Storable qw(freeze thaw);
    1818use File::Basename qw( basename);
    19 use IPC::Run qw( harness run );
     19use IPC::Run;
     20use IPC::Cmd 0.36 qw( can_run );
    2021use PS::IPP::Config 1.01 qw( :standard );
    2122use PS::IPP::Metadata::Config;
     
    2728use Getopt::Long qw( GetOptions :config auto_help auto_version gnu_getopt );
    2829use Pod::Usage qw( pod2usage );
     30
     31# Look for programs we need
     32my $missing_tools;
     33my $regtool = can_run( 'regtool' ) or (warn "Can't find regtool" and $missing_tools = 1);
     34my $ppStats = can_run( 'ppStats' ) or (warn "Can't find ppStats" and $missing_tools = 1);
     35my $ppStatsFromMetadata = can_run( 'ppStatsFromMetadata' ) or (warn "Can't find ppStatsFromMetadata" and $missing_tools = 1);
    2936
    3037my ($cache, $exp_id, $tmp_class_id, $tmp_exp_name, $uri, $dbname, $verbose, $no_update, $no_op, $logfile);
     
    4249) or pod2usage( 2 );
    4350
     51# Unhandled exceptions should be passed on to my_die so they get pushed into the database
     52$SIG{__DIE__} = sub { die @_ if $^S;
     53                      my_die( $_[0], $exp_id, $tmp_exp_name, $tmp_class_id, $uri, $PS_EXIT_UNKNOWN_ERROR ); };
     54
    4455$ipprc->redirect_output($logfile) if $logfile;
    4556
     
    5566my $RECIPE = "REGISTER"; # Recipe to use for ppStats
    5667
    57 # Look for programs we need
    58 my $missing_tools;
    59 my $regtool = `which regtool` or (warn "Can't find regtool" and $missing_tools = 1);
    60 my $ppStats = `which ppStats` or (warn "Can't find ppStats" and $missing_tools = 1);
    61 my $ppStatsFromMetadata = `which ppStatsFromMetadata` or (warn "Can't find ppStatsFromMetadata" and $missing_tools = 1);
    62 chomp $regtool;
    63 chomp $ppStats;
    64 chomp $ppStatsFromMetadata;
    65 
    66 
    6768if ($missing_tools) {
    6869    warn ("Can't find required tools");
     
    9293    # Run ppStats
    9394    my ($in1, $out1, $err1);    # Buffers for ppStats
    94     my $h1 = harness \@command1, \$in1, \$out1, \$err1;
     95    my $h1 = IPC::Run::harness \@command1, \$in1, \$out1, \$err1;
    9596    print "[Running $command1]\n";
    96     my $result1 = run $h1;
    97     print $out1;
    98     print $err1;
     97    my $result1 = IPC::Run::run $h1;
     98    print "STDOUT:\n$out1";
     99    print "STDERR:\n$err1";
    99100    &my_die("Unable to perform ppStats on exposure id $exp_id: " . $h1->result(), $exp_id, $tmp_exp_name, $tmp_class_id, $uri, $h1->result() ) unless $result1;
    100101
    101102    print "[Running " . join(' ', @command2) . "]\n";
    102103    my ($out2, $err2);          # Buffers for ppStatsFromMetadata
    103     my $h2 = harness \@command2, \$out1, \$out2, \$err2;
     104    my $h2 = IPC::Run::harness \@command2, \$out1, \$out2, \$err2;
    104105    print "[Running $command2]\n";
    105     my $result2 = run $h2;
    106     print $out2;
    107     print $err2;
     106    my $result2 = IPC::Run::run $h2;
     107    print "STDOUT:\n$out2";
     108    print "STDERR:\n$err2";
    108109    &my_die("Unable to perform ppStatsFromMetadata on exposure id $exp_id: " . $h2->result(), $exp_id, $tmp_exp_name, $tmp_class_id, $uri, $h2->result() ) unless $result2;
    109110    chomp $out2;
     
    166167unless ($no_update) {
    167168    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    168         run(command => $command, verbose => $verbose);
     169        IPC::Cmd::run(command => $command, verbose => $verbose);
    169170    unless ($success) {
    170171        $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     
    187188        return @{thaw $cmd_output};
    188189    } else {
    189         my @output = run(%p);
     190        my @output = IPC::Cmd::run(%p);
    190191        $c->set($p{command}, freeze \@output) if $cache;
    191192        return @output;
Note: See TracChangeset for help on using the changeset viewer.