Index: trunk/ippTools/share/magicdstool_completed_runs.sql
===================================================================
--- trunk/ippTools/share/magicdstool_completed_runs.sql	(revision 23388)
+++ trunk/ippTools/share/magicdstool_completed_runs.sql	(revision 23389)
@@ -12,5 +12,5 @@
         AND magicDSFile.component = rawImfile.class_id
     WHERE
-        magicDSRun.state = 'run'
+        magicDSRun.state = 'new'
         AND magicDSRun.stage = 'raw'
     GROUP BY
@@ -30,5 +30,5 @@
         AND magicDSFile.component = chipProcessedImfile.class_id
     WHERE
-        magicDSRun.state = 'run'
+        magicDSRun.state = 'new'
         AND magicDSRun.stage = 'chip'
     GROUP BY
@@ -48,5 +48,5 @@
         AND magicDSFile.component = warpSkyfile.skycell_id
     WHERE
-        magicDSRun.state = 'run'
+        magicDSRun.state = 'new'
         AND magicDSRun.stage = 'warp'
         AND warpSkyfile.fault = 0
@@ -72,5 +72,5 @@
         AND magicDSFile.component = diffSkyfile.skycell_id
     WHERE
-        magicDSRun.state = 'run'
+        magicDSRun.state = 'new'
         AND magicDSRun.stage = 'diff'
         AND diffSkyfile.fault = 0
Index: trunk/ippTools/share/magicdstool_todestreak.sql
===================================================================
--- trunk/ippTools/share/magicdstool_todestreak.sql	(revision 23388)
+++ trunk/ippTools/share/magicdstool_todestreak.sql	(revision 23389)
@@ -26,5 +26,5 @@
     AND magicDSFile.component = rawImfile.class_id
 WHERE
-    magicDSRun.state = 'run'
+    magicDSRun.state = 'new'
     AND magicDSRun.stage = 'raw'
     AND magicDSFile.component IS NULL
@@ -57,5 +57,5 @@
     AND magicDSFile.component = chipProcessedImfile.class_id
 WHERE
-    magicDSRun.state = 'run'
+    magicDSRun.state = 'new'
     AND magicDSRun.stage = 'chip'
     AND chipRun.state = 'full'
@@ -91,5 +91,5 @@
     AND magicDSFile.component = warpSkyfile.skycell_id
 WHERE
-    magicDSRun.state = 'run'
+    magicDSRun.state = 'new'
     AND magicDSRun.stage = 'warp'
     AND warpRun.state = 'full'
@@ -127,5 +127,5 @@
     AND magicDSFile.component = diffSkyfile.skycell_id
 WHERE
-    magicDSRun.state = 'run'
+    magicDSRun.state = 'new'
     AND magicDSRun.stage = 'diff'
     AND diffSkyfile.fault = 0
Index: trunk/ippTools/share/magictool_addmask.sql
===================================================================
--- trunk/ippTools/share/magictool_addmask.sql	(revision 23388)
+++ trunk/ippTools/share/magictool_addmask.sql	(revision 23389)
@@ -2,5 +2,5 @@
     magicRun
 SET
-    state = 'stop'
+    state = 'full'
 WHERE
-    state != 'stop'
+    state != 'full'
Index: trunk/ippTools/share/magictool_chipprocessedimfile.sql
===================================================================
--- trunk/ippTools/share/magictool_chipprocessedimfile.sql	(revision 23388)
+++ trunk/ippTools/share/magictool_chipprocessedimfile.sql	(revision 23389)
@@ -26,4 +26,4 @@
     chipRun.state = 'full'
     AND chipProcessedImfile.fault = 0
---   AND magicRun.state = 'stop'
+--   AND magicRun.state = 'full'
 --   AND magicMask.fault = 0
Index: trunk/ippTools/share/magictool_diffskyfile.sql
===================================================================
--- trunk/ippTools/share/magictool_diffskyfile.sql	(revision 23388)
+++ trunk/ippTools/share/magictool_diffskyfile.sql	(revision 23389)
@@ -24,4 +24,4 @@
     diffRun.state = 'full'
     AND diffSkyfile.fault = 0
---   AND magicRun.state = 'stop'
+--   AND magicRun.state = 'full'
 --   AND magicMask.fault = 0
Index: trunk/ippTools/share/magictool_inputskyfile.sql
===================================================================
--- trunk/ippTools/share/magictool_inputskyfile.sql	(revision 23388)
+++ trunk/ippTools/share/magictool_inputskyfile.sql	(revision 23389)
@@ -9,3 +9,3 @@
     AND magicInputSkyfile.node = diffSkyfile.skycell_id
 WHERE
-    magicRun.state = 'run'
+    magicRun.state = 'new'
Index: trunk/ippTools/share/magictool_mask.sql
===================================================================
--- trunk/ippTools/share/magictool_mask.sql	(revision 23388)
+++ trunk/ippTools/share/magictool_mask.sql	(revision 23389)
@@ -6,4 +6,4 @@
     USING(magic_id)
 WHERE
