Index: /trunk/ippTasks/camera.pro
===================================================================
--- /trunk/ippTasks/camera.pro	(revision 16172)
+++ /trunk/ippTasks/camera.pro	(revision 16173)
@@ -127,10 +127,6 @@
     book getword camPendingExp $pageName reduction -var REDUCTION
 
-    # specify choice of remote host:(need to choose based on chips)
-    if ($parallel)
-      host anyhost
-    else
-      host local
-    end
+    # specify choice of remote host based on camera and chip (class_id)
+    set.host.for.camera $camera FPA
 
     # output log from filerule
Index: /trunk/ippTasks/chip.pro
===================================================================
--- /trunk/ippTasks/chip.pro	(revision 16172)
+++ /trunk/ippTasks/chip.pro	(revision 16173)
@@ -127,11 +127,6 @@
     book getword chipPendingImfile $pageName reduction -var REDUCTION
 
-    # specify choice of remote host
-    # XXX need to choose based on chips
-    if ($parallel)
-      host anyhost
-    else
-      host local
-    end
+    # specify choice of local or remote host based on camera and chip (class_id)
+    set.host.for.camera $camera $class_id
 
     ## generate output log based on filerule
Index: /trunk/ippTasks/chiphosts.config
===================================================================
--- /trunk/ippTasks/chiphosts.config	(revision 16172)
+++ /trunk/ippTasks/chiphosts.config	(revision 16173)
@@ -2,6 +2,7 @@
 chiphosts MULTI
 
+# these camera names must match those listed in ipprc.config
 chiphosts METADATA
-  camera STR megacam
+  camera STR MEGACAM
   ccd00 STR po00
   ccd01 STR po01
@@ -17,7 +18,81 @@
 
 chiphosts METADATA
-  camera STR cfh12k
+  camera STR CFH12K
   ccd00 STR po10
   ccd01 STR po11
   ccd02 STR po12
 END
+
+$gpcHost00 = ipp005
+$gpcHost01 = ipp008
+$gpcHost02 = ipp019
+$gpcHost03 = ipp020
+$gpcHost04 = ipp021
+
+chiphosts METADATA
+  camera GPC1
+  XY01  STR  gpcHost00
+  XY02  STR  gpcHost00
+  XY03  STR  gpcHost00
+  XY04  STR  gpcHost00
+  XY05  STR  gpcHost00
+  XY06  STR  gpcHost00
+  XY10  STR  gpcHost00
+  XY11  STR  gpcHost00
+  XY12  STR  gpcHost00
+  XY13  STR  gpcHost00
+  XY14  STR  gpcHost00
+  XY15  STR  gpcHost00
+
+  XY16  STR  gpcHost01
+  XY17  STR  gpcHost01
+  XY20  STR  gpcHost01
+  XY21  STR  gpcHost01
+  XY22  STR  gpcHost01
+  XY23  STR  gpcHost01
+  XY24  STR  gpcHost01
+  XY25  STR  gpcHost01
+  XY26  STR  gpcHost01
+  XY27  STR  gpcHost01
+  XY30  STR  gpcHost01
+  XY31  STR  gpcHost01
+
+  XY32  STR  gpcHost02
+  XY33  STR  gpcHost02
+  XY34  STR  gpcHost02
+  XY35  STR  gpcHost02
+  XY36  STR  gpcHost02
+  XY37  STR  gpcHost02
+  XY40  STR  gpcHost02
+  XY41  STR  gpcHost02
+  XY42  STR  gpcHost02
+  XY43  STR  gpcHost02
+  XY44  STR  gpcHost02
+  XY45  STR  gpcHost02
+
+  XY46  STR  gpcHost03
+  XY47  STR  gpcHost03
+  XY50  STR  gpcHost03
+  XY51  STR  gpcHost03
+  XY52  STR  gpcHost03
+  XY53  STR  gpcHost03
+  XY54  STR  gpcHost03
+  XY55  STR  gpcHost03
+  XY56  STR  gpcHost03
+  XY57  STR  gpcHost03
+  XY60  STR  gpcHost03
+  XY61  STR  gpcHost03
+
+  XY62  STR  gpcHost04
+  XY63  STR  gpcHost04
+  XY64  STR  gpcHost04
+  XY65  STR  gpcHost04
+  XY66  STR  gpcHost04
+  XY67  STR  gpcHost04
+  XY71  STR  gpcHost04
+  XY72  STR  gpcHost04
+  XY73  STR  gpcHost04
+  XY74  STR  gpcHost04
+  XY75  STR  gpcHost04
+  XY76  STR  gpcHost04
+END
Index: /trunk/ippTasks/detrend.correct.pro
===================================================================
--- /trunk/ippTasks/detrend.correct.pro	(revision 16172)
+++ /trunk/ippTasks/detrend.correct.pro	(revision 16173)
@@ -148,10 +148,6 @@
     book getword detPendingCorrectedImfile $pageName dbname    -var DBNAME
 
