Index: /trunk/PS-IPP-PStamp/lib/PS/IPP/PStamp/Job.pm
===================================================================
--- /trunk/PS-IPP-PStamp/lib/PS/IPP/PStamp/Job.pm	(revision 26288)
+++ /trunk/PS-IPP-PStamp/lib/PS/IPP/PStamp/Job.pm	(revision 26289)
@@ -43,5 +43,5 @@
     my $mjd_max  = shift;
     my $filter   = shift;
-    my $label    = shift;
+    my $data_group    = shift;
     my $verbose  = shift;
 
@@ -128,5 +128,5 @@
     }
 
-    my $results = lookup($ipprc, $image_db, $req_type, $img_type, $id, $tess_id, $component, $need_magic, $x, $y, $dateobs_begin, $dateobs_end, $filter, $label, $verbose);
+    my $results = lookup($ipprc, $image_db, $req_type, $img_type, $id, $tess_id, $component, $need_magic, $x, $y, $dateobs_begin, $dateobs_end, $filter, $data_group, $verbose);
 
     return $results;
@@ -148,5 +148,5 @@
     my $dateobs_end   = shift;
     my $filter = shift;
-    my $label = shift;
+    my $data_group = shift;
     my $verbose  = shift;
 
@@ -281,5 +281,5 @@
 
     $command .= " -filter $filter" if !isnull($filter);
-    $command .= " -label $label" if !isnull($label);
+    $command .= " -data_group $data_group" if !isnull($data_group);
 
     # run the tool and parse the output
Index: /trunk/pstamp/scripts/pstamp_check_dependents.pl
===================================================================
--- /trunk/pstamp/scripts/pstamp_check_dependents.pl	(revision 26288)
+++ /trunk/pstamp/scripts/pstamp_check_dependents.pl	(revision 26289)
@@ -25,5 +25,5 @@
 use PS::IPP::PStamp::Job qw( :standard );
 
-my ( $dep_id, $dep_state, $stage, $stage_id, $imagedb, $rlabel, $no_magic, $dbname, $dbserver);
+my ( $dep_id, $dep_state, $stage, $stage_id, $imagedb, $no_magic, $dbname, $dbserver);
 my ( $no_update, $verbose, $save_temps, $logfile);
 
@@ -34,5 +34,4 @@
            'stage_id=s'     => \$stage_id,
 	   'imagedb=s'      => \$imagedb,
-	   'rlabel=s'       => \$rlabel,
 	   'no-magic=s'     => \$no_magic,
 	   'dbname=s'       => \$dbname,
@@ -46,6 +45,6 @@
 pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV;
 
-die "--dep_id --state --stage --stage_id --imagedb and --rlabel are requried \n"
-    if !$dep_id or !$dep_state or !$stage or !$stage_id or !$imagedb or !$rlabel;
+die "--dep_id --state --stage --stage_id and --imagedb are requried \n"
+    if !$dep_id or !$dep_state or !$stage or !$stage_id or !$imagedb;
 
 my $ipprc = PS::IPP::Config->new(); # IPP Configuration