-    magicRun.state = 'stop'
+    magicRun.state = 'full'
     AND magicMask.fault = 0
Index: trunk/ippTools/share/magictool_rawimfile.sql
===================================================================
--- trunk/ippTools/share/magictool_rawimfile.sql	(revision 23388)
+++ trunk/ippTools/share/magictool_rawimfile.sql	(revision 23389)
@@ -24,4 +24,4 @@
 WHERE
     rawImfile.fault = 0
---   AND magicRun.state = 'stop'
+--   AND magicRun.state = 'full'
 --   AND magicMask.fault = 0
Index: trunk/ippTools/share/magictool_tomask.sql
===================================================================
--- trunk/ippTools/share/magictool_tomask.sql	(revision 23388)
+++ trunk/ippTools/share/magictool_tomask.sql	(revision 23389)
@@ -10,5 +10,5 @@
 LEFT JOIN magicNodeResult USING(magic_id, node)
 WHERE
-    magicRun.state = 'run'
+    magicRun.state = 'new'
     AND magicNodeResult.node = 'root'
     AND magicNodeResult.fault = 0
Index: trunk/ippTools/share/magictool_toprocess_inputs.sql
===================================================================
--- trunk/ippTools/share/magictool_toprocess_inputs.sql	(revision 23388)
+++ trunk/ippTools/share/magictool_toprocess_inputs.sql	(revision 23389)
@@ -19,5 +19,5 @@
     AND magicTree.node = magicNodeResult.node
 WHERE
-    magicRun.state = 'run'
+    magicRun.state = 'new'
     AND magicNodeResult.magic_id IS NULL
     AND magicNodeResult.node IS NULL
Index: trunk/ippTools/share/magictool_toprocess_tree.sql
===================================================================
--- trunk/ippTools/share/magictool_toprocess_tree.sql	(revision 23388)
+++ trunk/ippTools/share/magictool_toprocess_tree.sql	(revision 23389)
@@ -15,5 +15,5 @@
     AND magicTree.node = magicNodeResult.node
 WHERE
-    magicRun.state = 'run'
+    magicRun.state = 'new'
     -- where hook %s
 ORDER BY
Index: trunk/ippTools/share/magictool_toskyfilemask.sql
===================================================================
--- trunk/ippTools/share/magictool_toskyfilemask.sql	(revision 23388)
+++ trunk/ippTools/share/magictool_toskyfilemask.sql	(revision 23389)
@@ -7,4 +7,4 @@
     USING(magic_id)
 WHERE
-    magicRun.state = 'run'
+    magicRun.state = 'new'
     AND magicSkyfileMask.magic_id IS NULL
Index: trunk/ippTools/share/magictool_totree.sql
===================================================================
--- trunk/ippTools/share/magictool_totree.sql	(revision 23388)
+++ trunk/ippTools/share/magictool_totree.sql	(revision 23389)
@@ -12,5 +12,5 @@
     USING(magic_id)
 WHERE
-    magicRun.state = 'run'
+    magicRun.state = 'new'
     AND magicTree.node IS NULL
     AND magicRun.fault = 0
Index: trunk/ippTools/share/magictool_warpskyfile.sql
===================================================================
--- trunk/ippTools/share/magictool_warpskyfile.sql	(revision 23388)
+++ trunk/ippTools/share/magictool_warpskyfile.sql	(revision 23389)
@@ -21,4 +21,4 @@
     warpRun.state = 'full'
     AND warpSkyfile.fault = 0
---   AND magicRun.state = 'stop'
+--   AND magicRun.state = 'full'
 --   AND magicMask.fault = 0
Index: trunk/ippTools/src/magicdstool.c
===================================================================
--- trunk/ippTools/src/magicdstool.c	(revision 23388)
+++ trunk/ippTools/src/magicdstool.c	(revision 23389)
@@ -242,5 +242,5 @@
 
         // create a new magicRun for this group
-        magicRunRow *run = magicRunRowAlloc(0, exp_id, "run", workdir, "dirty", label, dvodb, registered, 0);
+        magicRunRow *run = magicRunRowAlloc(0, exp_id, "new", workdir, "dirty", label, dvodb, registered, 0);
         if (!run) {
             psAbort("failed to alloc magicRun object");
@@ -320,10 +320,11 @@
     PXOPT_LOOKUP_STR(stage, config->args, "-stage", true, false);
     PXOPT_LOOKUP_STR(outroot, config->args, "-outroot", true, false);
+
+    // optional
     PXOPT_LOOKUP_STR(recoveryroot, config->args, "-recoveryroot", false, false);
     PXOPT_LOOKUP_BOOL(re_place, config->args, "-replace", false);
     PXOPT_LOOKUP_BOOL(remove, config->args, "-remove", false);
-
-    // optional
     PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false);
+    PXOPT_LOOKUP_STR(label, config->args, "-label", false, false);
 
     psS64 stage_id = 0, cam_id = 0;
@@ -337,8 +338,9 @@
             0,          // ID
             magic_id,
-            "run",      // state
+            "new",      // state
             stage,
             stage_id,
             cam_id,