-    # specify choice of remote host:
-    if ($parallel)
-      host anyhost
-    else
-      host local
-    end
+    # specify choice of local or remote host based on camera and chip (class_id)
+    set.host.for.camera $camera $class_id
 
     ## output log filename
@@ -279,10 +275,6 @@
     book getword detPendingCorrectedExp $pageName dbname    -var DBNAME
 
-    # specify choice of remote host:
-    if ($parallel)
-      host anyhost
-    else
-      host local
-    end
+    # specify choice of local or remote host based on camera and chip (class_id)
+    set.host.for.camera $camera FPA
 
     # XXX push this into the filerules?
Index: /trunk/ippTasks/detrend.norm.pro
===================================================================
--- /trunk/ippTasks/detrend.norm.pro	(revision 16172)
+++ /trunk/ippTasks/detrend.norm.pro	(revision 16173)
@@ -156,10 +156,6 @@
     book getword detPendingNormStatImfile $pageName dbname    -var DBNAME
 
-    # specify choice of remote host:
-    if ($parallel)
-      host anyhost
-    else
-      host local
-    end
+    # specify choice of local or remote host based on camera and chip (class_id)
+    set.host.for.camera $camera FPA
 
     if ("$WORKDIR" == "NULL")
@@ -278,10 +274,6 @@
     book getword detPendingNormImfile $pageName dbname    -var DBNAME
 
-    # specify choice of remote host:
-    if ($parallel)
-      host anyhost
-    else
-      host local
-    end
+    # specify choice of local or remote host based on camera and chip (class_id)
+    set.host.for.camera $camera $class_id
 
     # XXX use ipp_filename.pl to lookup output file names
@@ -398,10 +390,6 @@
     book getword detPendingNormExp $pageName dbname    -var DBNAME
 
-    # specify choice of remote host:
-    if ($parallel)
-      host anyhost
-    else
-      host local
-    end
+    # specify choice of local or remote host based on camera and chip (class_id)
+    set.host.for.camera $camera FPA
 
     # XXX add $WORKDIR/$LOG_DIR
Index: /trunk/ippTasks/detrend.process.pro
===================================================================
--- /trunk/ippTasks/detrend.process.pro	(revision 16172)
+++ /trunk/ippTasks/detrend.process.pro	(revision 16173)
@@ -147,10 +147,6 @@
     book getword detPendingProcessedImfile $pageName reduction -var REDUCTION
 
-    # specify choice of remote host:
-    if ($parallel)
-      host anyhost
-    else
-      host local
-    end
+    # specify choice of local or remote host based on camera and chip (class_id)
+    set.host.for.camera $camera $class_id
 
     ## output log filename
@@ -276,10 +272,6 @@
     book getword detPendingProcessedExp $pageName dbname    -var DBNAME
 
-    # specify choice of remote host:
-    if ($parallel)
-      host anyhost
-    else
-      host local
-    end
+    # specify choice of local or remote host based on camera and chip (class_id)
+    set.host.for.camera $camera FPA
 
     # XXX push this into the filerules?
Index: /trunk/ippTasks/detrend.reject.pro
===================================================================
--- /trunk/ippTasks/detrend.reject.pro	(revision 16172)
+++ /trunk/ippTasks/detrend.reject.pro	(revision 16173)
@@ -125,10 +125,6 @@
     book getword detRejectExp $pageName dbname    -var DBNAME
 
-    # specify choice of remote host:
-    if ($parallel)
-      host anyhost
-    else
-      host local
-    end
+    # specify choice of local or remote host based on camera and chip (class_id)
+    set.host.for.camera $camera FPA
 
     if ("$WORKDIR" == "NULL")
