Index: /branches/eam_branches/ipp-20130419/dbconfig/changes.txt
===================================================================
--- /branches/eam_branches/ipp-20130419/dbconfig/changes.txt	(revision 35549)
+++ /branches/eam_branches/ipp-20130419/dbconfig/changes.txt	(revision 35550)
@@ -2400,7 +2400,4 @@
 ) ENGINE=innodb DEFAULT CHARSET=latin1;
 
-UPDATE dbversion set schema_version = '1.1.75', updated= CURRENT_TIMESTAMP();
-
-
 -- new Postage Stamp Request columns
 -- Note: These do not aply to the gpc1 database because the pstamp tables were
@@ -2412,2 +2409,10 @@
 -- default to the gpc1 project
 UPDATE pstampRequest SET proj_id = 1;
+
+-- unique keys for the release tables
+
+alter table relStack  add unique key (rel_id, tess_id, skycell_id, filter, stack_type, mjd_obs)
+alter table relExp add UNIQUE KEY(rel_id, exp_id);
+alter table ippRelease add unique key (surveyID, release_name);
+
+UPDATE dbversion set schema_version = '1.1.75', updated= CURRENT_TIMESTAMP();
Index: /branches/eam_branches/ipp-20130419/ippScripts/scripts/ipp_cleanup.pl
===================================================================
--- /branches/eam_branches/ipp-20130419/ippScripts/scripts/ipp_cleanup.pl	(revision 35549)
+++ /branches/eam_branches/ipp-20130419/ippScripts/scripts/ipp_cleanup.pl	(revision 35550)
@@ -20,4 +20,12 @@
 my ($stage, $camera, $stage_id, $mode, $path_base, $dbname, $verbose, $no_op, $helplist, $logfile, $check_all);
 my $very_verbose = 0;
+
+# turn this on to set data_state to error_state for components for which cleanup fails
+# Note: we no longer do this, we leave the state alone.
+my $set_error_state_for_file = 0;
+
+# turn this on the set the state to error_state when errors occur cleaning up individual components
+# We may stop doing this
+my $set_error_state_for_run = 1;
 
 # this gets set to 1 the first time we set the corresponding destreak run to be cleaned
@@ -335,30 +343,38 @@
             $num_errors++;
 
