Index: trunk/ippTasks/destreak.pro
===================================================================
--- trunk/ippTasks/destreak.pro	(revision 25419)
+++ trunk/ippTasks/destreak.pro	(revision 25423)
@@ -11,7 +11,8 @@
 book init magicDSToRevert
 
-### Database lists
+### indexes into Database lists
 $magicToDS_DB = 0
 $magicDSToRevert_DB = 0
+$magicDSCompletedRevert_DB = 0
 
 #list of stages
@@ -28,22 +29,22 @@
 ### Check status of tasks
 macro magic.status
-  book listbook magicToDS
-  book listbook magicDSToRevert
+    book listbook magicToDS
+    book listbook magicDSToRevert
 end
 
 ### Reset tasks
 macro magic.reset
-  book init magicToDS
-  book init magicDSToRevert
+    book init magicToDS
+    book init magicDSToRevert
 end
 
 ### Turn tasks on
 macro destreak.on
-  task destreak.load
-    active true
-  end
-  task destreak.run
-    active true
-  end
+    task destreak.load
+        active true
+    end
+    task destreak.run
+        active true
+    end
 end
 
@@ -55,13 +56,17 @@
         active true
     end
-end
+    task destreak.completed.revert
+        active true
+    end
+end
+
 ### Turn tasks off
 macro destreak.off
-  task destreak.load
-    active false
-  end
-  task destreak.run
-    active false
-  end
+    task destreak.load
+        active false
+    end
+    task destreak.run
+        active false
+    end
 end
 
@@ -71,4 +76,7 @@
     end
     task destreak.revert.run
+        active false
+    end
+    task destreak.completed.revert
         active false
     end
@@ -363,8 +371,10 @@
 
 task	       destreak.completed.revert
+    # task to finish processing for magicDSRuns being reverted or restored
   host         local
 
   periods      -poll $LOADPOLL
-  periods      -exec $LOADEXEC
+  #periods      -exec $LOADEXEC
+  periods      -exec 30
   periods      -timeout 20
   npending     1
@@ -380,6 +390,9 @@
     else
       # save the DB name for the exit tasks
-      option $DB:$magicDSToRevert_DB
-      $run = $run -dbname $DB:$magicDSToRevert_DB
+      option $DB:$magicDSCompletedRevert_DB
+
+      $run = $run -dbname $DB:$magicDSCompletedRevert_DB
+
+      if ($magicDSCompletedRevert_DB >= $DB:n) set magicDSCompletedRevert_DB = 0
     end
     add_poll_args run
@@ -390,12 +403,4 @@
   # success
   task.exit    0
-    # convert 'stdout' to book format
-    ipptool2book stdout magicDSToRevert -key magic_ds_id:component -uniq -setword dbname $options:0 -setword pantaskState INIT
-    if ($VERBOSE > 2)
-      book listbook magicDSToRevert
-    end
-
-    # delete existing entries in the appropriate pantaskStates
-    process_cleanup magicDSToRevert
   end
 
