IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Aug 7, 2009, 4:08:25 PM (17 years ago)
Author:
Paul Price
Message:

Merging trunk (r25026) to get up-to-date on old branch.

Location:
branches/pap
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/pap

  • branches/pap/pstamp/scripts/pstamp_finish.pl

    r23267 r25027  
    2424use PS::IPP::PStamp::Job qw( :standard );
    2525
    26 my ( $req_id, $req_name, $req_file, $out_dir, $product, $dbname, $verbose, $save_temps, $redirect_output);
     26my ( $req_id, $req_name, $req_file, $out_dir, $product, $dbname, $dbserver, $verbose, $save_temps, $redirect_output);
    2727
    2828# the char to the right of the bar may be used as a single - alias for the longer name
     
    3535           'out_dir=s'      => \$out_dir,
    3636           'dbname=s'       => \$dbname,
     37           'dbserver=s'     => \$dbserver,
    3738           'verbose'        => \$verbose,
    3839           'save-temps'     => \$save_temps,
     
    5051    my $logDest = "$out_dir/psfinish.$req_id.log";
    5152    $ipprc->redirect_output($logDest);
     53}
     54
     55if (!$dbserver) {
     56    $dbserver =  metadataLookupStr($ipprc->{_siteConfig}, 'PS_DBSERVER');
    5257}
    5358
     
    8994        if (!mkdir $out_dir) {
    9095            print STDERR "cannot create output directory $out_dir";
    91             stop_request($req_id, $PS_EXIT_UNKNOWN_ERROR, $dbname);
     96            stop_request($req_id, $PS_EXIT_UNKNOWN_ERROR);
    9297        }
    9398
     
    97102        # request
    98103        print STDERR "output directory $out_dir exists but is not a directory";
    99         stop_request($req_id, $PS_EXIT_UNKNOWN_ERROR, $dbname);
     104        stop_request($req_id, $PS_EXIT_UNKNOWN_ERROR);
    100105    }
    101106
    102107    if (! -e $req_file ) {
    103108        print STDERR "request file $req_file is missing\n";
    104         stop_request($req_id, $PS_EXIT_CONFIG_ERROR, $dbname);
     109        stop_request($req_id, $PS_EXIT_CONFIG_ERROR);
    105110    }
    106111
     
    112117        # point
    113118        print STDERR "failed to read request_file $req_file" ;
    114         stop_request($req_id, $PS_EXIT_CONFIG_ERROR, $dbname);
     119        stop_request($req_id, $PS_EXIT_CONFIG_ERROR);
    115120    }
    116121
     
    138143        my $command = "$pstamptool -listjob -req_id $req_id";
    139144        $command   .= " -dbname $dbname" if $dbname;
     145        $command   .= " -dbserver $dbserver" if $dbserver;
    140146        my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    141147            run(command => $command, verbose => $verbose);
     
    167173    }
    168174
     175    my $exp_info;
     176    my $last_exp_id = -1;
    169177    foreach my $job (@jobs) {
    170178        my $job_id = $job->{job_id};
     
    175183
    176184        my ($row, $req_info, $project) = get_request_info($rows, $rownum);
    177         my $proj_hash = resolve_project($ipprc, $project, $dbname);
     185
     186        my $proj_hash = resolve_project($ipprc, $project, $dbname, $dbserver);
    178187        my $image_db = $proj_hash->{dbname};
    179 
    180         # get the metadata for the exposure (if any i.e. stack)
    181         # returns an appropriate string if !$exp_id
    182         my $exp_info = get_exposure_info($image_db, $exp_id);
     188        if (!$image_db) {
     189            carp("failed to find imagedb for project: $project");
     190            stop_request($req_id, $PS_EXIT_CONFIG_ERROR);
     191        }
     192
     193        if ($exp_id ne $last_exp_id) {
     194            # get the metadata for the exposure (if any i.e. stack)
     195            # returns an appropriate string if !$exp_id
     196            $exp_info = get_exposure_info($image_db, $exp_id);
     197            $last_exp_id = $exp_id;
     198        }
    183199
    184200        if (($job_type eq "stamp") || ($job_type eq "get_image")) {
     
    251267        my $command = "$pstamptool -updatereq -req_id $req_id -state stop -fault $request_fault";
    252268        $command   .= " -dbname $dbname" if $dbname;
     269        $command   .= " -dbserver $dbserver" if $dbserver;
    253270        my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    254271            run(command => $command, verbose => $verbose);
     
    263280    my $req_id = shift;
    264281    my $fault  = shift;
    265     my $dbname = shift;
    266282
    267283    my $command = "$pstamptool -updatereq -req_id $req_id -state stop -fault $fault";
    268284    $command   .= " -dbname $dbname" if $dbname;
     285    $command   .= " -dbserver $dbserver" if $dbserver;
    269286
    270287    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     
    285302    # Create a results file module and provide a list of the names (we have the data in the columns)
    286303    my $rowinfo = "$row->{PROJECT}|$row->{JOB_TYPE}|$row->{REQ_TYPE}|$row->{IMG_TYPE}|";
    287     $rowinfo   .= "$row->{ID}|$row->{CLASS_ID}|$row->{OPTION_MASK}|$row->{MJD_MIN}|$row->{MJD_MAX}|";
     304    $rowinfo   .= "$row->{ID}|$row->{TESS_ID}|$row->{COMPONENT}|$row->{OPTION_MASK}|$row->{MJD_MIN}|$row->{MJD_MAX}|";
    288305    $rowinfo   .= "$row->{REQFILT}|$row->{COORD_MASK}|$row->{CENTER_X}|$row->{CENTER_Y}|";
    289306    $rowinfo   .= "$row->{WIDTH}|$row->{HEIGHT}";
Note: See TracChangeset for help on using the changeset viewer.