IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 18232 for trunk/pstamp/scripts


Ignore:
Timestamp:
Jun 20, 2008, 9:34:35 AM (18 years ago)
Author:
bills
Message:

add --dbname option

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/pstamp/scripts/pstamp_parser_run.pl

    r17893 r18232  
    55###
    66
    7 #XXX TODO: accept dbname save-temps and verbose as command line parameters
    87#XXX see notes about error handling
    98
     
    1211
    1312use Sys::Hostname;
    14 
    15 my $verbose = 1;
     13use Getopt::Long qw( GetOptions );
     14
     15my $verbose;
     16my $dbname;
     17my $request_id;
     18
     19GetOptions(
     20    'verbose'   =>  \$verbose,
     21    'dbname=s'    =>  \$dbname,
     22    'req_id=s'  =>  \$request_id,
     23);
     24
    1625if ($verbose) {
    1726    my $host = hostname();
     
    2029}
    2130
    22 if (@ARGV != 1) {
    23     die "usage: $0 request_id\n";
    24 }
    25 
    26 my $request_id = $ARGV[0];
     31die "req_id is required" if !defined($request_id);
    2732
    2833use IPC::Cmd 0.36 qw( can_run run );
     
    7782{
    7883    my $command = "$pstamptool -pendingreq -req_id $request_id";
     84    $command .= " -dbname $dbname" if $dbname;
    7985    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    8086        run(command => $command, verbose => $verbose);
     
    135141if ($ds_id) {
    136142    my $command = "$pstamptool -datastore -ds_id $ds_id";
     143    $command .= " -dbname $dbname" if $dbname;
    137144    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    138145        run(command => $command, verbose => $verbose);
     
    173180if ($request_type eq "PS1_PS_REQUEST") {
    174181    $parse_cmd = $pstampparse . " -mode queue_job -req_id $request_id -out_dir $outdir $uri";
     182    $parse_cmd .= " -dbname $dbname" if $dbname;
    175183} elsif ($request_type eq "MOPS_DETECTABILITY_QUERY") {
    176184    $parse_cmd = $dqueryparse  . " --mode queue_job --req_id $request_id --out_dir $outdir --uri $uri";
     
    195203    }
    196204}
    197 # XXX make sure that a job got actually got queued. If not set the request result and set state to
     205
     206# XXX make sure that a job got actually got queued.
     207# If not set the request result and set state to
    198208# run so that the "request finisher" can build the results file.
    199209
     
    203213{
    204214    my $command = "$pstamptool -processedreq -req_id $request_id -state run";
     215    $command .= " -dbname $dbname" if $dbname;
    205216    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    206217        run(command => $command, verbose => $verbose);
Note: See TracChangeset for help on using the changeset viewer.