@@ -103,13 +102,11 @@
     } else {
 
-        # XXX: TODO set label to the "standard" update value
-
         # don't update if in runs are in state goto_cleaned, wait for clean to finish
         if ($state eq "cleaned") {
-            runcommand("$chiptool -dbname $imagedb -chip_id $stage_id -updaterun -set_state update");
-        }
-
-        # don't update yet if magicDSRuns are in state goto_purged, wait for purge to finish
-        if ($magic_ds_state eq "purged") {
+            runcommand("$chiptool -dbname $imagedb -chip_id $stage_id -updaterun -set_state update -set_label update");
+        }
+
+        # don't update yet if magicDSRuns are in state goto_cleaned, wait for purge to finish
+        if ($magic_ds_state eq "cleaned") {
             my $magic_ds_id = $run_state->{magic_ds_id};
             runcommand("$magicdstool -dbname $imagedb -magic_ds_id $magic_ds_id -updaterun -set_state new");
@@ -145,18 +142,16 @@
     } else {
 
-        # XXX: TODO set label to the "standard" update value
-
         # don't update if in runs are in state goto_cleaned, wait for clean to finish
         if ($state eq 'cleaned') {
-            runcommand("$warptool -dbname $imagedb -warp_id $stage_id -updaterun -set_state update");
+            runcommand("$warptool -dbname $imagedb -warp_id $stage_id -updaterun -set_state update -set_label update");
         }
 
         if ($chip_state eq 'cleaned') {
             my $chip_id = $run_state->{chip_id};
-            runcommand("$chiptool -dbname $imagedb -chip_id $chip_id -updaterun -set_state update");
-        }
-
-        # don't update yet if magicDSRuns are in state goto_purged, wait for purge to finish
-        if ($magic_ds_state eq 'purged') {
+            runcommand("$chiptool -dbname $imagedb -chip_id $chip_id -updaterun -set_state update -set_label update");
+        }
+
+        # don't update yet if magicDSRuns are in state goto_cleaned, wait for purge to finish
+        if ($magic_ds_state eq 'cleaned') {
             my $magic_ds_id = $run_state->{magic_ds_id};
             runcommand("$magicdstool -dbname $imagedb -magic_ds_id $magic_ds_id -updaterun -set_state new");
@@ -190,7 +185,9 @@
         }
         return join "", @$stdout_buf if defined wantarray();
+        return $success;
     } else {
         print STDERR "skipping $command\n";
     }
+    return 1;
 }
 
Index: /trunk/pstamp/scripts/pstamp_finish.pl
===================================================================
--- /trunk/pstamp/scripts/pstamp_finish.pl	(revision 26288)
+++ /trunk/pstamp/scripts/pstamp_finish.pl	(revision 26289)
@@ -315,11 +315,15 @@
     my $comment = $row->{COMMENT};
     $comment = "null" if !$comment;
-    my $label = $row->{LABEL};
-    $label = "null" if !$label;
+    my $data_group = $row->{DATA_GROUP};
+    if (!defined $data_group) {
+        # XXX: backwards compatibility hook. Remove "soon".
+        $data_group = $row->{LABEL};
+    }
+    $data_group = "null" if !$data_group;
 
     # This is ugly, error prone and hard to change.
     # Create a results file module and provide a list of the names (we have the data in the columns)
     my $rowinfo = "$row->{PROJECT}|$row->{JOB_TYPE}|$row->{REQ_TYPE}|$row->{IMG_TYPE}|";
-    $rowinfo   .= "$row->{ID}|$tess_id|$component|$label|$row->{OPTION_MASK}|$row->{MJD_MIN}|$row->{MJD_MAX}|";
+    $rowinfo   .= "$row->{ID}|$tess_id|$component|$data_group|$row->{OPTION_MASK}|$row->{MJD_MIN}|$row->{MJD_MAX}|";
     $rowinfo   .= "$row->{REQFILT}|$row->{COORD_MASK}|$row->{CENTER_X}|$row->{CENTER_Y}|";
     $rowinfo   .= "$row->{WIDTH}|$row->{HEIGHT}|";
Index: /trunk/pstamp/scripts/pstamp_request_file
===================================================================
--- /trunk/pstamp/scripts/pstamp_request_file	(revision 26288)
+++ /trunk/pstamp/scripts/pstamp_request_file	(revision 26289)
@@ -69,5 +69,5 @@
         { name => 'COMPONENT',  type => '64A', writetype => TSTRING },
 
-        { name => 'LABEL ',     type => '64A', writetype => TSTRING },
+        { name => 'DATA_GROUP ',type => '64A', writetype => TSTRING },
 
         { name => 'REQFILT',    type => '16A', writetype => TSTRING },
@@ -324,5 +324,5 @@
     print "  REQ_NAME EXTVER\n\n";
     print "REQUEST specification (1 or more lines). Format:\n\n";
