Index: trunk/ippTasks/Makefile.am
===================================================================
--- trunk/ippTasks/Makefile.am	(revision 19537)
+++ trunk/ippTasks/Makefile.am	(revision 19545)
@@ -21,6 +21,6 @@
 
 other_files = \
-	chiphosts.manoa.config \
-	chiphosts.mhpcc.config \
+	ipphosts.manoa.config \
+	ipphosts.mhpcc.config \
 	site.manoa.pro \
 	site.mhpcc.pro \
Index: trunk/ippTasks/diff.pro
===================================================================
--- trunk/ippTasks/diff.pro	(revision 19537)
+++ trunk/ippTasks/diff.pro	(revision 19545)
@@ -142,27 +142,19 @@
     book getword diffSkyfile $pageName dbname -var DBNAME
 
-    ### XXX Instead of setting these by camera, need to set by skycell_id
-    ### XXX change these to use the --redirect scheme
-#    set.host.for.camera $CAMERA $DIFF_ID
-#    set.workdir.by.camera $CAMERA $DIFF_ID $WORKDIR_TEMPLATE $default_host WORKDIR
-    host anyhost
-    $WORKDIR = $WORKDIR_TEMPLATE
+    # set the host and workdir based on the skycell hash
+    set.host.for.skycell $SKYCELL_ID
+    set.workdir.by.skycell $SKYCELL_ID $WORKDIR_TEMPLATE $default_host WORKDIR
+
+    # XXX old code:
+    # host anyhost
+    # $WORKDIR = $WORKDIR_TEMPLATE
 
     basename $TESS_DIR -var TESS_ID
     sprintf outroot "%s/%s/%s/%s.%s.dif.%s" $WORKDIR $TESS_ID $SKYCELL_ID $TESS_ID $SKYCELL_ID $DIFF_ID
 
-    ## generate output log based on filerule (convert the URI to a PATH)
-    $logfile = `ipp_filename.pl --filerule LOG.EXP --camera $CAMERA --class_id $DIFF_ID --basename $outroot`
-    if ("$logfile" == "") 
-      echo "WARNING: logfile not defined in diff.skycell.run"
-      break
-    end
-
-    stdout $logfile
-    stderr $logfile
-    dirname $logfile -var outpath
-    mkdir $outpath
-
-    $run = diff_skycell.pl --threads @MAX_THREADS@ --diff_id $DIFF_ID --outroot $outroot
+    stdout $LOGDIR/diff.skycell.log
+    stderr $LOGDIR/diff.skycell.log
+
+    $run = diff_skycell.pl --threads @MAX_THREADS@ --diff_id $DIFF_ID --outroot $outroot --redirect-output
     add_standard_args run
 
