Index: trunk/pstamp/scripts/pstampparse.pl
===================================================================
--- trunk/pstamp/scripts/pstampparse.pl	(revision 24961)
+++ trunk/pstamp/scripts/pstampparse.pl	(revision 24962)
@@ -146,5 +146,4 @@
     $stage = $row->{IMG_TYPE};
     my $id       = $row->{ID};
-    my $class_id = $row->{CLASS_ID};
     my $component = $row->{COMPONENT};
 
@@ -159,5 +158,4 @@
 
     my $skycenter = $row->{skycenter} = ! ($row->{COORD_MASK} & $PSTAMP_CENTER_IN_PIXELS);
-    $class_id = "" if (defined($class_id) and ($class_id eq "null" or $class_id eq "all"));
     $component = "" if (defined($component) and ($component eq "null" or $component eq "all"));
     
@@ -178,5 +176,5 @@
     if (@rowList) {
         my $firstRow = $rowList[0];
-        # the collecting might work with !$skycenter but I need to think about it
+        # XXX: the collecting might work with !$skycenter but I need to think about it
         if ($skycenter and same_images_of_interest($row, $firstRow)) {
             push @rowList, $row;
@@ -185,5 +183,5 @@
         } else {
             # queue the jobs for this set of rows
-            $num_jobs += queueJobs($mode, $stage, $need_magic, \@rowList, $imageList);
+            $num_jobs += queueJobs($mode, \@rowList, $imageList);
             @rowList = ();
         }
@@ -198,5 +196,5 @@
         # request specification. An array reference is returned
         my ($x, $y);
-        $imageList = locate_images($ipprc, $image_db, $req_type, $stage, $id, $class_id, $skycenter,
+        $imageList = locate_images($ipprc, $image_db, $req_type, $stage, $id, $component, $skycenter,
                 $x, $y, $mjd_min, $mjd_max, $filter, $verbose);
     }
@@ -206,9 +204,10 @@
         next;
     }
+    $row->{need_magic} = $need_magic;
     push @rowList, $row;
 }
 
 if (@rowList) {
-    $num_jobs += queueJobs($mode, $stage, $need_magic, \@rowList, $imageList);
+    $num_jobs += queueJobs($mode, \@rowList, $imageList);
 }
 
@@ -229,4 +228,5 @@
 {
     my $row = shift;
+    my $stage = shift;
     my $imageList = shift;
     my $have_skycells = shift;
@@ -237,10 +237,8 @@
     foreach my $image (@$imageList) {
         my $component;
-        my $class_id;   # get rid of this use componet
         if ($have_skycells) {
             $component = $image->{skycell_id};
         } else {
             $component = $image->{class_id};
-            $class_id = $component;
         }
 
@@ -252,7 +250,5 @@
         my $roi_string;
 
-        # XXX we're depending on other code to insure valid values for roi components
-        # this is checked in and ppstamp but I should check here so that we don't get that far,
-        # but not today
+        # note values were insured to be numbers in validROI()
         my $x = $row->{CENTER_X};
         my $y = $row->{CENTER_Y};
@@ -282,10 +278,9 @@
             
         my $args = $roi_string ? $roi_string : "";
-        $args .= " -class_id $class_id" if $class_id;
+        if ($stage eq "raw" or $stage eq "chip") {
+            $args .= " -class_id $component" if $component;
+        }
 
         $job_num++;
-
-        my $output_base = "$out_dir/${rownum}_${job_num}";
-        my $argslist = "${output_base}.argslist";
 
         # add astrometry file for raw and chip images if one is available
@@ -300,6 +295,9 @@
         }
         if (($row->{OPTION_MASK} & $PSTAMP_SELECT_WEIGHT) and $image->{weight} ) {
-            $args .= " -weight $image->{weight}";
-        }
+            $args .= " -variance $image->{weight}";
+        }
+
+        my $output_base = "$out_dir/${rownum}_${job_num}";
+        my $argslist = "${output_base}.args";
 
         # copy the argument list to a file
@@ -314,8 +312,6 @@
 
         $num_jobs++;
-        my $command = "$pstamptool -addjob -req_id $req_id -job_type $row->{JOB_TYPE}"
-            . " -uri $argslist -outputBase $output_base -rownum $rownum"
-            . " -state $newState";
-#        $command .= " -args '$args'" if $args;
+        my $command = "$pstamptool -addjob  -req_id $req_id -job_type $row->{JOB_TYPE}"
+                        . " -outputBase $output_base -rownum $rownum -state $newState";
         $command .= " -exp_id $exp_id" if $exp_id;
         $command .= " -dbname $dbname" if $dbname;
@@ -326,5 +322,5 @@
             # this is sort of like the mode -noupdate that some other tools support
             print "$command\n";
-        } else {
+        } elsif (!$no_update) {
             # mode eq "queue_job"
             my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
@@ -337,4 +333,6 @@
                 die "failed to queue job for request $req_id";
             }
+        } else {
+            print "skipping command: $command\n";
         }
     }
@@ -345,11 +343,11 @@
 {
     my $mode = shift;
-    my $stage = shift;
-    my $need_magic = shift;
     my $rowList = shift;
     my $imageList = shift;
 
     my $firstRow = $rowList[0];
+    my $stage    = $firstRow->{IMG_TYPE};
     my $job_type = $firstRow->{JOB_TYPE};
+    my $need_magic = $firstRow->{need_magic};
 
     my $num_jobs = 0;
@@ -394,5 +392,6 @@
                     my $astrom = $thisRun->[0]->{astrom};
                     die "no astrometry file found" if !$astrom;
-                    $command .= " -astrom $astrom";
+                    my $astrom_resolved = $ipprc->file_resolve($astrom);
+                    $command .= " -astrom $astrom_resolved";
                 }
                 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
@@ -418,5 +417,5 @@
             
             foreach my $row (@$rowList) {
-                $num_jobs += queueJobsForRow($row, $thisRun, $have_skycells, $need_magic);
+                $num_jobs += queueJobsForRow($row, $stage, $thisRun, $have_skycells, $need_magic);
             }
         }
@@ -461,4 +460,5 @@
 
         my $image = shift @$imageList;
+        $image->{stage} = $stage;
         push @runList, $image;
         $last_run_id = $run_id;
