Index: trunk/ippTasks/diff.pro
===================================================================
--- trunk/ippTasks/diff.pro	(revision 16300)
+++ trunk/ippTasks/diff.pro	(revision 16743)
@@ -115,31 +115,22 @@
     book setword diffSkyfile $pageName pantaskState RUN
     book getword diffSkyfile $pageName diff_id -var DIFF_ID
-    book getword diffSkyfile $pageName workdir -var WORKDIR
+    book getword diffSkyfile $pageName workdir -var WORKDIR_TEMPLATE
     book getword diffSkyfile $pageName dbname -var DBNAME
 
-    # specify choice of remote host
-    # XXX need to choose based on diffs
-    if ($PARALLEL)
-      host anyhost
-    else
-      host local
-    end
+    ### XXX Instead of setting these by camera, need to set by skycell_id
+    set.host.for.camera $CAMERA $DIFF_ID
+    set.workdir.by.camera $CAMERA $DIFF_ID $WORKDIR_TEMPLATE $default_host WORKDIR
 
-    ## generate output log based on filerule
-    if ("$WORKDIR" == "NULL")
-      $outroot = `pwd`
-    else
-      $outroot = `ipp_datapath.pl $WORKDIR`
-    end
-    sprintf outroot "%s/diff.%s" $outroot $DIFF_ID
-    sprintf logfile "%s/skycell.log" $outroot
+    sprintf outroot "%s/tess_%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 $STACK_ID --basename $outroot`
+
     stdout $logfile
     stderr $logfile
-    exec mkdir -p $outroot
+    dirname $logfile -var outpath
+    mkdir $outpath
 
-    $run = diff_skycell.pl --diff_id $DIFF_ID
-    if ("$WORKDIR" != "NULL")
-      $run = $run --workdir $WORKDIR
-    end
+    $run = diff_skycell.pl --diff_id $DIFF_ID --outroot $outroot
     add_standard_args run
 