Index: trunk/ippTasks/ipphosts.manoa.config
===================================================================
--- trunk/ippTasks/ipphosts.manoa.config	(revision 19545)
+++ trunk/ippTasks/ipphosts.manoa.config	(revision 19545)
@@ -0,0 +1,19 @@
+## basic chiphost table: use the defaults for everything
+
+chiphosts MULTI
+
+chiphosts METADATA
+  camera STR MEGACAM
+END
+
+chiphosts METADATA
+  camera STR CFH12K
+END
+
+chiphosts METADATA
+  camera STR GPC1
+END
+
+chiphosts METADATA
+  camera STR gpc1
+END
Index: trunk/ippTasks/ipphosts.mhpcc.config
===================================================================
--- trunk/ippTasks/ipphosts.mhpcc.config	(revision 19545)
+++ trunk/ippTasks/ipphosts.mhpcc.config	(revision 19545)
@@ -0,0 +1,185 @@
+ipphosts MULTI
+
+ipphosts METADATA
+  camera STR skycell
+  count S32  8
+  sky00 STR  ipp006
+  sky01 STR  ipp007
+  sky02 STR  ipp008 
+  sky03 STR  ipp009
+  sky04 STR  ipp010
+  sky05 STR  ipp011
+  sky06 STR  ipp020
+  sky07 STR  ipp021
+END
+
+ipphosts METADATA
+  camera STR MEGACAM
+  ccd00 STR po00
+  ccd01 STR po01
+  ccd02 STR po02
+  ccd03 STR po03
+  ccd04 STR po04
+  ccd05 STR po05
+  ccd06 STR po06
+  ccd07 STR po07
+  ccd08 STR po08
+  ccd09 STR po09
+END
+
+ipphosts METADATA
+  camera STR CFH12K
+  ccd00 STR po10
+  ccd01 STR po11
+  ccd02 STR po12
+END
+
+ipphosts METADATA
+  camera STR GPC1
+
+  XY01  STR  ipp018
+  XY02  STR  ipp018
+  XY03  STR  ipp018
+  XY04  STR  ipp018
+  XY05  STR  ipp018
+  XY06  STR  ipp018
+
+  XY10  STR  ipp006
+  XY11  STR  ipp006
+  XY12  STR  ipp006
+  XY13  STR  ipp006
+  XY14  STR  ipp006
+  XY15  STR  ipp006
+
+  XY16  STR  ipp007
+  XY17  STR  ipp007
+  XY20  STR  ipp007
+  XY21  STR  ipp007
+  XY22  STR  ipp007
+  XY23  STR  ipp007
+
+  XY24  STR  ipp008 
+  XY25  STR  ipp008
+  XY26  STR  ipp008
+  XY27  STR  ipp008
+  XY30  STR  ipp008
+  XY31  STR  ipp008
+
+  XY32  STR  ipp009
+  XY33  STR  ipp009
+  XY34  STR  ipp009
+  XY35  STR  ipp009
+  XY36  STR  ipp009
+  XY37  STR  ipp009
+
+  XY40  STR  ipp010
+  XY41  STR  ipp010
+  XY42  STR  ipp010
+  XY43  STR  ipp010
+  XY44  STR  ipp010
+  XY45  STR  ipp010
+
+  XY46  STR  ipp011
+  XY47  STR  ipp011
+  XY50  STR  ipp011
+  XY51  STR  ipp011
+  XY52  STR  ipp011
+  XY53  STR  ipp011
+
+                    # This set should be going to ipp017 
+  XY54  STR  ipp007
+  XY55  S0R  ipp009
+  XY56  STR  ipp010
+  XY57  STR  ipp011
+  XY60  STR  ipp020
+  XY61  STR  ipp021
+
+  XY62  STR  ipp020
+  XY63  STR  ipp020
+  XY64  STR  ipp020
+  XY65  STR  ipp020
+  XY66  STR  ipp020
+  XY67  STR  ipp020
+
+  XY71  STR  ipp021
+  XY72  STR  ipp021
+  XY73  STR  ipp021
+  XY74  STR  ipp021
+  XY75  STR  ipp021
+  XY76  STR  ipp021
+END
+
+ipphosts METADATA
+  camera STR gpc1
+
+  ota01  STR  ipp018
+  ota02  STR  ipp018
+  ota03  STR  ipp018
+  ota04  STR  ipp018
+  ota19  STR  ipp018
+  ota06  STR  ipp018
+
+  ota10  STR  ipp006
+  ota11  STR  ipp006
+  ota12  STR  ipp006
+  ota13  STR  ipp006
+  ota14  STR  ipp006
+  ota15  STR  ipp006
+
+  ota16  STR  ipp007
+  ota17  STR  ipp007
+  ota20  STR  ipp007
+  ota21  STR  ipp007
+  ota22  STR  ipp007
+  ota23  STR  ipp007
+
+  ota24  STR  ipp008
+  ota25  STR  ipp008
+  ota26  STR  ipp008
+  ota27  STR  ipp008
+  ota30  STR  ipp008
+  ota31  STR  ipp008
+
+  ota32  STR  ipp009
+  ota33  STR  ipp009
+  ota34  STR  ipp009
+  ota35  STR  ipp009
+  ota36  STR  ipp009
+  ota37  STR  ipp009
+
+  ota40  STR  ipp010
+  ota41  STR  ipp010
+  ota42  STR  ipp010
+  ota43  STR  ipp010
+  ota44  STR  ipp010
+  ota45  STR  ipp010
+
+  ota46  STR  ipp011
+  ota47  STR  ipp011
+  ota50  STR  ipp011
+  ota51  STR  ipp011
+  ota52  STR  ipp011
+  ota53  STR  ipp011
+
+                    # This set should be going to ipp017 
+  ota54  STR  ipp007
+  ota55  STR  ipp009
+  ota56  STR  ipp010
+  ota57  STR  ipp011
+  ota60  STR  ipp020
+  ota61  STR  ipp021
+
+  ota62  STR  ipp020
+  ota63  STR  ipp020
+  ota64  STR  ipp020
+  ota65  STR  ipp020
+  ota66  STR  ipp020
+  ota67  STR  ipp020
+
+  ota71  STR  ipp021
+  ota72  STR  ipp021
+  ota73  STR  ipp021
+  ota74  STR  ipp021
+  ota75  STR  ipp021
+  ota76  STR  ipp021
+END
Index: trunk/ippTasks/pantasks.pro
===================================================================
--- trunk/ippTasks/pantasks.pro	(revision 19537)
+++ trunk/ippTasks/pantasks.pro	(revision 19545)
@@ -350,6 +350,6 @@
   end
 
-  # missing camera and/or chiphosts table results in host = NULL
-  book getword chiphosts $camera $classID -var host
+  # missing camera and/or ipphosts table results in host = NULL
+  book getword ipphosts $camera $classID -var host
 
   if ("$host" == "NULL")
