IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Apr 1, 2014, 11:03:38 AM (12 years ago)
Author:
eugene
Message:

merge changes from trunk

Location:
branches/eam_branches/ipp-20140206
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20140206

  • branches/eam_branches/ipp-20140206/pstamp/scripts/pstamp_insert_request.pl

    r35487 r36627  
    4545my $pstamptool = can_run('pstamptool')  or (warn "Can't find pstamptool"  and $missing_tools = 1);
    4646my $fields = can_run('fields')  or (warn "Can't find fields"  and $missing_tools = 1);
     47my $fhead = can_run('fhead')  or (warn "Can't find fhead"  and $missing_tools = 1);
    4748
    4849if ($missing_tools) {
     
    5657    # Note that if it's a pstamp request then REQ_NAME should be defined.
    5758    # if it's a detectability query it will not have a REQ_NAME but will have a QUERY_ID
    58     my $command = "echo $tmp_req_file | $fields -x 0 EXTNAME EXTVER REQ_NAME QUERY_ID";
     59    # my $command = "echo $tmp_req_file | $fields -x 0 EXTNAME EXTVER REQ_NAME QUERY_ID";
     60    my $command = "$fhead -x 0 $tmp_req_file";
    5961    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    6062        run(command => $command, verbose => $verbose);
    61 if (0) {
    62     # stoopid fields doesn't set exit status to zero when it works
    6363    unless ($success) {
    6464        print STDERR @$stderr_buf;
    6565        exit $error_code >> 8;
    6666    }
    67 }
    6867    my $output = join "", @$stdout_buf;
    69     (undef, $extname, $extver, $req_name) = split " ", $output;
     68
     69
     70    my $makehash = 0;
     71    my %hash;
     72    foreach my $line (split "\n", $output) {
     73        chomp $line;
     74        # split lines inte left and right using equals sign. left is the keyword
     75        my ($key, $right) = split "=", $line;
     76            # skip if there was no '='
     77        next if !$right;
     78
     79        $key =~ s/ //g;
     80
     81        # separate value from comment
     82        my ($value, $comment) = split "/", $right;
     83        # remove ' and space characters from key and value
     84        $value =~ s/'//g;
     85        $value =~ s/ //g;
     86
     87        #    print "$key $value\n";
     88
     89        # extract the values that we are looking for
     90        $extname  = $value if ($key eq "EXTNAME");
     91        $extver   = $value if ($key eq "EXTVER");
     92        $req_name = $value if ($key eq "REQ_NAME");
     93        $req_name = $value if ($key eq "QUERY_ID");
     94
     95        # optionally build hash. Duplicate keys get the last value seen
     96        if ($makehash) {
     97            $hash{$key} = $value;
     98        }
     99    }
     100
     101    # (undef, $extname, $extver, $req_name) = split " ", $output;
     102
    70103    if (!$extname or ! (($extname eq "PS1_PS_REQUEST") or ($extname eq "MOPS_DETECTABILITY_QUERY"))) {
    71104        print STDERR "invalid request file\n";
     105        print "invalid request file\n";
    72106        exit $PS_EXIT_DATA_ERROR;
    73107    }
     108
    74109    if (!defined $req_name) {
    75110        print STDERR "invalid request file no REQ_NAME or QUERY_ID\n";
     111        print "invalid request file no REQ_NAME or QUERY_ID\n";
     112        exit $PS_EXIT_DATA_ERROR;
     113    }
     114    if (!defined $extver) {
     115        print STDERR "invalid request file no EXTVER found\n";
     116        print "invalid request file no EXTVER found\n";
    76117        exit $PS_EXIT_DATA_ERROR;
    77118    }
     
    119160
    120161exit 0;
     162
    121163# Ask the database for the next web request number
    122164sub get_webreq_num
  • branches/eam_branches/ipp-20140206/pstamp/scripts/pstampparse.pl

    r36165 r36627  
    243243my $watch_for_big_requests = (!($label =~ /BIG/) and ($label =~ /PSI/ or $label =~ /WEB/));
    244244
    245 my $big_limit = 100;    # XXX: this should be in a configuration file somewhere not hard coded
     245# XXX: these should be in a configuration file somewhere not hard coded
     246my $big_limit = 100;
     247my $job_big_limit = 400;
    246248
    247249if ($watch_for_big_requests and $nRows > $big_limit) {
     
    267269
    268270    # see whether number of jobs limit for high priority request was exceeded
    269     if ($watch_for_big_requests and $num_jobs > $big_limit) {
     271    if ($watch_for_big_requests and $num_jobs > $job_big_limit) {
    270272        $label = change_to_lower_priority_label($label);
    271273        $watch_for_big_requests = 0;
     
    311313    my $rownum   = $row->{ROWNUM};
    312314    if (!validID($rownum)) {
     315        $rownum = 'NULL' if !defined $rownum;
    313316        print STDERR "$rownum is not a valid ROWNUM\n";
    314317        insertFakeJobForRow($row, 1, $PSTAMP_INVALID_REQUEST);
     
    316319    }
    317320    my $job_type = $row->{JOB_TYPE};
    318     if (($job_type ne "stamp") and ($job_type ne "get_image")) {
     321    if (!defined $job_type || (($job_type ne "stamp") and ($job_type ne "get_image"))) {
     322        $job_type = 'NULL' if !defined $job_type;
    319323        print STDERR "$job_type is not a valid JOB_TYPE\n";
    320324        insertFakeJobForRow($row, 1, $PSTAMP_INVALID_REQUEST);
     
    325329    if (($req_type ne "byid") and ($req_type ne "bycoord") and ($req_type ne "byexp") and
    326330        ($req_type ne "byskycell") and ($req_type ne "bydiff")) {
     331        $req_type = 'NULL' if !defined $req_type;
    327332        print STDERR "$req_type is not a valid REQ_TYPE\n";
    328333        insertFakeJobForRow($row, 1, $PSTAMP_INVALID_REQUEST);
Note: See TracChangeset for help on using the changeset viewer.