Index: /trunk/ippTasks/summit.copy.pro
===================================================================
--- /trunk/ippTasks/summit.copy.pro	(revision 14620)
+++ /trunk/ippTasks/summit.copy.pro	(revision 14621)
@@ -7,10 +7,9 @@
 $workdir    = /home/moanui/jhoblitt/workdir
 
+if ($?network == 0)
+  $network = 1
+end
 if ($?parallel == 0)
   $parallel = 0
-end
-
-if ($?network == 0)
-  $network = 1
 end
 
@@ -20,5 +19,5 @@
 book init pzPendingImfile
 
-# run pzgetexp periodically to populate pzPendingExp
+# run pzgetexp periodically to populate pzPendingExp in the database (no I/O)
 task pzgetexp
   command      pzgetexp -uri $uri -inst $camera -telescope $telescope
@@ -43,5 +42,5 @@
 # build a book of exps/filesetids that need to be queried
 task pztool.pendingexp
-    command      pztool -pendingexp -simple
+    command      pztool -pendingexp
     host         local
 
@@ -54,5 +53,7 @@
     task.exit 0
         # convert 'stdout' to book format
-#        ipptool2book stdout pzPendingExp -key exp_name:camera:telescope -uniq -setword dbname $options:0 -setword pantaskState INIT
+#       ipptool2book stdout pzPendingExp -key exp_name:camera:telescope -uniq -setword dbname $options:0 -setword pantaskState INIT
+
+# XXX we probably want the database to be user-defined...
         ipptool2book stdout pzPendingExp -key exp_name:camera:telescope -uniq -setword pantaskState INIT
 
@@ -78,10 +79,11 @@
         if ($network == 0) break
 
+        # if we are waiting on data, make the interval long
         book npages pzPendingExp -var N
         if ($N == 0)
-            periods      -exec     20
+            periods -exec 20
             break
         end
-        periods      -exec     0.2
+        periods -exec 0.2
 
         # find an exp that needs imfiles fetched
@@ -89,9 +91,8 @@
         if ($pageName == NULL) break
 
-
         # set that exp to run
         book setword pzPendingExp $pageName pantaskState RUN
 
-        book getword pzPendingExp $pageName exp_id -var EXP_ID
+        book getword pzPendingExp $pageName exp_name -var EXP_NAME
         book getword pzPendingExp $pageName camera -var CAMERA
         book getword pzPendingExp $pageName telescope -var TELESCOPE
@@ -104,5 +105,5 @@
         options $pageName
 
-        $run = pzgetimfiles -uri $URI -filesetid $EXP_ID -inst $CAMERA -telescope $TELESCOPE
+        $run = pzgetimfiles -uri $URI -filesetid $EXP_NAME -inst $CAMERA -telescope $TELESCOPE
 
         # create the command line
@@ -132,5 +133,5 @@
 # build a book of imfiles/files that need to be downloaded
 task pztool.pendingimfile
-    command      pztool -pendingimfile -simple
+    command      pztool -pendingimfile
     host         local
 
@@ -143,5 +144,5 @@
     task.exit    0
         # convert 'stdout' to book format
-#        ipptool2book stdout pzPendingImfile -key exp_name:camera:telescope -uniq -setword dbname $options:0 -setword pantaskState INIT
+#       ipptool2book stdout pzPendingImfile -key exp_name:camera:telescope -uniq -setword dbname $options:0 -setword pantaskState INIT
         ipptool2book stdout pzPendingImfile -key exp_name:camera:telescope -uniq -setword pantaskState INIT
 
@@ -168,15 +169,15 @@
         if ($network == 0) break
 
+        # if we are waiting on data, make the interval long
         book npages pzPendingImfile -var N
         if ($N == 0)
-            periods      -exec     20
+            periods -exec 20
             break
         end
-        periods      -exec     0.2
+        periods -exec 0.2
 
         # find an exp that needs imfiles fetched
         book getpage pzPendingImfile 0 -var pageName -key pantaskState INIT
         if ($pageName == NULL) break
-
 
         # set that exp to run
@@ -189,5 +190,5 @@
         book getword pzPendingImfile $pageName md5sum -var MD5SUM
 
-        # store the current page
+        # store the pageName with this job
         options $pageName
 
@@ -203,20 +204,21 @@
     # success
     task.exit 0
-        book getword options $pageName uri -var URI
-        book getword options $pageName exp_name -var EXP_NAME
-        book getword options $pageName class_id -var CLASS_ID
-        book getword options $pageName bytes -var BYTES
-        book getword options $pageName md5sum -var MD5SUM
-
-        book delpage pzPendingImfiles optoins
-
-        local $run = pztool -copydone -exp_name $EXP_NAME -inst $CAMERA -telescope $TELESCOPE -class $CLASS -class_id $CLASS_ID -uri  $workdir/$EXP_NAME.$CLASS_ID.fits
+        # get related info from the associated page
+        book getword pzPendingImfile $options:0 uri -var URI
+        book getword pzPendingImfile $options:0 exp_name -var EXP_NAME
+        book getword pzPendingImfile $options:0 class_id -var CLASS_ID
+        book getword pzPendingImfile $options:0 bytes -var BYTES
+        book getword pzPendingImfile $options:0 md5sum -var MD5SUM
+
+	# update the database with the success
+        $run = pztool -copydone -exp_name $EXP_NAME -inst $CAMERA -telescope $TELESCOPE -class $CLASS -class_id $CLASS_ID -uri  $workdir/$EXP_NAME.$CLASS_ID.fits
 
         # create the command line
         if ($VERBOSE > 1)
-          echo command $run
-        end
-        command $run
-
+          echo exec $run
+        end
+        exec $run
+
+	# update the pantasks process tables
         process_exit pzPendingExp $options:0 $JOB_STATUS
     end