-            # if an error happens for one chip, the chipRun will stay in goto_*, but the chips will go to error_* (matching the goto_*)
-            my $command = "$chiptool -updateprocessedimfile -chip_id $stage_id -class_id $class_id -set_state $error_state";
-            $command .= " -dbname $dbname" if defined $dbname;
-
-            my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
+            if ($set_error_state_for_file) {
+                # if an error happens for one chip, the chipRun will stay in goto_*, but the chips will go to error_* (matching the goto_*)
+                my $command = "$chiptool -updateprocessedimfile -chip_id $stage_id -class_id $class_id -set_state $error_state";
+                $command .= " -dbname $dbname" if defined $dbname;
+
+                my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
+                        run(command => $command, verbose => $verbose);
+                unless ($success) {
+                    $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
+                    &my_die("Unable to perform chiptool: $error_code", "chip", $stage_id, $error_code);
+                }
+            }
+
+            if ($set_error_state_for_run) {
+                # We want to flag the run as well, to avoid attempting to reprocess the same data over and over again.
+                $command = "$chiptool -chip_id $stage_id -updaterun -set_state $error_state";
+                $command .= " -dbname $dbname" if defined $dbname;
+
+                ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
                     run(command => $command, verbose => $verbose);
-            unless ($success) {
-                $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
-                &my_die("Unable to perform chiptool: $error_code", "chip", $stage_id, $error_code);
-            }
-
-            # We want to flag the run as well, to avoid attempting to reprocess the same data over and over again.
-            $command = "$chiptool -chip_id $stage_id -updaterun -set_state $error_state";
-            $command .= " -dbname $dbname" if defined $dbname;
-
-            ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
-                run(command => $command, verbose => $verbose);
-            unless ($success) {
-                $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
-                &my_die("Unable to perform chiptool: $error_code", "chip", $stage_id, $error_code);
-            }
-
-        }
-    }
-    if ($num_updated eq 0 and $num_errors eq 0) {
-        # no chips were updated by this procedssing so set state to $done_state
+                unless ($success) {
+                    $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
+                    &my_die("Unable to perform chiptool: $error_code", "chip", $stage_id, $error_code);
+                }
+
+            }
+        }
+    }
+    # We no longer depend on chiptool to promote the run from goto_cleaned to cleaned based on all of
+    # the imfiles being in the cleaned state.
+    # Due to missing files we don't always clean individual components.
+    # unless there was an error set state to $done_state
+    if (!$set_error_state_for_run or $num_errors eq 0) {
+        # set state to $done_state
         my $command = "$chiptool -chip_id $stage_id -updaterun -set_state $done_state";
         $command .= " -dbname $dbname" if defined $dbname;
@@ -625,28 +641,32 @@
          } else {
             $num_errors++;
-            my $command = "$warptool -updateskyfile -warp_id $stage_id -skycell_id $skycell_id -set_state $error_state";
-            $command .= " -dbname $dbname" if defined $dbname;
-
-            my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
-                run(command => $command, verbose => $verbose);
-            unless ($success) {
-                $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
-                &my_die("Unable to perform warptool: $error_code", "warp", $stage_id, $error_code);
-            }
-
-            # We want to flag the run as well, to avoid attempting to reprocess the same data over and over again.
-            $command = "$warptool -warp_id $stage_id -updaterun -set_state $error_state";
-            $command .= " -dbname $dbname" if defined $dbname;
-
-            ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
-                run(command => $command, verbose => $verbose);
-            unless ($success) {
-                $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
-                &my_die("Unable to perform warptool: $error_code", "warp", $stage_id, $error_code);
-            }
-        }
-    }
-    if ($num_updated eq 0 and $num_errors eq 0) {
-        # no skycells were updated by this procedssing so set state to $done_state
+            if ($set_error_state_for_file) {
+                my $command = "$warptool -updateskyfile -warp_id $stage_id -skycell_id $skycell_id -set_state $error_state";
+                $command .= " -dbname $dbname" if defined $dbname;
+
+                my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
+                    run(command => $command, verbose => $verbose);
+                unless ($success) {
+                    $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
+                    &my_die("Unable to perform warptool: $error_code", "warp", $stage_id, $error_code);
+                }
+            }
+
+            if ($set_error_state_for_run) {
+                # We want to flag the run as well, to avoid attempting to reprocess the same data over and over again.
+                $command = "$warptool -warp_id $stage_id -updaterun -set_state $error_state";
+                $command .= " -dbname $dbname" if defined $dbname;
+
+                ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
+                    run(command => $command, verbose => $verbose);
+                unless ($success) {
+                    $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
+                    &my_die("Unable to perform warptool: $error_code", "warp", $stage_id, $error_code);
+                }
+            }
+        }
+    }
+    if (!$set_error_state_for_run or $num_errors eq 0) {
+        # Set run to done state
         my $command = "$warptool -warp_id $stage_id -updaterun -set_state $done_state";
         $command .= " -dbname $dbname" if defined $dbname;
Index: /branches/eam_branches/ipp-20130419/ippScripts/scripts/publish_file.pl
===================================================================
--- /branches/eam_branches/ipp-20130419/ippScripts/scripts/publish_file.pl	(revision 35549)
+++ /branches/eam_branches/ipp-20130419/ippScripts/scripts/publish_file.pl	(revision 35550)
@@ -328,5 +328,5 @@
 
 unless ($no_update) {
-    my $command = "$dsreg --add pub.$pub_id.$stage.$stage_id --copy --abspath --product $product --type $dsType --list $dsFileName";
+    my $command = "$dsreg --add pub.$pub_id.$stage.$stage_id --link --abspath --product $product --type $dsType --list $dsFileName";
     $command .= " --ps0 \"$comment\"" if defined $comment;
     $command .= " --ps1 \"$exp_name_1\"" if defined $exp_name_1;
Index: /branches/eam_branches/ipp-20130419/ippScripts/scripts/warp_skycell.pl
===================================================================
--- /branches/eam_branches/ipp-20130419/ippScripts/scripts/warp_skycell.pl	(revision 35549)
+++ /branches/eam_branches/ipp-20130419/ippScripts/scripts/warp_skycell.pl	(revision 35550)
@@ -158,5 +158,5 @@
     $dynamicMasks = metadataLookupBool($recipeData, 'REFSTAR_MASK');
 }
-
+print "Dynamic Mask Status: $dynamicMasks\n";
 
 my $outputImage = prepare_output ("PSWARP.OUTPUT", $outroot, $skycell_id, 1);
Index: /branches/eam_branches/ipp-20130419/ippScripts/scripts/whichimage
===================================================================
--- /branches/eam_branches/ipp-20130419/ippScripts/scripts/whichimage	(revision 35549)
+++ /branches/eam_branches/ipp-20130419/ippScripts/scripts/whichimage	(revision 35550)
@@ -94,4 +94,6 @@
 my $cmd = "dvoImagesAtCoords -chipcoords $coord_file";
 $cmd .= " -listchipcoords" if $listchipcoords;
+
+$tess_id = uc($tess_id) if $tess_id;
 
 my $status = 0;
@@ -125,4 +127,5 @@
             # next if $tess_name eq 'FIXNS';
             # next if $tess_name eq 'ALLSKY';
+            next if $tess_name eq 'RINGS.V0';
             push @tess_ids_to_check, $tess_name;
         }
