Index: trunk/ippTasks/camera.pro
===================================================================
--- trunk/ippTasks/camera.pro	(revision 24595)
+++ trunk/ippTasks/camera.pro	(revision 24596)
@@ -7,14 +7,11 @@
 
 book init camPendingExp
-#book init camPendingCleanup
 
 macro camera.status
   book listbook camPendingExp
-#  book listbook camPendingCleanup
 end
 
 macro camera.reset
   book init camPendingExp
-#  book init camPendingCleanup
 end
 
@@ -37,24 +34,7 @@
 end
 
-# macro camera.cleanup.on
-#   task camera.cleanup.load
-#     active true
-#   end
-#   task camera.cleanup.run
-#     active true
-#   end
-# end
-
-# macro camera.cleanup.off
-#   task camera.cleanup.load
-#     active false
-#   end
-#   task camera.cleanup.run
-#     active false
-#   end
-# end
-
 # this variable will cycle through the known database names
 $camera_DB = 0
+$camera_revert_DB = 0
 
 # select images ready for camera analysis
@@ -199,122 +179,47 @@
 end
 
-# # this variable will cycle through the known database names
-# $camera_cleanup_DB = 0
-
-# # select images ready for cam analysis
-# # new entries are added to camPendingImfile
-# # skip already-present entries
-# task	       camera.cleanup.load
-#   host         local
-
-#   periods      -poll $LOADPOLL
-#   periods      -exec $LOADEXEC
-#   periods      -timeout 30
-#   npending     1
-#   active       false
-
-#   stdout NULL
-#   stderr $LOGDIR/camera.cleanup.log
-
-#   task.exec
-#     if ($LABEL:n == 0) break
-#     $run = camtool -pendingcleanuprun
-#     if ($DB:n == 0)
-#       option DEFAULT
-#     else
-#       # save the DB name for the exit tasks
-#       option $DB:$camera_cleanup_DB
-#       $run = $run -dbname $DB:$camera_cleanup_DB
-#       $camera_cleanup_DB ++
-#       if ($camera_cleanup_DB >= $DB:n) set camera_cleanup_DB = 0
-#     end
-#     add_poll_args run
-#     add_poll_labels run
-#     command $run
-#   end
-
-#   # success
-#   task.exit    0
-#     # convert 'stdout' to book format
-#     ipptool2book stdout camPendingCleanup -key cam_id -uniq -setword dbname $options:0 -setword pantaskState INIT
-#     if ($VERBOSE > 2)
-#       book listbook camPendingCleanup
-#     end
-
-#     # delete existing entries in the appropriate pantaskStates
-#     process_cleanup camPendingCleanup
-#   end
-
-#   # locked list
-#   task.exit    default
-#     showcommand failure
-#   end
-
-#   task.exit    crash
-#     showcommand crash
-#   end
-
-#   # operation times out?
-#   task.exit    timeout
-#     showcommand timeout
-#   end
-# end
-
-# # run the ipp_cleanup.pl script on pending images
-# task	       camera.cleanup.run
-#   periods      -poll $RUNPOLL
-#   periods      -exec $RUNEXEC
-#   periods      -timeout 60
-#   active       false
-
-#   task.exec
-#     book npages camPendingCleanup -var N
-#     if ($N == 0) break
-#     if ($NETWORK == 0) break
-    
-#     # look for new images in camPendingCleanup (pantaskState == INIT)
-#     book getpage camPendingCleanup 0 -var pageName -key pantaskState INIT
-#     if ("$pageName" == "NULL") break
-
-#     book setword camPendingCleanup $pageName pantaskState RUN
-#     book getword camPendingCleanup $pageName camera -var CAMERA
-#     book getword camPendingCleanup $pageName state  -var CLEANUP_MODE
-#     book getword camPendingCleanup $pageName cam_id -var CAM_ID
-#     book getword camPendingCleanup $pageName dbname -var DBNAME
-
-#     # specify choice of local or remote host based on camera and cam (class_id)
-#     set.host.for.camera $CAMERA FPA
-
-#     stdout $LOGDIR/camera.cleanup.log
-#     stderr $LOGDIR/camera.cleanup.log
-
-#     # XXX is everything listed here needed?
-#     $run = ipp_cleanup.pl --stage camera --stage_id $CAM_ID --camera $CAMERA --mode $CLEANUP_MODE
-#     add_standard_args run
-
-#     # save the pageName for future reference below
-#     options $pageName
-
-#     # create the command line
-#     if ($VERBOSE > 1)
-#       echo command $run
-#     end
-#     command $run
-#   end
-
-#   # default exit status
-#   task.exit    default
-#     process_exit camPendingCleanup $options:0 $JOB_STATUS
-#   end
-
-#   task.exit    crash
-#     showcommand crash
-#     book setword camPendingCleanup $options:0 pantaskState CRASH
-#   end
-
-#   # operation timed out?
-#   task.exit    timeout
-#     showcommand timeout
-#     book setword camPendingCleanup $options:0 pantaskState TIMEOUT
-#   end
-# end
+task camera.revert
+  host         local
+
+  periods      -poll 5.0
+  periods      -exec 60.0
+  periods      -timeout 120.0
+  npending     1
+
+  stdout NULL
+  stderr $LOGDIR/revert.log
+
+  task.exec
+    if ($LABEL:n == 0) break
+    $run = camtool -revertprocessedexp
+    if ($DB:n == 0)
+      option DEFAULT
+    else
+      # save the DB name for the exit tasks
+      option $DB:$camera_revert_DB
+      $run = $run -dbname $DB:$camera_revert_DB
+      $camera_revert_DB ++
+      if ($camera_revert_DB >= $DB:n) set camera_revert_DB = 0
+    end
+    add_poll_labels run
+    command $run
+  end
+
+  # success
+  task.exit    0
+  end
+
+  # locked list
+  task.exit    default
+    showcommand failure
+  end
+
+  task.exit    crash
+    showcommand crash
+  end
+
+  # operation times out?
+  task.exit    timeout
+    showcommand timeout
+  end
+end