@@ -360,32 +360,40 @@
 end
 
-macro set.volume.by.camera
-  if ($0 != 3)
-    echo "USAGE: set.volume.by.camera (camera) (class_id) (template) (default) (varname)"
-    echo " uses global variable NEBULOUS to determine if nebulous is active"
-    break
-  end
-
-  local host default template camera classID varname
-  $camera = $1
-  $classID = $2
-  $template = $3
-  $default = $4
-  $varname = $5
-
-  # missing camera and/or chiphosts table results in host = NULL
-  book getword chiphosts $camera $classID -var host
-
-  if (not($NEBULOUS))
-    $$varname = "NULL"
-    return
-  end
-
-  if ("$host" == "NULL") 
-    $$varname = $default
-    return
-  end
-
-  strsub $template @HOST@ $host -var $varname
+macro set.workdir.by.skycell
+  if ($0 != 5)
+    echo "USAGE: set.workdir.by.skycell (skycellID) (template) (default) (varname)"
+    break
+  end
+
+  local host default template skycellID varname count
+  $skycellID = $1
+  $template = $2
+  $default = $3
+  $varname = $4
+
+  if ("$template" == "NULL")
+    $varname = $workdir_template
+    echo "WARNING: WORKDIR template not set.  Defaulting to $workdir_template"
+    break
+  end
+
+  # get the folding count for this camera  
+  book getword ipphosts skycell count -var count
+  if ("$count" == "NULL")
+    strsub $template @HOST@ $default -var $varname
+    return
+  end    
+
+  strhash $skycellID $count -var skyhash
+  sprintf skyname "sky%02d" $skyhash
+
+  # missing ipphosts table results in host = NULL
+  book getword ipphosts skycell $skyname -var host
+
+  if ("$host" == "NULL")
+    strsub $template @HOST@ $default -var $varname
+  else
+    strsub $template @HOST@ $host -var $varname
+  end
 end
 
@@ -396,4 +404,6 @@
   end
 
+  local host
+
   if (not($PARALLEL))
     host local
@@ -401,6 +411,6 @@
   end
 
-  # missing camera and/or chiphosts table results in host = NULL
-  book getword chiphosts $1 $2 -var host
+  # missing camera and/or ipphosts table results in host = NULL
+  book getword ipphosts $1 $2 -var host
 
   if ("$host" == "NULL")
@@ -411,4 +421,33 @@
 end
 
+macro set.host.for.skycell
+  if ($0 != 2)
+    echo "USAGE: set.host.for.skycell (skycellID)"
+    break
+  end
+
+  local skycellID varname count host skyname skyhash
+  $skycellID = $1
+
+  # get the folding count for this camera  
+  book getword ipphosts skycell count -var count
+  if ("$count" == "NULL")
+    host anyhost
+    return
+  end    
+
+  strhash $skycellID $count -var skyhash
+  sprintf skyname "sky%02d" $skyhash
+
+  # missing ipphosts table results in host = NULL
+  book getword ipphosts skycell $skyname -var host
+
+  if ("$host" == "NULL")
+    host anyhost
+  else
+    host $host
+  end
+end
+
 macro get.host.for.camera
   if ($0 != 3)
@@ -422,6 +461,6 @@
   end
 
-  # missing camera and/or chiphosts table results in host = NULL
-  book getword chiphosts $1 $2 -var host
+  # missing camera and/or ipphosts table results in host = NULL
+  book getword ipphosts $1 $2 -var host
 
   if ("$host" == "NULL")
Index: trunk/ippTasks/site.manoa.pro
===================================================================
--- trunk/ippTasks/site.manoa.pro	(revision 19537)
+++ trunk/ippTasks/site.manoa.pro	(revision 19545)
@@ -4,5 +4,5 @@
 ## 1) the machines used for processing
 ## 2) the default_host and workdir_template variables
-## 3) the chiphost table
+## 3) the ipphost table
 
 macro init.cluster.po
@@ -48,5 +48,5 @@
 
 macro init.site
-  queueload tmp -x "cat $MODULES:0/chiphosts.manoa.config"
-  ipptool2book tmp chiphosts -key camera
+  queueload tmp -x "cat $MODULES:0/ipphosts.manoa.config"
+  ipptool2book tmp ipphosts -key camera
 end
Index: trunk/ippTasks/site.mhpcc.pro
===================================================================
--- trunk/ippTasks/site.mhpcc.pro	(revision 19537)
+++ trunk/ippTasks/site.mhpcc.pro	(revision 19545)
@@ -4,5 +4,5 @@
 ## 1) the machines used for processing
 ## 2) the default_host and workdir_template variables
