IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 33380 for trunk/pstamp


Ignore:
Timestamp:
Feb 28, 2012, 1:43:18 PM (14 years ago)
Author:
bills
Message:

for detectabilty queries insure that QUERY_ID is uniqueue. Create error fileset if not

File:
1 edited

Legend:

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

    r33324 r33380  
    1717use Pod::Usage qw( pod2usage );
    1818use File::Temp qw( tempfile tempdir);
     19use POSIX;  # for strftime
    1920
    2021use PS::IPP::PStamp::RequestFile qw( :standard );
     
    9899my_die("$request_file is version $extver expecting 1 or 2", $PS_EXIT_PROG_ERROR)
    99100    if ($extver ne 1) and ($extver ne 2);
     101
     102if ($req_id) {
     103    my $command = "$pstamptool -listreq  -name $req_name -not_req_id $req_id";
     104    # set verbose to false so that error message about request not found doesn't appear in parse_error.txt
     105    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     106        run(command => $command, verbose => 0);
     107    if ($success) {
     108        # -listreq succeeded duplicate request name
     109        print STDERR "QUERY_ID $req_name has already been used\n";
     110        $command = "$pstamptool -addjob -job_type none -rownum 0 -state stop -fault $PSTAMP_DUP_REQUEST -req_id $req_id";
     111        unless ($no_update) {
     112            my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     113                run(command => $command, verbose => $verbose);
     114            if (!$success) {
     115                my_die("$command failed", $PS_EXIT_UNKNOWN_ERROR);
     116            }
     117        } else {
     118            print STDERR "skipping $command\n";
     119        }
     120       
     121        my $datestr = strftime "%Y%m%d%H%M%S.$req_id", gmtime;
     122        $req_name = "ERROR.$datestr";
     123    }
     124    $command = "$pstamptool -updatereq -req_id $req_id  -set_name $req_name -set_outProduct $product";
     125    unless ($no_update) {
     126        ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     127            run(command => $command, verbose => $verbose);
     128        unless ($success) {
     129            my_die("$command failed", $PS_EXIT_UNKNOWN_ERROR);
     130        }
     131    } else {
     132        print STDERR "skipping $command\n";
     133    }
     134    exit (0);
     135}
     136
    100137
    101138
     
    357394            my $component = $query{$fpa_id}{COMPONENT_ID}[$i];
    358395            print "Need to UPDATE $stage $stage_id $component from $data_state\n";
    359     ####                           my ($req_id, $outdir, $label, $state, $stage, $stage_id, $component, $need_magic, $imagedb) = @_;
    360396            $dep_id = queue_update_run($req_id, $outdir, $label, $data_state, $stage, $stage_id, $component, 0, $imagedb);
    361397        }
     
    413449}
    414450
    415 # XXX: flesh this out once we have a request without duplicate ROWNUMS
    416451foreach my $rownum (keys %faulted_rows ) {
     452    my $outputBase = "$outdir/$job_num" . "_";
    417453    my $fault = $faulted_rows{$rownum};
    418454    $fault = $PSTAMP_NO_IMAGE_MATCH if ($fault eq 'no_fault');
    419455    print STDERR "insert faulted job for $rownum: $fault\n";
     456    my $command = "$pstamptool -addjob -req_id $req_id -outputBase $outputBase -job_type detect_query -state stop -rownum $rownum -fault $fault";
     457    unless ($no_update) {
     458        my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     459            run(command => $command, verbose => $verbose);
     460        if ($success) {
     461            my $job_id = join "", @$stdout_buf;
     462            print "   Queued job: $job_id\n";
     463        } else {
     464            my $exit_status = $error_code >> 8;
     465            $exit_status = $PS_EXIT_UNKNOWN_ERROR unless $exit_status;
     466            my_die("Unable to perform $command error code: $error_code", $exit_status);
     467        }
     468    } else {
     469        print STDERR "skipping $command\n";
     470    }
     471    $job_num++;
    420472}
    421473
Note: See TracChangeset for help on using the changeset viewer.