IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jul 16, 2008, 3:27:19 PM (18 years ago)
Author:
bills
Message:

Changes to get detectability query processing working with the new
request processing scheme and tables

File:
1 edited

Legend:

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

    r18533 r18587  
    3131
    3232
    33 my ( $dbname, $limit, $verbose, $save_temps );
     33my ( $req_id, $req_name, $product, $dbname, $verbose, $save_temps );
    3434
    3535# the char to the right of the bar may be used as a single - alias for the longer name
    3636# for example --input and -i are equivalent
    3737GetOptions(
    38            'limit=s'    => \$limit,
     38           'req_id=s'   => \$req_id,
     39           'req_name=s' => \$req_name,
     40           'product=s'  => \$product,
    3941           'dbname=s'   => \$dbname,
    40            'verbose'  => \$verbose,
     42           'verbose'    => \$verbose,
    4143           'save-temps' => \$save_temps,
    4244) or pod2usage( 2 );
     
    6264my $mdcParser = PS::IPP::Metadata::Config->new; # Parser for metadata config files
    6365
    64 my @requests;
    6566{
    66     my $command = "$pstamptool -completedreq";
    67     $command   .= " -limit $limit" if $limit;
    68     $command   .= " -dbname $dbname" if $dbname;
    69     my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    70         run(command => $command, verbose => $verbose);
    71     unless ($success) {
    72         die("Unable to perform $command error code: $error_code");
    73     }
    74     my $output = join "", @$stdout_buf;
    75     if (!$output) {
    76         if ($verbose) {
    77             print STDERR "no completed requests pending\n"
    78         }
    79         exit 0;
    80     }
    81     my $metadata = $mdcParser->parse($output) or die("Unable to parse metdata config doc");
    82 
    83     my $requests = parse_md_list($metadata);
    84 
    85     @requests = @$requests
    86 }
    87 
    88 foreach my $req (@requests) {
    89     my $req_id = $req->{req_id};
    90 
    91     my $product = $req->{outProduct};
    92     die "outProduct in request is null" if !$product;
    93 
    94     my $req_name = $req->{name};
    95     die "request name is null" if !$req_name;
    96 
    97 
    9867    # set the output fileset's name to the request name.
    9968    my $fileset = $req_name;
     
    156125            # including those that produced no jobs.
    157126            # for now add an entry for rownum 1 and a phony error code.
    158             #
    159             # possible fix: have pstampparse add a dummy job with state=stop and a fault code
    160127            # we've included parse_results.txt to the fileset if it exists
    161128            #
     
    169136            my $jobs = parse_md_list($metadata);
    170137
    171             @jobs = @$jobs
     138            @jobs = @$jobs;
    172139        }
    173140    }
     
    201168            }
    202169        } else {
    203             die "Unknown jobType: $job_type";
     170            print STDERR "Unknown jobType: $job_type";
     171            next;
    204172        }
    205173    }
     
    235203    # set the request's state to stop
    236204    {
    237        
    238205        my $command = "$pstamptool -processedreq -req_id $req_id -state stop -fault $request_fault";
    239206        $command   .= " -dbname $dbname" if $dbname;
     
    245212    }
    246213}
     214sub stop_request {
     215    my $req_id = shift;
     216    my $fault  = shift;
     217    my $dbname = shift;
     218
     219    my $command = "$pstamptool -processedreq -req_id $req_id -state stop -fault $fault";
     220    $command   .= " -dbname $dbname" if $dbname;
     221
     222    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     223        run(command => $command, verbose => $verbose);
     224    unless ($success) {
     225        die("Unable to perform $command error code: $error_code");
     226    }
     227}
Note: See TracChangeset for help on using the changeset viewer.