-    print "  ROWNUM CENTER_X CENTER_Y WIDTH HEIGHT COORD_MASK JOB_TYPE OPTION_MASK PROJECT REQ_TYPE IMG_TYPE ID TESS_ID COMPONENT LABEL REQFILT MJD_MIN MJD_MAX | COMMENT\n\n";
+    print "  ROWNUM CENTER_X CENTER_Y WIDTH HEIGHT COORD_MASK JOB_TYPE OPTION_MASK PROJECT REQ_TYPE IMG_TYPE ID TESS_ID COMPONENT DATA_GROUP REQFILT MJD_MIN MJD_MAX | COMMENT\n\n";
 
     exit 0;
Index: /trunk/pstamp/scripts/pstamp_results_file.pl
===================================================================
--- /trunk/pstamp/scripts/pstamp_results_file.pl	(revision 26288)
+++ /trunk/pstamp/scripts/pstamp_results_file.pl	(revision 26289)
@@ -90,5 +90,5 @@
         { name => 'TESS_ID',    type => '64A', writetype => TSTRING },    
         { name => 'COMPONENT',  type => '64A', writetype => TSTRING },    
-        { name => 'LABEL',      type => '64A', writetype => TSTRING },    
+        { name => 'DATA_GROUP', type => '64A', writetype => TSTRING },    
 
         # output parameters
Index: /trunk/pstamp/scripts/pstampparse.pl
===================================================================
--- /trunk/pstamp/scripts/pstampparse.pl	(revision 26288)
+++ /trunk/pstamp/scripts/pstampparse.pl	(revision 26289)
@@ -193,5 +193,10 @@
     my $mjd_min = $row->{MJD_MIN};
     my $mjd_max = $row->{MJD_MAX};
-    my $label   = $row->{LABEL};
+    my $data_group = $row->{DATA_GROUP};
+    if (!defined $data_group) {
+        # backwards compatability hook
+        $data_group = $row->{LABEL};
+    }
+        
     my $x       = $row->{CENTER_X};
     my $y       = $row->{CENTER_Y};
@@ -272,5 +277,5 @@
     # request specification. An array reference is returned.
     $imageList = locate_images($ipprc, $image_db, $req_type, $stage, $id, $tess_id, $search_component,
-                $inverse, $need_magic, $x, $y, $mjd_min, $mjd_max, $filter, $label, $verbose);
+                $inverse, $need_magic, $x, $y, $mjd_min, $mjd_max, $filter, $data_group, $verbose);
 
     if (!$imageList or !@$imageList) {
@@ -424,5 +429,5 @@
                     # set up to queue an update run
                     queue_update_run(\$newState, \$fault, \$dep_id, $image->{image_db}, 
-                        $run_state, $stage, $image->{stage_id}, $need_magic, $image->{label});
+                        $run_state, $stage, $image->{stage_id}, $need_magic);
                 }
             }
@@ -548,5 +553,5 @@
                 # we collected a set of sky coordinates above.
                 # filter the images so that only those that contain the centers of the ROIs are processed
-                my $command = "$dvoImagesAtCoords $pointsListName";
+                my $command = "$dvoImagesAtCoords -coords $pointsListName";
                 if ($have_skycells) {
                     my $tess_id = $thisRun->[0]->{tess_id};
@@ -671,5 +676,5 @@
                     # set up to queue an update run
                     queue_update_run(\$newState, \$fault, \$dep_id, $image->{image_db}, 
-                        $run_state, $stage, $image->{stage_id}, $need_magic, $image->{label});
+                        $run_state, $stage, $image->{stage_id}, $need_magic);
                 }
             }
@@ -801,5 +806,5 @@
     return 0 if ($r1->{TESS_ID}  ne $r2->{TESS_ID});
     return 0 if ($r1->{REQFILT}  ne $r2->{REQFILT});
-    return 0 if ($r1->{LABEL}    ne $r2->{LABEL});
+    return 0 if ($r1->{DATA_GROUP}    ne $r2->{DATA_GROUP});
     return 0 if ($r1->{MJD_MIN}  ne $r2->{MJD_MAX});
     return 0 if ($r1->{MJD_MAX}  ne $r2->{MJD_MAX});
