IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 25122


Ignore:
Timestamp:
Aug 19, 2009, 9:21:47 AM (17 years ago)
Author:
bills
Message:

it is now a programming error if no jobs get queued for a request. At least a "fake" one should be entered.

File:
1 edited

Legend:

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

    r25112 r25122  
    9494        if (!mkdir $out_dir) {
    9595            print STDERR "cannot create output directory $out_dir";
    96             stop_request($req_id, $PS_EXIT_UNKNOWN_ERROR);
     96            stop_request_and_exit($req_id, $PS_EXIT_UNKNOWN_ERROR);
    9797        }
    9898
     
    102102        # request
    103103        print STDERR "output directory $out_dir exists but is not a directory";
    104         stop_request($req_id, $PS_EXIT_UNKNOWN_ERROR);
     104        stop_request_and_exit($req_id, $PS_EXIT_UNKNOWN_ERROR);
    105105    }
    106106
    107107    if (! -e $req_file ) {
    108108        print STDERR "request file $req_file is missing\n";
    109         stop_request($req_id, $PS_EXIT_CONFIG_ERROR);
     109        stop_request_and_exit($req_id, $PS_EXIT_CONFIG_ERROR);
    110110    }
    111111
     
    117117        # point
    118118        print STDERR "failed to read request_file $req_file" ;
    119         stop_request($req_id, $PS_EXIT_CONFIG_ERROR);
     119        stop_request_and_exit($req_id, $PS_EXIT_CONFIG_ERROR);
    120120    }
    121121
     
    154154                print STDERR "Request $req_id produced no jobs.\n"
    155155            }
     156            # This should not happen. A fake job should be queued
     157            stop_request_and_exit($req_id, $PS_EXIT_PROG_ERROR);
     158if (0) {
    156159            # No Jobs.
    157160            # XXXX Ouch. We need results for each rownum (each request specification) in the request file
    158161            # including those that produced no jobs.
    159             # for now add an entry for rownum 1 and a phony error code.
     162            # That did not happen for some reason.
     163            # Add an entry with rownum 0 with an error code
    160164            # we've included parse_error.txt to the fileset if it exists
     165            # so the requester should get some idea what happened
    161166            #
    162167            my $rownum = 0;
    163             my $fault = 42; # get a real error code
     168            my $fault = $PSTAMP_NO_JOBS_QUEUED;
    164169            print $tdf "$rownum|$fault|0|0|";
    165             print $tdf "0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|\n";
     170            print $tdf "0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|\n";
     171}
    166172        } else {
    167173            my $metadata = $mdcParser->parse($output) or die("Unable to parse metdata config doc");
     
    186192            # on the data store since the product name is already used
    187193            # maybe we could be more clever about this and choose a fileset name
    188             stop_request($req_id, $fault);
     194            stop_request_and_exit($req_id, $fault);
    189195        }
    190196
     
    196202            carp("failed to find imagedb for project: $project");
    197203            if (!$fault) {
    198                 stop_request($req_id, $PS_EXIT_CONFIG_ERROR);
     204                stop_request_and_exit($req_id, $PS_EXIT_CONFIG_ERROR);
    199205            }
    200206        }
     
    287293}
    288294
    289 sub stop_request {
     295sub stop_request_and_exit {
    290296    my $req_id = shift;
    291297    my $fault  = shift;
Note: See TracChangeset for help on using the changeset viewer.