Index: /trunk/ippTasks/detrend.resid.pro
===================================================================
--- /trunk/ippTasks/detrend.resid.pro	(revision 16172)
+++ /trunk/ippTasks/detrend.resid.pro	(revision 16173)
@@ -147,10 +147,6 @@
     book getword detPendingResidImfile $pageName reduction -var REDUCTION
 
-    # specify choice of remote host:
-    if ($parallel)
-      host anyhost
-    else
-      host local
-    end
+    # specify choice of local or remote host based on camera and chip (class_id)
+    set.host.for.camera $camera $class_id
 
     # XXX use ipp_filename.pl to lookup output file names
@@ -279,10 +275,6 @@
     book getword detPendingResidExp $pageName dbname    -var DBNAME
 
-    # specify choice of remote host:
-    if ($parallel)
-      host anyhost
-    else
-      host local
-    end
+    # specify choice of local or remote host based on camera and chip (class_id)
+    set.host.for.camera $camera FPA
 
     # XXX use ipp_filename.pl to lookup output file names
Index: /trunk/ippTasks/detrend.stack.pro
===================================================================
--- /trunk/ippTasks/detrend.stack.pro	(revision 16172)
+++ /trunk/ippTasks/detrend.stack.pro	(revision 16173)
@@ -127,10 +127,6 @@
     book getword detPendingStackedImfile $pageName reduction -var REDUCTION
 
-    # specify choice of remote host:
-    if ($parallel)
-      host anyhost
-    else
-      host local
-    end
+    # specify choice of local or remote host based on camera and chip (class_id)
+    set.host.for.camera $camera $class_id
 
     if ("$WORKDIR" == "NULL")
Index: /trunk/ippTasks/notes.txt
===================================================================
--- /trunk/ippTasks/notes.txt	(revision 16172)
+++ /trunk/ippTasks/notes.txt	(revision 16173)
@@ -1,2 +1,39 @@
+
+2008.01.18
+
+  I'm working on the summit.copy.pro interaction with nebulous (and
+  those of the other ippTasks) and the assignment of jobs and data
+  locations to hosts on the basis of the chip/host relationship.  I
+  have defined a table which relates the chip (class_id) to the
+  desired host name.  There are a few places, and a few slightly
+  different ways, in which this gets used:
+
+  * choice of host for command execution:
+
+    every job which operates on a specific chip must be told the chip
+    host so it can run the job on that machine.  the information is
+    supplied in pantasks to the job with the 'host' command.  I've
+    made a pantasks macro 'set.host.by.camera' which takes the camera
+    and class_id, looks up the match in the chip/host table, and calls
+    the host command with the desired host.  If there is no match
+    (camera not listed in chip/host table or chip not listed in
+    table), the host is set to 'anyhost', which randomly chooses one.
+    I have used this command for all tasks which generate a pcontrol
+    command.  For the tasks which are performed at the camera level,
+    these are set to anyhost.  For the tasks which operate on stacks,
+    we can use the same structure to associate the skycell with a
+    host.  
+
+  * dsget output target:
+
+    dsget is called by pantasks in the task 'dsget'.  currently, dsget
+    accepts a --filename argument which specifies the output filename
+    to use.  we have to tell t
+  
+
+  * choice of output directory.   
+
+    the 
+
 
 2007.10.11
Index: /trunk/ippTasks/pantasks.pro
===================================================================
--- /trunk/ippTasks/pantasks.pro	(revision 16172)
+++ /trunk/ippTasks/pantasks.pro	(revision 16173)
@@ -1,4 +1,5 @@
 
 # XXX make these upper-case
+$NEBULOUS = 0
 $network = 1
 $parallel = 1
@@ -339,2 +340,50 @@
   ??
 end
