Index: /trunk/ippTasks/summit.copy.pro
===================================================================
--- /trunk/ippTasks/summit.copy.pro	(revision 15172)
+++ /trunk/ippTasks/summit.copy.pro	(revision 15173)
@@ -1,10 +1,8 @@
 ## PanTasks scripts for Summit Copy
 
-#$uri        = http://otis/ds/skyprobe/
-#$uri        = http://otis4.ifa.hawaii.edu/ds/allskycam/
-#$camera     = allskycam
-#$telescope  = zl
-#$workdir    = /data/ipp004.0/allskycam
-#$workdir    = /data/ipp006.0/gpc1
+# pztool -adddatastore -inst isp -telescope ps1 -uri http://otis1.ifa.hawaii.edu/ds/skyprobe/index.txt
+# pztool -adddatastore -inst gpc1 -telescope ps1 -uri http://conductor/ds/gpc1/index.txt
+# pztool -adddatastore -inst allskycam -telescope ps1 -uri  http://otis1.ifa.hawaii.edu/ds/allskycam/index.txt
+
 $workdir    = /export/ipp010.0/
 
@@ -18,82 +16,76 @@
 end
 
-# book for summit exps that need to be queried
+# list of DataStores to pull data from
+book init pzDataStore
+# list of summit exps that need to be queried
 book init pzPendingExp
-# book for summit imfiles that need to be downloaded
+# list of summit imfiles that need to be downloaded
 book init pzPendingImfile
 
+# build a book of datastores to poll for data
+task pztool.datastore
+    command      pztool -datastore
+    host         local
+
+    # timeout shorter than exec so jobs do not build up
+    periods      -exec     15
+    periods      -poll     1
+    periods      -timeout  15
+
+    # success
+    task.exit 0
+        # flush pzDataStore book
+        book init pzDataStore
+        # convert 'stdout' to book format
+        ipptool2book stdout pzDataStore -key camera:telescope -uniq
+    end
+
+    task.exit default
+        showcommand failure
+    end
+    task.exit timeout
+        showcommand timeout
+    end
+end
+
+$datastore_index = 0
+
 # run pzgetexp periodically to populate pzPendingExp in the database (no I/O)
-task pzgetexp.gpc1
+task pzgetexp
   # timeout shorter than exec so jobs do not build up
-  periods      -exec     15
+  periods      -exec     10
   periods      -poll     1
-  periods      -timeout  15
+  periods      -timeout  5
   host         local
 
   task.exec
-      $uri        = http://conductor/ds/gpc1/index.txt
-      $camera     = gpc1
-      $telescope  = ps1
-
-        $run = pzgetexp -uri $uri -inst $camera -telescope $telescope
-#        echo command $run
+        # find an exp that needs imfiles fetched
+        book getpage pzDataStore $datastore_index -var pageName
+        if ("$pageName" == "NULL") break
+
+        # increment our pzDataStore index and loop back to 0 and the end of the
+        # book
+        $datastore_index ++
+        book npages pzDataStore -var npages
+        if ($datastore_index == $npages )
+            $datastore_index = 0
+        end
+
+        book getword pzDataStore $pageName camera -var CAMERA
+        book getword pzDataStore $pageName telescope -var TELESCOPE
+        book getword pzDataStore $pageName uri -var URI
+
+        # store the current page
+        options $pageName
+
+        $run = pzgetexp -uri $URI -inst $CAMERA -telescope $TELESCOPE
+
+        # create the command line
+        if ($VERBOSE > 1)
+          echo command $run
+        end
+
         command $run
   end
-
-  task.exit     0
-  end
-
-  task.exit     default
-    showcommand failure
-  end
-  task.exit     timeout
-    showcommand timeout
-  end
-end
-
-task pzgetexp.allskycam
-  # timeout shorter than exec so jobs do not build up
-  periods      -exec     15
-  periods      -poll     1
-  periods      -timeout  15
-  host         local
-
-  task.exec
-      $uri        = http://otis1.ifa.hawaii.edu/ds/allskycam/index.txt
-      $camera     = allskycam
-      $telescope  = ps1
-        $run = pzgetexp -uri $uri -inst $camera -telescope $telescope
-#        echo command $run
-        command $run
-  end
-
-
-  task.exit     0
-  end
-
-  task.exit     default
-    showcommand failure
-  end
-  task.exit     timeout
-    showcommand timeout
-  end
-end
-
-task pzgetexp.isp
-  # timeout shorter than exec so jobs do not build up
-  periods      -exec     15
-  periods      -poll     1
-  periods      -timeout  15
-  host         local
-
-  task.exec
-      $uri        = http://otis1.ifa.hawaii.edu/ds/skyprobe/index.txt
-      $camera     = isp
-      $telescope  = ps1
-        $run = pzgetexp -uri $uri -inst $camera -telescope $telescope
-#        echo command $run
-        command $run
-  end
-
 
   task.exit     0
