Index: branches/eam_branches/20090715/ippTasks/diff.pro
===================================================================
--- branches/eam_branches/20090715/ippTasks/diff.pro	(revision 24799)
+++ branches/eam_branches/20090715/ippTasks/diff.pro	(revision 25625)
@@ -14,4 +14,5 @@
 ### Database lists
 $diffSkycell_DB = 0
+$diffAdvance_DB = 0
 #$diffCleanup_DB = 0
 
@@ -36,4 +37,7 @@
     active true
   end
+  task diff.advance
+    active true
+  end
 end
 
@@ -44,4 +48,7 @@
   end
   task diff.skycell.run
+    active false
+  end
+  task diff.advance
     active false
   end
@@ -198,4 +205,56 @@
   end
 end
+
+
+# Advance exposures which have completed
+task	       diff.advance
+  host         local
+
+  periods      -poll $LOADPOLL
+#  periods      -exec $LOADEXEC
+  periods      -exec 30
+  periods      -timeout 60
+  npending     1
+
+  stdout NULL
+  stderr $LOGDIR/diff.advance.log
+
+  task.exec
+    if ($LABEL:n == 0) break
+    $run = difftool -advance
+    if ($DB:n == 0)
+      option DEFAULT
+    else
+      # save the DB name for the exit tasks
+      option $DB:$diffAdvance_DB
+      $run = $run -dbname $DB:$diffAdvance_DB
+      $diffAdvance_DB ++
+      if ($diffAdvance_DB >= $DB:n) set diffAdvance_DB = 0
+    end
+    add_poll_args run
+    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
+
+
 
 # # select images ready for diff analysis