+
+macro set.workdir.by.camera
+  if ($0 != 3)
+    echo "USAGE: set.workdir.by.camera (camera) (class_id)"
+    break
+  end
+
+  # missing camera and/or chiphosts table results in host = NULL
+  book getword chiphosts $1 $2 -var $host
+
+  if ($NEBULOUS)
+    if ("$host" == "NULL")
+      $workdir = $workdir_default
+      $volume  = "NULL"
+      return
+    end
+    strsub $workdir_template @HOST@ $host -var workdir
+    strsub $volume_template @HOST@ $host -var volume
+    return
+  end
+
+  if ("$host" == "NULL")
+    $workdir = $workdir_default
+    return
+  end
+  strsub $workdir_template @HOST@ $host -var workdir
+end
+
+macro set.host.by.camera
+  if ($0 != 3)
+    echo "USAGE: set.host.by.camera (camera) (class_id)"
+    break
+  end
+
+  if (not($parallel))
+    host local
+    return
+  end
+
+  # missing camera and/or chiphosts table results in host = NULL
+  book getword chiphosts $1 $2 -var $host
+
+  if ("$host" == "NULL")
+    host anyhost
+  else
+    host $host
+  end
+end
Index: /trunk/ippTasks/summit.copy.pro
===================================================================
--- /trunk/ippTasks/summit.copy.pro	(revision 16172)
+++ /trunk/ippTasks/summit.copy.pro	(revision 16173)
@@ -7,5 +7,15 @@
 # pztool -adddatastore -inst allskycam -telescope ps1 -uri  http://otis1.ifa.hawaii.edu/ds/allskycam/index.txt
 
-$workdir    = /data/ipp010.0/
+# the templates are used if we have a class_id/host relationship; if none is found, the default values are used
+# XXX not sure how to handle the .N value if we need to use more than one
+if ($NEBULOUS)
+ $workdir_default  = neb://
+ $workdir_template = neb://
+ $volume_default  = ipp004-v0
+ $volume_template = @HOST@-v0
+else
+ $workdir_default  = /data/ipp004.0/
+ $workdir_template = /data/@HOST@.0/
+end
 
 $VERBOSE = 1
@@ -34,4 +44,5 @@
     periods      -poll     1
     periods      -timeout  15
+    npending     1
 
     # success
@@ -231,5 +242,4 @@
     periods      -poll     0.05
     periods      -timeout  120
-    host        anyhost
 
     task.exec
@@ -264,16 +274,29 @@
         substr $DATEOBS 8 2 DAY
 
+        # we need to set the workdir based on 1) nebulous or not? 2) chip/host relationship
+        # this function uses workdir_template, workdir_default, volume_template, volume_default,
+        # it sets workdir and volume
+       	set.workdir.by.camera $CAMERA $CLASS_ID
+
         # figure out filename
+	# XXXX this filename needs to use nebulous names
         $FILENAME = $workdir/$CAMERA/$YEAR/$MONTH/$DAY/$EXP_NAME/$EXP_NAME.$CLASS_ID.fits
+        $FILEROOT = $workdir/$CAMERA/$YEAR/$MONTH/$DAY/$EXP_NAME/$EXP_NAME.$CLASS_ID
 
         book setword pzPendingImfile $pageName filename $FILENAME
+
+        set.host.by.camera $CAMERA $CLASS_ID
+        host        anyhost
 
         # store the pageName with this job
         options $pageName
-
-        if ($MD5SUM == 0) 
-            $run = dsget --uri $URI --filename $FILENAME --bytes $BYTES 
-        else
-            $run = dsget --uri $URI --filename $FILENAME --bytes $BYTES --md5 $MD5SUM
+        options $FILEROOT
+
+        $run = dsget --uri $URI --filename $FILENAME --bytes $BYTES 
+        if ($MD5SUM) 
+            $run = $run --md5 $MD5SUM
+        end
+        if ($NEBULOUS && ("$volname" != "NULL")) 
+            $run = $run --volume $volume
         end
 
@@ -295,6 +318,10 @@
         book getword pzPendingImfile $options:0 filename -var FILENAME
 
+	# we need to set the values of tess_id, dvodb, end_stage, workdir here 
+        # these are functions of (at least) EXP_TYPE and SURVEY_ID, both of which should come from the data store
+
 	# update the database with the success
-        $run = pztool -copydone -exp_name $EXP_NAME -inst $CAMERA -telescope $TELESCOPE -class $CLASS -class_id $CLASS_ID -uri $FILENAME
+        $run = pztool -copydone -exp_name $EXP_NAME -inst $CAMERA -telescope $TELESCOPE -class $CLASS -class_id $CLASS_ID -uri $FILENAME -workdir $options:1
+	# tess_id, dvodb, workdir, end_stage
 
         # create the command line
