IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jul 29, 2010, 1:50:08 PM (16 years ago)
Author:
watersc1
Message:

functional, not 100% tested version of updated detectability server. Will test on the test pstamp server this afternoon

File:
1 edited

Legend:

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

    r27874 r28777  
    102102    if $extname ne "MOPS_DETECTABILITY_QUERY";
    103103my_die("$req_file is version $extver expecting 1", $PS_EXIT_PROG_ERROR)
    104     if $extver ne 1;
     104    if ($extver ne 1) and ($extver ne 2);
    105105
    106106# Set up the workdir for this query.
     
    129129    $fault = $error_code >> 8;
    130130    if ($fault == $PSTAMP_NOT_AVAILABLE) {
    131         $data_to_update = (split /\n/, (join "", @$stdout_buf))[-1];   
     131        unless (-e "$outdir/update_request.dat") {
     132            my_die ("Update request indicated, but unable to find actual request!", $PS_EXIT_PROG_ERROR);
     133        }
    132134    }   
     135   
    133136}
    134137
     
    158161    # Failed to run correctly, which means that we need to queue a job and flag data for updating.
    159162    # Get the dependency id for the data we're requesting be updated.
    160     my $dep_id = queue_update_run($req_id,$job_id,$outdir,$label,$data_to_update);
    161 
    162     # Link this request to a job and link that job to any dependency
    163     my $command = "$pstamptool -addjob -req_id $req_id -outputBase $outdir";
    164     $command .= " -job_type detect_query -state run -fault 0";
    165     $command .= " -rownum 1";
    166     $command .= " -dep_id $dep_id" if $dep_id;
    167 
    168     my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    169         run(command => $command, verbose => $verbose);
    170 
    171     if ($success) {
    172         $job_id = join "", @$stdout_buf;
    173         chomp $job_id;
    174         if ($job_id && -e $response_file) {
    175             # We shouldn't have a response file at this stage.
    176             rename $response_file, "$outdir/response${job_id}.fits";
    177         }
    178         $result = 0;
    179     } else {
    180         warn("Unable to perform $command error code: $error_code");
    181         $result = $error_code >> 8;
    182     }
     163    open(UPDATE_REQUEST,"$outdir/update_request.dat") || my_die ("Update request indicated, but unable to find actual request!", $PS_EXIT_PROG_ERROR);
     164    while (<UPDATE_REQUEST>) {
     165        my $data_to_update = $_;
     166        chomp($data_to_update);
     167        my $dep_id = queue_update_run($req_id,$job_id,$outdir,$label,$data_to_update);
     168
     169        # Link this request to a job and link that job to any dependency
     170        my $command = "$pstamptool -addjob -req_id $req_id -outputBase $outdir";
     171        $command .= " -job_type detect_query -state run -fault 0";
     172        $command .= " -rownum 1";
     173        $command .= " -dep_id $dep_id" if $dep_id;
     174
     175        my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     176            run(command => $command, verbose => $verbose);
     177
     178        if ($success) {
     179            $job_id = join "", @$stdout_buf;
     180            chomp $job_id;
     181            if ($job_id && -e $response_file) {
     182                # We shouldn't have a response file at this stage.
     183                rename $response_file, "$outdir/response${job_id}.fits";
     184            }
     185            $result = 0;
     186        } else {
     187            warn("Unable to perform $command error code: $error_code");
     188            $result = $error_code >> 8;
     189        }
     190    }
     191    close(UPDATE_REQUEST);
    183192}
    184193
Note: See TracChangeset for help on using the changeset viewer.