-## 3) the chiphost table
+## 3) the ipphost table
 
 macro init.cluster.mhpcc
@@ -59,6 +59,6 @@
   init.copy.mhpcc on
 
-  queueload tmp -x "cat $MODULES:0/chiphosts.mhpcc.config"
-  ipptool2book tmp chiphosts -key camera
+  queueload tmp -x "cat $MODULES:0/ipphosts.mhpcc.config"
+  ipptool2book tmp ipphosts -key camera
 end
 
@@ -66,5 +66,5 @@
   init.copy.mhpcc on
 
-  queueload tmp -x "cat $MODULES:0/chiphosts.mhpcc.config"
-  ipptool2book tmp chiphosts -key camera
+  queueload tmp -x "cat $MODULES:0/ipphosts.mhpcc.config"
+  ipptool2book tmp ipphosts -key camera
 end
Index: trunk/ippTasks/stack.pro
===================================================================
--- trunk/ippTasks/stack.pro	(revision 19537)
+++ trunk/ippTasks/stack.pro	(revision 19545)
@@ -142,27 +142,19 @@
     book getword stackSumSkyfile $pageName dbname -var DBNAME
 
-    ### XXX Instead of setting these by camera, need to set by skycell_id
-#    set.host.for.camera $CAMERA $STACK_ID
-#    set.workdir.by.camera $CAMERA $STACK_ID $WORKDIR_TEMPLATE $default_host WORKDIR
-    host anyhost
-    $WORKDIR = $WORKDIR_TEMPLATE
+    # set the host and workdir based on the skycell hash
+    set.host.for.skycell $SKYCELL_ID
+    set.workdir.by.skycell $SKYCELL_ID $WORKDIR_TEMPLATE $default_host WORKDIR
+
+    # XXX old code:
+    # host anyhost
+    # $WORKDIR = $WORKDIR_TEMPLATE
 
     basename $TESS_DIR -var TESS_ID
     sprintf outroot "%s/%s/%s/%s.%s.stk.%s" $WORKDIR $TESS_ID $SKYCELL_ID $TESS_ID $SKYCELL_ID $STACK_ID
 
-    ## generate output log based on filerule (convert the URI to a PATH) (use STACK_ID?)
-#    $logfile = `ipp_filename.pl --filerule LOG.EXP --camera $CAMERA --class_id $STACK_ID --basename $outroot`
-    $logfile = `ipp_filename.pl --filerule LOG.EXP --camera $CAMERA --class_id NONE --basename $outroot`
-    if ("$logfile" == "") 
-      echo "WARNING: logfile not defined in stack.pro:135"
-      break
-    end
-
-    stdout $logfile
-    stderr $logfile
-    dirname $logfile -var outpath
-    mkdir $outpath
-
-    $run = stack_skycell.pl --threads @MAX_THREADS@ --stack_id $STACK_ID --outroot $outroot
+    stdout $LOGDIR/stack.skycell.log
+    stderr $LOGDIR/stack.skycell.log
+
+    $run = stack_skycell.pl --threads @MAX_THREADS@ --stack_id $STACK_ID --outroot $outroot --redirect-output
     add_standard_args run
 
Index: trunk/ippTasks/warp.pro
===================================================================
--- trunk/ippTasks/warp.pro	(revision 19537)
+++ trunk/ippTasks/warp.pro	(revision 19545)
@@ -158,5 +158,5 @@
     book getword warpInputExp $pageName exp_tag -var EXP_TAG
 
-    ### XXX Instead of setting these by camera, need to set by skycell_id
+    # set the host and workdir (default)
     set.host.for.camera $CAMERA $WARP_ID
     set.workdir.by.camera $CAMERA $WARP_ID $WORKDIR_TEMPLATE $default_host WORKDIR
@@ -273,11 +273,7 @@
     book getword warpPendingSkyCell $pageName exp_tag -var EXP_TAG
 
-    ### XXX Instead of setting these by camera, need to set by skycell_id
-    set.host.for.camera $CAMERA $WARP_ID
-    set.workdir.by.camera $CAMERA $WARP_ID $WORKDIR_TEMPLATE $default_host WORKDIR
-
-    # XXX we are supplied TESS_DIR, strip off path to generate TESS_ID
-    # basename $TESS_DIR -var TESS_ID
-    # sprintf outroot "%s/%s/%s/%s.%s.wrp.%s" $WORKDIR $TESS_ID $SKYCELL_ID $TESS_ID $SKYCELL_ID $WARP_ID
+    # set the host and workdir based on the skycell hash
+    set.host.for.skycell $SKYCELL_ID
+    set.workdir.by.skycell $SKYCELL_ID $WORKDIR_TEMPLATE $default_host WORKDIR
 
     ## generate outroot specific to this exposure