@@ -850,5 +855,5 @@
 sub queue_update_run 
 {
-    my ($r_jobState, $r_fault, $r_dep_id, $imagedb, $state, $stage, $stage_id, $need_magic, $label) = @_;
+    my ($r_jobState, $r_fault, $r_dep_id, $imagedb, $state, $stage, $stage_id, $need_magic) = @_;
 
     if (($state ne 'cleaned') and ($state ne 'update') and ($state ne 'goto_cleaned')) {
@@ -858,5 +863,4 @@
     my $dep_id;
     my $command = "$pstamptool -getdependent -stage $stage -stage_id $stage_id -imagedb $imagedb";
-    $command .= " -rlabel $label" if $label;
     $command .= " -no_magic" if !$need_magic;
     if (!$no_update) {
Index: /trunk/pstamp/src/pstamprequest.c
===================================================================
--- /trunk/pstamp/src/pstamprequest.c	(revision 26288)
+++ /trunk/pstamp/src/pstamprequest.c	(revision 26289)
@@ -19,5 +19,5 @@
     "REQ_TYPE", // byid,  byexp, bydiff, bycoord
     "ID",       // db id, exposure name, diff_image_id, n/a
-    "CLASS_ID",
+    "COMPONENT",
     "REQFILT",
     "STAMP_NAME",
@@ -126,8 +126,8 @@
     switch (getType(argnum, pArgc, argv, options, "ID")) {
     case PSTAMP_RAW:
-        getId("CLASS_ID", argnum, pArgc, argv, options);
+        getId("COMPONENT", argnum, pArgc, argv, options);
         break;
     case PSTAMP_CHIP:
-        getId("CLASS_ID", argnum, pArgc, argv, options);
+        getId("COMPONENT", argnum, pArgc, argv, options);
         break;
     case PSTAMP_WARP:
@@ -145,8 +145,8 @@
     switch (getType(argnum, pArgc, argv, options, "ID")) {
     case PSTAMP_RAW:
-        getId("CLASS_ID", argnum, pArgc, argv, options);
+        getId("COMPONENT", argnum, pArgc, argv, options);
         break;
     case PSTAMP_CHIP:
-        getId("CLASS_ID", argnum, pArgc, argv, options);
+        getId("COMPONENT", argnum, pArgc, argv, options);
         break;
     case PSTAMP_WARP:
@@ -163,8 +163,8 @@
     switch (getType(argnum, pArgc, argv, options, NULL)) {
     case PSTAMP_RAW:
-        getId("CLASS_ID", argnum, pArgc, argv, options);
+        getId("COMPONENT", argnum, pArgc, argv, options);
         break;
     case PSTAMP_CHIP:
-        getId("CLASS_ID", argnum, pArgc, argv, options);
+        getId("COMPONENT", argnum, pArgc, argv, options);
         break;
     case PSTAMP_WARP:
Index: /trunk/pstamp/test/ps1-0905001-all.txt
===================================================================
--- /trunk/pstamp/test/ps1-0905001-all.txt	(revision 26288)
+++ /trunk/pstamp/test/ps1-0905001-all.txt	(revision 26289)
@@ -10,33 +10,30 @@
 
 # REQ_NAME      EXTVER
-byskycell_test     1
+CHANGEME          1
 
 # subsequent lines define the rows in the table
 
-# If ROWNUM is set to zero, pstamp_request_file will set insert a value for each row beginning with 1
-# If a later input row reuses one of the automatically assigned values an error is reported.
-
 
 # ID    |     ROI Specification                   |  JOB Specification | Images of interest specification
-# ROWNUM CENTER_X         CENTER_Y         WIDTH HEIGHT COORD_MASK JOB_TYPE OPTION_MASK PROJECT REQ_TYPE IMG_TYPE    ID   TESS_ID COMPONENT    LABEL     REQFILT MJD_MIN MJD_MAX | COMMENT
+# ROWNUM CENTER_X         CENTER_Y         WIDTH HEIGHT COORD_MASK JOB_TYPE OPTION_MASK PROJECT REQ_TYPE IMG_TYPE    ID   TESS_ID COMPONENT DIST_GROUP     REQFILT MJD_MIN MJD_MAX | COMMENT
 #
 # various looks at the location of SN candidate PS1-0905001
-1         243.035580     55.128140          250   250      2        stamp       63        gpc1    byid     raw   70853         null   null       null        null    0      0    |PS1-0905001 r
-2         243.035580     55.128140          250   250      2        stamp       63       gpc1    byid     chip  20272         null   null  MD08.200905.v1   null    0      0    |PS1-0905001 r
+1         243.035580     55.128140          250   250      2        stamp       63       gpc1    byid     raw   70853         null   null       null        null    0      0    |PS1-0905001 r
+2         243.035580     55.128140          250   250      2        stamp       63       gpc1    byid     chip  20272         null   null       null        null    0      0    |PS1-0905001 r
 
 # 3 and 4 will fail because the weight images was damaged by the destreaking
 # process
-3         243.035580     55.128140          250   250      2        stamp       63       gpc1    byid     warp  6323          null   null  MD08.200905.v1   null    0      0    |PS1-0905001 r
-4         243.035580     55.128140          250   250      2        stamp       63       gpc1    byid     diff  16880         null   null  MD08.200905.v1   null    0      0    |PS1-0905001 r
+3         243.035580     55.128140          250   250      2        stamp       63       gpc1    byid     warp  6323          null   null       null        null    0      0    |PS1-0905001 r
+4         243.035580     55.128140          250   250      2        stamp       63       gpc1    byid     diff  16880         null   null       null        null    0      0    |PS1-0905001 r
 # these will work
-103       243.035580     55.128140          250   250      2        stamp       59       gpc1    byid     warp  6323          null   null  MD08.200905.v1   null    0      0    |PS1-0905001 r
-104       243.035580     55.128140          250   250      2        stamp       59       gpc1    byid     diff  16880         null   null  MD08.200905.v1   null    0      0    |PS1-0905001 r
+103       243.035580     55.128140          250   250      2        stamp       59       gpc1    byid     warp  6323          null   null       null        null    0      0    |PS1-0905001 r
+104       243.035580     55.128140          250   250      2        stamp       59       gpc1    byid     diff  16880         null   null       null        null    0      0    |PS1-0905001 r
 
-5         243.035580     55.128140          250   250      2        stamp       63       gpc1    byid     stack 14032         null   null  null             null    0      0    |PS1-0905001 r
+5         243.035580     55.128140          250   250      2        stamp       63       gpc1    byid     stack 14032         null   null       null        null    0      0    |PS1-0905001 r
 
 6         243.035580     55.128140          250   250      2        stamp       1        gpc1    byexp    raw   o4973g0133o   null   null       null        null    0      0    |PS1-0905001 r
-7         243.035580     55.128140          250   250      2        stamp       1        gpc1    byexp    chip  o4973g0133o   null   null  MD08.200905.v1   null    0      0    |PS1-0905001 r
-8         243.035580     55.128140          250   250      2        stamp       1        gpc1    byexp    warp  o4973g0133o   null   null  MD08.200905.v1   null    0      0    |PS1-0905001 r
-9         243.035580     55.128140          250   250      2        stamp       1        gpc1    byexp    diff  o4973g0133o   null   null  MD08.200905.v1   null    0      0    |PS1-0905001 r
+7         243.035580     55.128140          250   250      2        stamp       1        gpc1    byexp    chip  o4973g0133o   null   null  MD08.2009110     null    0      0    |PS1-0905001 r
+8         243.035580     55.128140          250   250      2        stamp       1        gpc1    byexp    warp  o4973g0133o   null   null  MD08.2009110     null    0      0    |PS1-0905001 r
+9         243.035580     55.128140          250   250      2        stamp       1        gpc1    byexp    diff  o4973g0133o   null   null  MD08.2009110     null    0      0    |PS1-0905001 r
 
 
