IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 25052


Ignore:
Timestamp:
Aug 11, 2009, 4:14:07 PM (17 years ago)
Author:
bills
Message:

if no matching images are found, insert a fake job in stopped state with
fault set so that the result can be reported in the results file

File:
1 edited

Legend:

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

    r24962 r25052  
    161161   
    162162    die "job_type is list_uri but mode is $mode" if ($job_type eq "list_uri") and ($mode ne "list_uri");
    163 
    164163
    165164    # note: resolve_project avoids running pstamptool every time by remembering the
     
    202201    if (!$imageList or !@$imageList) {
    203202        print STDERR "no matching images found for row $rownum\n";
    204         next;
    205203    }
    206204    $row->{need_magic} = $need_magic;
     
    269267        }
    270268
     269        $job_num++;
     270
    271271        my $imagefile = $image->{image};
    272272        if (($stage ne "stack") and ($need_magic and !$image->{magicked})) {
    273273            # XXX: should we add a faulted job so the client can know what happened?
    274             print STDERR "skippping non-magicked image $imagefile\n" if $verbose;
     274            # print STDERR "skippping non-magicked image $imagefile\n" if $verbose;
     275
     276            insertFakeJobForRow($row, $job_num, 43);
     277
    275278            next;
    276279        }
     
    281284            $args .= " -class_id $component" if $component;
    282285        }
    283 
    284         $job_num++;
    285286
    286287        # add astrometry file for raw and chip images if one is available
     
    360361        die "get_image jobs not implemented yet";
    361362    } else {
     363        if (!$imageList or (scalar @$imageList eq 0)) {
     364            # we didn't find any images for this set of rows. Insert a fake job to carry
     365            # the status back to the requestor
     366            foreach my $row (@$rowList) {
     367                insertFakeJobForRow($row, 1, 42);
     368                $num_jobs++;
     369            }
     370            return $num_jobs;
     371        }
    362372        my $thisRun;
    363373
     
    423433    return $num_jobs;
    424434}
     435sub insertFakeJobForRow
     436{
     437    my $row = shift;
     438    my $job_num = shift;
     439    my $fault = shift;
     440
     441    my $command = "$pstamptool -addjob  -req_id $req_id -job_type $row->{JOB_TYPE}"
     442                        . " -rownum $row->{ROWNUM} -state stop -fault $fault";
     443    $command .= " -dbname $dbname" if $dbname;
     444    $command .= " -dbserver $dbserver" if $dbserver;
     445
     446    if ($mode eq "list_job") {
     447        # this is a debugging mode, just print the pstamptool that would have run
     448        # this is sort of like the mode -noupdate that some other tools support
     449        print "$command\n";
     450    } elsif (!$no_update) {
     451        # mode eq "queue_job"
     452        my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     453            run(command => $command, verbose => $verbose);
     454        unless ($success) {
     455            print STDERR @$stderr_buf;
     456            # XXX TODO: now what? Should we mark the error state for the request?
     457            # should we keep going for other uris? If so how do we report that some
     458            # of the work that the request wanted isn't going to get done
     459            die "failed to queue job for request $req_id";
     460        }
     461    } else {
     462        print "skipping command: $command\n";
     463    }
     464}
    425465
    426466sub get_run_id
Note: See TracChangeset for help on using the changeset viewer.