Index: branches/tap_branches/ippTasks/destreak.pro
===================================================================
--- branches/tap_branches/ippTasks/destreak.pro	(revision 25900)
+++ branches/tap_branches/ippTasks/destreak.pro	(revision 27838)
@@ -31,12 +31,14 @@
 
 ### Check status of tasks
-macro magic.status
+macro destreak.status
+    # since echo and listbook output go to different files these do not come in order
+    echo magicToDS
     book listbook magicToDS
+    echo magicDSToRevert
     book listbook magicDSToRevert
-    book init magicDSToCleanup
 end
 
 ### Reset tasks
-macro magic.reset
+macro destreak.reset
     book init magicToDS
     book init magicDSToRevert
@@ -46,7 +48,4 @@
 ### Turn tasks on
 macro destreak.on
-    # destreak and revert should not run at the same time
-    destreak.revert.off
-
     task destreak.load
         active true
@@ -61,7 +60,4 @@
 
 macro destreak.revert.on
-    # destreak and revert should not run at the same time
-    destreak.off
-
     task destreak.revert.load
         active true
@@ -117,11 +113,4 @@
 end
 
-macro destreak.status
-    echo magicToDS
-    book listbook magicToDS
-    echo ""
-    echo magicDSToRevert
-    book listbook magicDSToRevert
-end
 
 task	       destreak.load
@@ -138,5 +127,5 @@
 
   task.exec
-    $run = magicdstool -todestreak -limit 120 -stage $DS_STAGE:$magicDSStage
+    $run = magicdstool -todestreak -stage $DS_STAGE:$magicDSStage
     $magicDSStage ++
     if ($magicDSStage >= $DS_STAGE:n) set magicDSStage = 0
@@ -195,8 +184,12 @@
     stdout $LOGSUBDIR/destreak.run.log
     stderr $LOGSUBDIR/destreak.run.log
+
+    # if we are unable to run the 'exec', use a long retry time
+    periods -exec $RUNEXEC
+
+    if ($NETWORK == 0) break
     book npages magicToDS -var N
     if ($N == 0) break
-    if ($NETWORK == 0) break
-    
+
     # look for new images (pantaskState == INIT)
     book getpage magicToDS 0 -var pageName -key pantaskState INIT
@@ -215,4 +208,5 @@
     book getword magicToDS $pageName path_base -var PATH_BASE
     book getword magicToDS $pageName cam_path_base -var CAM_PATH_BASE
+    book getword magicToDS $pageName cam_reduction -var CAM_REDUCTION
     book getword magicToDS $pageName outroot -var OUTROOT
     book getword magicToDS $pageName recoveryroot -var RECROOT
@@ -232,5 +226,5 @@
     # TODO: do not add recoveryroot or replace if they are null or zero
 
-    $run = magic_destreak.pl --magic_ds_id $MAGIC_DS_ID --camera $CAMERA --streaks $STREAKS --inv_streaks $INV_STREAKS --stage $STAGE --stage_id $STAGE_ID --component $COMPONENT --uri $URI --path_base $PATH_BASE --cam_path_base $CAM_PATH_BASE --outroot $OUTROOT --logfile $logfile --recoveryroot $RECROOT --replace $REPLACE
+    $run = magic_destreak.pl --magic_ds_id $MAGIC_DS_ID --camera $CAMERA --exp_id $EXP_ID --streaks $STREAKS --inv_streaks $INV_STREAKS --stage $STAGE --stage_id $STAGE_ID --component $COMPONENT --uri $URI --path_base $PATH_BASE --cam_path_base $CAM_PATH_BASE --cam_reduction $CAM_REDUCTION --outroot $OUTROOT --logfile $logfile --recoveryroot $RECROOT --replace $REPLACE
 
     add_standard_args run
@@ -243,4 +237,7 @@
       echo command $run
     end
+
+    # if we are ready to run, drop the retry timeout low so we fill up the queue
+    periods -exec 0.05
     command $run
   end
@@ -276,5 +273,5 @@
   #periods      -exec $LOADEXEC
   periods      -exec 30
-  periods      -timeout 20
+  periods      -timeout 60
   npending     1
 
@@ -387,4 +384,7 @@
     stdout $LOGSUBDIR/destreak.revert.run.log
     stderr $LOGSUBDIR/destreak.revert.run.log
+
+    # if we are unable to run the 'exec', use a long retry time
+    periods -exec $RUNEXEC
 
     book npages magicDSToRevert -var N
@@ -405,4 +405,5 @@
     book getword magicDSToRevert $pageName path_base -var PATH_BASE
     book getword magicDSToRevert $pageName cam_path_base -var CAM_PATH_BASE
+    book getword magicDSToRevert $pageName cam_reduction -var CAM_REDUCTION
     book getword magicDSToRevert $pageName outroot -var OUTROOT
     book getword magciDSToRevert $pageName bytes -var BYTES
@@ -410,4 +411,5 @@
 #    book getword magicDSToRevert $pageName recoveryroot -var RECROOT
     book getword magicDSToRevert $pageName re_place -var REPLACE
+    book getword magicDSToRevert $pageName bothways -var BOTHWAYS
     book getword magicDSToRevert $pageName dbname -var DBNAME
 
@@ -422,5 +424,5 @@
     end
 
-    $run = magic_destreak_revert.pl --magic_ds_id $MAGIC_DS_ID --camera $CAMERA --stage $STAGE --stage_id $STAGE_ID --component $COMPONENT --path_base $PATH_BASE --cam_path_base $CAM_PATH_BASE --outroot $OUTROOT --logfile $logfile --replace $REPLACE
+    $run = magic_destreak_revert.pl --magic_ds_id $MAGIC_DS_ID --camera $CAMERA --stage $STAGE --stage_id $STAGE_ID --component $COMPONENT --path_base $PATH_BASE --cam_path_base $CAM_PATH_BASE --cam_reduction $CAM_REDUCTION --outroot $OUTROOT --logfile $logfile --replace $REPLACE --bothways $BOTHWAYS
 
     add_standard_args run
@@ -433,4 +435,6 @@
       echo command $run
     end
+    # if we are ready to run, drop the retry timeout low so we fill up the queue
+    periods -exec 0.05
     command $run
   end
@@ -577,4 +581,7 @@
     stdout $LOGSUBDIR/destreak.cleanup.run.log
     stderr $LOGSUBDIR/destreak.cleanup.run.log
+
+    # if we are unable to run the 'exec', use a long retry time
+    periods -exec $RUNEXEC
 
     book npages magicDSToCleanup -var N
@@ -607,4 +614,6 @@
       echo command $run
     end
+    # if we are ready to run, drop the retry timeout low so we fill up the queue
+    periods -exec 0.05
     command $run
   end