+            label,
             outroot,
             recoveryroot,
@@ -396,5 +398,5 @@
     PXOPT_COPY_S64(config->args, where, "-magic_ds_id", "magic_ds_id", "==");
     PXOPT_COPY_S64(config->args, where, "-magic_id", "magic_id", "==");
-//    PXOPT_COPY_S64(config->args, where, "-exp_id", "exp_id", "==");
+    PXOPT_COPY_STR(config->args, where, "-label", "label", "==");
 
     PXOPT_LOOKUP_U64(limit, config->args, "-limit", false, false);
@@ -685,6 +687,6 @@
         psS64 magic_ds_id = psMetadataLookupS64(NULL, row, "magic_ds_id");
 
-        // set magicDSRun.state to 'stop'
-        if (!setmagicDSRunState(config, magic_ds_id, "stop")) {
+        // set magicDSRun.state to 'full'
+        if (!setmagicDSRunState(config, magic_ds_id, "full")) {
             psError(PS_ERR_UNKNOWN, false, "failed to change magicDSRun.state for magic_ds_id: %" PRId64,
                 magic_ds_id);
@@ -795,6 +797,6 @@
     // check that state is a valid string value
     if (!(
-            (strncmp(state, "run", 4) == 0)
-            || (strncmp(state, "stop", 5) == 0)
+            (strncmp(state, "new", 4) == 0)
+            || (strncmp(state, "full", 5) == 0)
         )
     ) {
Index: trunk/ippTools/src/magicdstoolConfig.c
===================================================================
--- trunk/ippTools/src/magicdstoolConfig.c	(revision 23388)
+++ trunk/ippTools/src/magicdstoolConfig.c	(revision 23389)
@@ -70,5 +70,5 @@
     psMetadataAddBool(definerunArgs, PS_LIST_TAIL, "-replace", 0, "use the simple output format", false);
     psMetadataAddBool(definerunArgs, PS_LIST_TAIL, "-remove", 0, "use the simple output format", false);
-//    psMetadataAddStr(definerunArgs, PS_LIST_TAIL, "-label", 0, "define label", NULL);
+    psMetadataAddStr(definerunArgs, PS_LIST_TAIL, "-label", 0, "define label", NULL);
     psMetadataAddBool(definerunArgs, PS_LIST_TAIL, "-simple", 0, "use the simple output format", false);
 
@@ -88,5 +88,5 @@
     psMetadataAddS64(todestreakArgs, PS_LIST_TAIL, "-magic_ds_id", 0, "search by magic Destreak ID", 0);
     psMetadataAddS64(todestreakArgs, PS_LIST_TAIL, "-magic_id", 0, "search by magic ID", 0);
-//    psMetadataAddS64(todestreakArgs, PS_LIST_TAIL, "-exp_id", 0, "search by exposure ID", 0);
+    psMetadataAddStr(todestreakArgs, PS_LIST_TAIL, "-label", 0, "define label", NULL);
     psMetadataAddU64(todestreakArgs, PS_LIST_TAIL, "-limit", 0, "limit result set to N items", 0);
     psMetadataAddBool(todestreakArgs, PS_LIST_TAIL, "-simple", 0, "use the simple output format", false);
Index: trunk/ippTools/src/magictool.c
===================================================================
--- trunk/ippTools/src/magictool.c	(revision 23388)
+++ trunk/ippTools/src/magictool.c	(revision 23389)
@@ -217,5 +217,5 @@
 
         // create a new magicRun for this group
-        magicRunRow *run = magicRunRowAlloc(0, exp_id, diff_id, "run", workdir, "dirty", label, dvodb, registered, 0);
+        magicRunRow *run = magicRunRowAlloc(0, exp_id, diff_id, "new", workdir, "dirty", label, dvodb, registered, 0);
         if (!run) {
             psAbort("failed to alloc magicRun object");
@@ -538,5 +538,5 @@
 
     if (code > 0) {
-        char *query = "UPDATE magicRun SET fault = %d, state = 'stop' WHERE magic_id = %" PRId64;
+        char *query = "UPDATE magicRun SET fault = %d, state = 'full' WHERE magic_id = %" PRId64;
         if (!p_psDBRunQueryF(config->dbh, query, code, magic_id)) {
             psError(PS_ERR_UNKNOWN, false,
@@ -1088,8 +1088,8 @@
     }
 
-    // Set to "run"
+    // Set to "new"
     {
         psString query = psStringCopy("UPDATE magicRun JOIN magicMask USING(magic_id) "
-                                      "SET magicRun.state = 'run' WHERE magicMask.fault != 0");
+                                      "SET magicRun.state = 'new' WHERE magicMask.fault != 0");
 
         if (psListLength(where->list)) {
@@ -1481,6 +1481,6 @@
     // check that state is a valid string value
     if (!(
-            (strncmp(state, "run", 4) == 0)
-            || (strncmp(state, "stop", 5) == 0)
+            (strncmp(state, "new", 4) == 0)
+            || (strncmp(state, "full", 5) == 0)
             || (strncmp(state, "reg", 4) == 0)
         )
