Index: trunk/ippTasks/detrend.stack.pro
===================================================================
--- trunk/ippTasks/detrend.stack.pro	(revision 8691)
+++ trunk/ippTasks/detrend.stack.pro	(revision 9081)
@@ -13,5 +13,13 @@
 ## these tasks use the queue DetrendImfilesToProcess
 ## the DetrendClassIDtoStack queue contains:
-## STATE DET_ID ITER TYPE CLASS_ID 
+## STATE DET_ID ITER TYPE CLASS_ID CAMERA
+
+queueinit DetrendClassIDtoStack
+if ($?network == 0)
+  $network = 1
+end
+if ($?parallel == 0)
+  $parallel = 0
+end
 
 # select images ready for copy 
@@ -24,5 +32,8 @@
   periods      -poll 1
   periods      -exec 5
-  periods      -timeout 30
+  periods      -timeout 5
+
+  stdout dettool.stack.log
+  stderr dettool.stack.log
 
   # success
@@ -42,5 +53,7 @@
       $TYPE     = $word:2
       $CLASS_ID = $word:3
-      queuepush DetrendClassIDtoStack -uniq -key 1:2:4 "NEW $DET_ID $ITER $TYPE $CLASS_ID"
+      $CAMERA   = $word:4
+      echo queuepush DetrendClassIDtoStack -uniq -key 1:2:4 "NEW $DET_ID $ITER $TYPE $CLASS_ID $CAMERA"
+      queuepush DetrendClassIDtoStack -uniq -key 1:2:4 "NEW $DET_ID $ITER $TYPE $CLASS_ID $CAMERA"
     end
 
@@ -69,5 +82,5 @@
   periods      -poll 0.5
   periods      -exec 1.0
-  periods      -timeout 5
+  periods      -timeout 60
 
   task.exec
@@ -89,17 +102,27 @@
     # STATE DET_ID ITER TYPE CLASS_ID 
     ## NOTE: the queue has the STATE prepended 
+    # use local variables
     list word -split $line
-    $DET_ID   = $word:1
-    $ITER     = $word:2
-    $TYPE     = $word:3
-    $CLASS_ID = $word:4
+    $DET_ID   = $word:0
+    $ITER     = $word:1
+    $TYPE     = $word:2
+    $CLASS_ID = $word:3
+    $CAMERA   = $word:3
+
+    stdout $CAMERA.$TYPE.$DET_ID.$ITER.$CLASS_ID.log
+    stderr $CAMERA.$TYPE.$DET_ID.$ITER.$CLASS_ID.log
 
     # specify choice of remote host:
-    host anyhost
+    if ($parallel)
+      host anyhost
+    else
+      host local
+    end
 
     # create example job options as a demonstration
     options "$line"
-    # detrend_stack.pl 1 0 mc bias
-    command detrend_stack.pl $DET_ID $ITER $CLASS_ID $TYPE
+    # detrend_stack.pl --det_id 1 --iteration 0 --class_id isp --det_type bias --camera ISP || exit 1
+    echo command detrend_stack.pl --det_id $DET_ID --iteration $ITER --class_id $CLASS_ID --det_type $TYPE --camera $CAMERA
+    command detrend_stack.pl --det_id $DET_ID --iteration $ITER --class_id $CLASS_ID --det_type $TYPE --camera $CAMERA
   end
 
@@ -116,5 +139,5 @@
   # operation times out?
   task.exit    timeout
-    queuepush DetrendClassIDtoStack -replace -key 1:2:4 "FAIL $options:0"
+    queuepush DetrendClassIDtoStack -replace -key 1:2:4 "TIMEOUT $options:0"
   end
 end
