IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 33324


Ignore:
Timestamp:
Feb 21, 2012, 4:11:24 PM (14 years ago)
Author:
bills
Message:

More changes for detectability queries. This version works.

Location:
trunk/pstamp/scripts
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/pstamp/scripts/Makefile.am

    r30469 r33324  
    2929        detect_query_create \
    3030        detect_response_create \
     31        dquery_job_run.pl \
    3132        dquery_finish.pl \
    3233        dqueryparse.pl \
  • trunk/pstamp/scripts/dquery_finish.pl

    r33286 r33324  
    143143
    144144if (-s $reg_list) {
    145     my $command = "echo Skipping $dsreg --add $req_name --product $product --list $reg_list";
     145    my $command = "$dsreg --add $req_name --product $product --list $reg_list";
    146146    $command .= " --copy --datapath $outdir";
    147147    $command .= " --type MOPS_DETECTABILITY_RESPONSE";
  • trunk/pstamp/scripts/dqueryparse.pl

    r33299 r33324  
    100100
    101101
     102#
     103# query is a hash which uses $fpa_id as the key
     104# The values are hash references which have the various parameter name as the key
     105#   The values of the parameter hashes are arrays which contain the values for individual rows
     106#   in the detectabilty query request
    102107my %query = ();
    103 my %image_list_hash = ();
    104108
    105109{
    106110    #
    107111    # Parse input request file using detect_query_read
     112    # result is a simple text file
    108113    #
    109114    my $dqr_command = "$detect_query_read --dbname $imagedb --input $request_file";
     
    139144    }
    140145    #
    141     # Identify target images.  This should properly collate targets on a single imfile.
     146    # Identify target components.  This should properly collate targets on a single imfile.
    142147    #
    143148    my $query_id;
     
    223228        $option_mask |= $PSTAMP_SELECT_VARIANCE;
    224229        $option_mask |= $PSTAMP_SELECT_PSF;
    225         my $need_magic = 1;
     230
     231        # magic is dead
     232        my $need_magic = 0;
    226233        if ($stage eq 'stack') {
    227234            $need_magic = 0;
     
    245252        foreach my $this_image_ref (@{ $pstamp_images_ref }) {
    246253
    247             if (0) {
    248                 foreach my $key (sort (keys %{ $this_image_ref } )) {
    249                     my $value = ${ $this_image_ref }{$key};
    250                     if ($key eq 'row_index') {
    251                         $value = join ' ', @{ $this_image_ref->{$key} };
    252                     }
    253                     print "$this_image_ref $key $value\n";
    254                 }
    255             }
    256 
    257 
     254            # loop over the rows that this component matched
    258255            foreach my $valid_index (@{ $this_image_ref->{row_index} }) {
    259256                $query{$fpa_id}{IMAGE}[$valid_index] = $this_image_ref->{image};
     
    336333foreach my $fpa_id (keys %query) {
    337334    for (my $i = 0; $i <= $#{ $query{$fpa_id}{ROWNUM} }; $i++) {
    338 #        print WISDOM "$fpa_id\t";
    339 #        foreach my $key (keys %{ $query{$fpa_id} }) {
    340 #            print WISDOM "$key $query{$fpa_id}{$key}[$i]\t";
    341 #        }
    342 #        print WISDOM "\n";
    343 #        my $data_state = $query{$fpa_id}{DATA_STATE}[$i];
    344 #        if ($query{$fpa_id}{BAD_COMPONENT}[$i] == 0) {
    345 #            if ($data_state ne 'full') {
    346                
    347 #                @{ $update_request{$query{$fpa_id}{IMAGE}[$i]}{$query{$fpa_id}{FAULT}[$i]} } =
    348 #                    ($query{$fpa_id}{STATE}[$i],$query{$fpa_id}{STAGE}[$i],$query{$fpa_id}{STAGE_ID}[$i],
    349 #                     $query{$fpa_id}{COMPONENT_ID}[$i],$query{$fpa_id}{NEED_MAGIC}[$i],$query{$fpa_id}{IMAGE_DB}[$i]);
    350 #            }
    351 #        }
    352335        if ($query{$fpa_id}{BAD_COMPONENT}[$i] == 0) {
    353336            push @{ $rows_for_component{$fpa_id}{$query{$fpa_id}{IMAGE}[$i]} }, $i;
     
    358341}
    359342
    360 my $job_num = 0;
     343#
     344# Finally build the parameter lists and queue jobs for each component
     345#
     346
     347my $job_num = 1;
    361348foreach my $fpa_id (keys %rows_for_component) {
    362349    foreach my $component (keys % {$rows_for_component{$fpa_id} } ) {
     
    368355            my $stage = $query{$fpa_id}{STAGE}[$i];
    369356            my $stage_id = $query{$fpa_id}{STAGE_ID}[$i];
    370             my $component = $query{$fpa_id}{STAGE_ID}[$i];
     357            my $component = $query{$fpa_id}{COMPONENT_ID}[$i];
    371358            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) = @_;
    372360            $dep_id = queue_update_run($req_id, $outdir, $label, $data_state, $stage, $stage_id, $component, 0, $imagedb);
    373361        }
    374362
    375363        my $outputBase = "$outdir/$job_num" . "_";
     364
     365        # params_file is an mdc description containing the parameters for the job
    376366        my $params_file = $outputBase . "params.mdc";
    377367
    378368        open PARAMS, ">$params_file" or my_die("failed to create $params_file", $PS_EXIT_UNKNOWN_ERROR);
     369
     370        # first the job params
    379371        print PARAMS "dqueryJobParams METADATA\n";
    380372        foreach my $key (keys %{ $query{$fpa_id} } ) {
     
    383375        }
    384376        print PARAMS "END\n\n";
     377
     378        # then one structure with the coordinates for each row
    385379        print PARAMS "dqueryCoord MULTI\n";
    386380
     381        my @coordkeys = qw(ROWNUM RA1_DEG DEC1_DEG RA2_DEG DEC2_DEG MAG);
    387382        foreach my $row ( @{ $rows_for_component{$fpa_id}{$component} }) {
    388             my @coordkeys = qw(ROWNUM RA1_DEG DEC1_DEG RA2_DEG DEC2_DEG MAG);
    389383            print PARAMS "\ndqueryCoord METADATA\n";
    390384            foreach my $key (@coordkeys) {
  • trunk/pstamp/scripts/pstamp_job_run.pl

    r33141 r33324  
    7979my $ppstamp    = can_run('ppstamp') or (warn "Can't find ppstamp" and $missing_tools = 1);
    8080my $pstamp_get_image_job    = can_run('pstamp_get_image_job.pl') or (warn "Can't find pstamp_get_image_job.pl" and $missing_tools = 1);
    81 my $dqueryparse = can_run('dqueryparse.pl') or (warn "Can't find dqueryparse.pl" and $missing_tools = 1);
     81my $dquery_job_run = can_run('dquery_job_run.pl') or (warn "Can't find dquery_job_run.pl" and $missing_tools = 1);
    8282my $streaksreplace = can_run('streaksreplace')  or (warn "Can't find streaksreplace"  and $missing_tools = 1);
    8383my $magicdstool = can_run('magicdstool')  or (warn "Can't find magicdstool"  and $missing_tools = 1);
     
    303303    }
    304304} elsif ($jobType eq "detect_query") {
    305     # detect_query jobs are basically holders to note that we need a file updated before we can continue.
    306     # Load the argument list that dqueryparse should have created the first time it ran, so we know how to
    307     # run it again the same way.
    308     my $outdir = dirname($outputBase);
    309     my $argslist = "$outdir/parse.args";
    310     open ARGSLIST, "<$argslist" or my_die("failed to open argslist file $argslist", $job_id, $PS_EXIT_UNKNOWN_ERROR);
    311     my $argString = <ARGSLIST>;
    312     close ARGSLIST;
    313     chomp $argString;
     305    # my $outdir = dirname($outputBase);
     306    # my $argslist = "$outdir/parse.args";
     307    # open ARGSLIST, "<$argslist" or my_die("failed to open argslist file $argslist", $job_id, $PS_EXIT_UNKNOWN_ERROR);
     308    # my $argString = <ARGSLIST>;
     309    # close ARGSLIST;
     310    # chomp $argString;
    314311
    315312    # XXX: should we do any other sanity checking?
    316     my_die("arglist file $argslist is empty", $job_id, $PS_EXIT_DATA_ERROR) if !$argString;
    317 
    318     my $command = "$dqueryparse --job_id $job_id $argString";
     313    # my_die("arglist file $argslist is empty", $job_id, $PS_EXIT_DATA_ERROR) if !$argString;
     314
     315    my $command = "$dquery_job_run --job_id $job_id --output_base $outputBase";
    319316    $command .= " --dbname $dbname" if $dbname;
    320317    $command .= " --dbserver $dbserver" if $dbserver;
     
    329326    } else {
    330327        $jobStatus = $error_code >> 8;
    331         my_die("dqueryparse.pl failed with error code: $jobStatus", $job_id, $jobStatus);
     328        my_die("dquery_job_run.pl failed with error code: $jobStatus", $job_id, $jobStatus);
    332329    }
    333330} elsif ($jobType eq "child") {
Note: See TracChangeset for help on using the changeset viewer.