Index: /branches/eam_branches/ipp-20230313/ippTasks/xccal.pro
===================================================================
--- /branches/eam_branches/ipp-20230313/ippTasks/xccal.pro	(revision 42696)
+++ /branches/eam_branches/ipp-20230313/ippTasks/xccal.pro	(revision 42697)
@@ -194,5 +194,5 @@
     end
     # since we have work to do shorten exec time
-    periods -exec .05
+    periods -exec 0.05
     command $run
   end
Index: /branches/eam_branches/ipp-20230313/ippTasks/xcff.pro
===================================================================
--- /branches/eam_branches/ipp-20230313/ippTasks/xcff.pro	(revision 42697)
+++ /branches/eam_branches/ipp-20230313/ippTasks/xcff.pro	(revision 42697)
@@ -0,0 +1,464 @@
+## xcff.pro : tasks for forced-photometry on the xcstack input warps : -*- sh -*-
+
+## This file contains panTasks definitions for performing the xcff analysis. 
+
+# test for required global variables
+check.globals
+
+### Initialise the books containing the tasks to do
+book init xcffRun
+book init xcffSummary
+
+### Database lists
+$xcff_DB = 0
+$xcff_revert_DB = 0
+$xcffSummary_DB = 0
+$xcffSummary_revert_DB = 0
+
+### Check status of xcff tasks
+macro xcff.status
+  book listbook xcffRun
+end
+
+### Reset xcff tasks
+macro xcff.reset
+  book init xcffRun
+end
+macro xcff.summary.status
+  book listbook xcffSummary
+end
+
+### Reset xcff tasks
+macro xcff.summary.reset
+  book init xcffSummary
+end
+
+### Turn xcff tasks on
+macro xcff.on
+  task xcff.load
+    active true
+  end
+  task xcff.run
+    active true
+  end
+  task xcff.summary.load
+    active true
+  end
+  task xcff.summary.run
+    active true
+  end
+end
+
+### Turn xcff tasks off
+macro xcff.off
+  task xcff.load
+    active false
+  end
+  task xcff.run
+    active false
+  end
+  task xcff.summary.load
+    active false
+  end
+  task xcff.summary.run
+    active false
+  end
+end
+
+macro xcff.revert.on
+  task xcff.revert
+    active true
+  end
+  task xcff.summary.revert
+    active true
+  end
+end
+
+macro xcff.revert.off
+  task xcff.revert
+    active false
+  end
+  task xcff.summary.revert
+    active false
+  end
+end
+
+### Load tasks for xcff
+### Tasks are loaded into xcffRun.
+task	       xcff.load
+  host         local
+
+  periods      -poll $LOADPOLL
+  periods      -exec $LOADEXEC
+  periods      -timeout 30
+  npending     1
+
+  stdout NULL
+  stderr $LOGDIR/xcff.log
+
+  task.exec
+    if ($LABEL:n == 0) break
+    $run = xcfftool -todo
+    if ($DB:n == 0)
+      option DEFAULT
+    else
+      # save the DB name for the exit tasks
+      option $DB:$xcff_DB
+      $run = $run -dbname $DB:$xcff_DB
+      $xcff_DB ++
+      if ($xcff_DB >= $DB:n) set xcff_DB = 0
+    end
+    add_poll_args run
+    add_poll_labels run
+    command $run
+  end
+
+  # success
+  task.exit    0
+    # convert 'stdout' to book format
+    ipptool2book stdout xcffRun -key xcff_id:warp_id -uniq -setword dbname $options:0 -setword pantaskState INIT
+    if ($VERBOSE > 2)
+      book listbook xcffRun
+    end
+
+    # delete existing entries in the appropriate pantaskStates
+    process_cleanup xcffRun
+  end
+
+  # locked list
+  task.exit    default
+    showcommand failure
+  end
+
+  task.exit    crash
+    showcommand crash
+  end
+
+  # operation times out?
+  task.exit    timeout
+    showcommand timeout
+  end
+end
+
+### Run tasks for the xcff analysis
+### Tasks are taken from xcffRun.
+task	       xcff.run
+  periods      -poll $RUNPOLL
+  periods      -exec $RUNEXEC
+  periods      -timeout 10800
+
+  task.exec
+    # if we are unable to run use "long" exectime
+    periods -exec $RUNEXEC
+    book npages xcffRun -var N
+    if ($N == 0) break
+    if ($NETWORK == 0) break
+    if ($BURNTOOLING == 1) break
+
+
+    # look for new entries in xcffRun (pantaskState == INIT)
+    book getpage xcffRun 0 -var pageName -key pantaskState INIT
+    if ("$pageName" == "NULL") break
+
+    book setword xcffRun $pageName pantaskState RUN
+    book getword xcffRun $pageName xcff_id -var XCFF_ID
+    book getword xcffRun $pageName warp_id -var WARP_ID
+    book getword xcffRun $pageName sources_path_base -var SOURCES_PATH_BASE
+    book getword xcffRun $pageName tess_id -var TESS_DIR
+    book getword xcffRun $pageName skycell_id -var SKYCELL_ID
+    book getword xcffRun $pageName workdir -var WORKDIR_TEMPLATE
+    book getword xcffRun $pageName warp_path_base -var WARP_PATH_BASE
+    book getword xcffRun $pageName reduction -var REDUCTION
+    book getword xcffRun $pageName dbname -var DBNAME
+
+    # move this above when we get camera into the db correctly:
+    # book getword xcffRun $pageName camera -var CAMERA
+    $CAMERA = GPC1
+
+    # set the host and workdir based on the skycell hash
+    # set.host.for.skycell $SKYCELL_ID
+    host anyhost
+    set.workdir.by.skycell $SKYCELL_ID $WORKDIR_TEMPLATE $default_host WORKDIR
+
+    basename $TESS_DIR -var TESS_ID
+    sprintf outroot "%s/%s/%s/%s.%s.wrp.%s.xcff.%s" $WORKDIR $TESS_ID $SKYCELL_ID $TESS_ID $SKYCELL_ID $WARP_ID $XCFF_ID
+
+    stdout $LOGDIR/xcff.log
+    stderr $LOGDIR/xcff.log
+
+    $run = xcff_warp.pl --xcff_id $XCFF_ID --warp_id $WARP_ID --outroot $outroot --redirect-output --camera $CAMERA --warp_path_base $WARP_PATH_BASE --sources_path_base $SOURCES_PATH_BASE --skycell_id $SKYCELL_ID --threads @MAX_THREADS@
+    if ("$REDUCTION" != "NULL")
+      $run = $run --reduction $REDUCTION
+    end
+    add_standard_args run
+
+    # save the pageName for future reference below
+    options $pageName
+
+    # create the command line
+    if ($VERBOSE > 1)
+      echo command $run
+    end
+    # since we have work to do shorten exec time
+    periods -exec 0.05
+    command $run
+  end
+
+  # default exit status
+  task.exit    default
+    process_exit xcffRun $options:0 $JOB_STATUS
+  end
+
+  # locked list
+  task.exit    crash
+    showcommand crash
+    echo "hostname: $JOB_HOSTNAME"
+    book setword xcffRun $options:0 pantaskState CRASH
+  end
+
+  # operation timed out?
+  task.exit    timeout
+    showcommand timeout
+    book setword xcffRun $options:0 pantaskState TIMEOUT
+  end
+end
+
+task xcff.revert
+  host         local
+
+  periods      -poll 10.0
+  periods      -exec 1200.0
+  periods      -timeout 120.0
+  npending     1
+  active true
+  
+  stdout NULL
+  stderr $LOGDIR/xcff.revert.log
+
+  task.exec
+    if ($LABEL:n == 0) break
+    # Only revert failures with fault=2 (SYS_ERROR), which tend to be
+    # temporary filesystem problems.  Every other fault type is
+    # interesting and should be kept for debugging (and so it does not
+    # continue to occur).
+    $run = xcfftool -revert -fault 2
+    if ($DB:n == 0)
+      option DEFAULT
+    else
+      # save the DB name for the exit tasks
+      option $DB:$xcff_revert_DB
+      $run = $run -dbname $DB:$xcff_revert_DB
+      $xcff_revert_DB ++
+      if ($xcff_revert_DB >= $DB:n) set xcff_revert_DB = 0
+    end
+    add_poll_labels run
+    command $run
+  end
+
+  # success
+  task.exit    0
+  end
+
+  # locked list
+  task.exit    default
+    showcommand failure
+  end
+
+  task.exit    crash
+    showcommand crash
+  end
+
+  # operation times out?
+  task.exit    timeout
+    showcommand timeout
+  end
+end
+
+### Load tasks for xcffSummary
+### Tasks are loaded into xcffSummary.
+task	       xcff.summary.load
+  host         local
+
+  periods      -poll $LOADPOLL
+  periods      -exec $LOADEXEC
+  periods      -timeout 30
+  npending     1
+
+  stdout NULL
+  stderr $LOGDIR/xcff.summary.log
+
+  task.exec
+    if ($LABEL:n == 0) break
+    $run = xcfftool -toadvance
+    if ($DB:n == 0)
+      option DEFAULT
+    else
+      # save the DB name for the exit tasks
+      option $DB:$xcffSummary_DB
+      $run = $run -dbname $DB:$xcffSummary_DB
+      $xcffSummary_DB ++
+      if ($xcffSummary_DB >= $DB:n) set xcffSummary_DB = 0
+    end
+    add_poll_args run
+    add_poll_labels run
+    command $run
+  end
+
+  # success
+  task.exit    0
+    # convert 'stdout' to book format
+    ipptool2book stdout xcffSummary -key xcff_id -uniq -setword dbname $options:0 -setword pantaskState INIT
+    if ($VERBOSE > 2)
+      book listbook xcffSummary
+    end
+
+    # delete existing entries in the appropriate pantaskStates
+    process_cleanup xcffSummary
+  end
+
+  # locked list
+  task.exit    default
+    showcommand failure
+  end
+
+  task.exit    crash
+    showcommand crash
+  end
+
+  # operation times out?
+  task.exit    timeout
+    showcommand timeout
+  end
+end
+
+### Run tasks for the xcffSummary analyasis
+### Tasks are taken from xcffSummary.
+task	       xcff.summary.run
+  periods      -poll $RUNPOLL
+  periods      -exec $RUNEXEC
+  periods      -timeout 10800
+
+  task.exec
+    # if we are unable to run use "long" exectime
+    periods -exec $RUNEXEC
+    book npages xcffSummary -var N
+    if ($N == 0) break
+    if ($NETWORK == 0) break
+    if ($BURNTOOLING == 1) break
+
+
+    # look for new entries in xcffSummary (pantaskState == INIT)
+    book getpage xcffSummary 0 -var pageName -key pantaskState INIT
+    if ("$pageName" == "NULL") break
+
+    book setword xcffSummary $pageName pantaskState RUN
+    book getword xcffSummary $pageName xcff_id -var XCFF_ID
+    book getword xcffSummary $pageName tess_id -var TESS_DIR
+    book getword xcffSummary $pageName skycell_id -var SKYCELL_ID
+    book getword xcffSummary $pageName workdir -var WORKDIR_TEMPLATE
+    book getword xcffSummary $pageName reduction -var REDUCTION
+    book getword xcffSummary $pageName dbname -var DBNAME
+
+    # move this above when we get camera into the db correctly:
+    # book getword xcffSummary $pageName camera -var CAMERA
+    $CAMERA = GPC1
+
+    # set the host and workdir based on the skycell hash
+    # set.host.for.skycell $SKYCELL_ID
+    host anyhost
+    set.workdir.by.skycell $SKYCELL_ID $WORKDIR_TEMPLATE $default_host WORKDIR
+
+    basename $TESS_DIR -var TESS_ID
+    sprintf outroot "%s/%s/%s/%s.%s.xcff.%s" $WORKDIR $TESS_ID $SKYCELL_ID $TESS_ID $SKYCELL_ID $XCFF_ID
+
+    stdout $LOGDIR/xcff.summary.log
+    stderr $LOGDIR/xcff.summary.log
+
+    $run = xcff_summary.pl --xcff_id $XCFF_ID --outroot $outroot --redirect-output --camera $CAMERA --threads @MAX_THREADS@
+    if ("$REDUCTION" != "NULL")
+      $run = $run --reduction $REDUCTION
+    end
+    add_standard_args run
+
+    # save the pageName for future reference below
+    options $pageName
+
+    # create the command line
+    if ($VERBOSE > 1)
+      echo command $run
+    end
+    # since we have work to do shorten exec time
+    periods -exec 0.05
+    command $run
+  end
+
+  # default exit status
+  task.exit    default
+    process_exit xcffSummary $options:0 $JOB_STATUS
+  end
+
+  # locked list
+  task.exit    crash
+    showcommand crash
+    echo "hostname: $JOB_HOSTNAME"
+    book setword xcffSummary $options:0 pantaskState CRASH
+  end
+
+  # operation timed out?
+  task.exit    timeout
+    showcommand timeout
+    book setword xcffSummary $options:0 pantaskState TIMEOUT
+  end
+end
+
+task xcff.summary.revert
+  host         local
+
+  periods      -poll 10.0
+  periods      -exec 1200.0
+  periods      -timeout 120.0
+  npending     1
+  active true
+  
+  stdout NULL
+  stderr $LOGDIR/xcff.summary.revert.log
+
+  task.exec
+    if ($LABEL:n == 0) break
+    # Only revert failures with fault=2 (SYS_ERROR), which tend to be
+    # temporary filesystem problems.  Every other fault type is
+    # interesting and should be kept for debugging (and so it does not
+    # continue to occur).
+    $run = xcfftool -revertsummary -fault 2
+    if ($DB:n == 0)
+      option DEFAULT
+    else
+      # save the DB name for the exit tasks
+      option $DB:$xcffSummary_revert_DB
+      $run = $run -dbname $DB:$xcffSummary_revert_DB
+      $xcffSummary_revert_DB ++
+      if ($xcffSummary_revert_DB >= $DB:n) set xcffSummary_revert_DB = 0
+    end
+    add_poll_labels run
+    command $run
+  end
+
+  # success
+  task.exit    0
+  end
+
+  # locked list
+  task.exit    default
+    showcommand failure
+  end
+
+  task.exit    crash
+    showcommand crash
+  end
+
+  # operation times out?
+  task.exit    timeout
+    showcommand timeout
+  end
+end
+
Index: /branches/eam_branches/ipp-20230313/ippTasks/xcstack.pro
===================================================================
--- /branches/eam_branches/ipp-20230313/ippTasks/xcstack.pro	(revision 42696)
+++ /branches/eam_branches/ipp-20230313/ippTasks/xcstack.pro	(revision 42697)
@@ -8,5 +8,5 @@
 check.globals
 
-if ($?POLL_LIMIT_XCSTACK == 0) set POLL_LIMIT_XCSTACK = 40
+if ($?POLL_LIMIT_XCSTACK == 0) set POLL_LIMIT_XCSTACK = 100
 
 macro set.xcstack.poll
@@ -91,6 +91,4 @@
 
   task.exec
-    periods -exec $LOADEXEC
-
     if ($LABEL:n == 0) break
     $run = xcstacktool -tosum
@@ -109,6 +107,4 @@
     $run = $run -limit $POLL_LIMIT_XCSTACK
 
-    # re-try quickly until we run out
-    periods -exec 0.05
     command $run
   end
@@ -149,4 +145,7 @@
 
   task.exec
+    # if we are unable to run the 'exec', use a long retry time
+    periods -exec $LOADEXEC
+
     book npages xcstackSumSkyfile -var N
     if ($N == 0) break
@@ -200,4 +199,7 @@
       echo command $run
     end
+
+    # re-try quickly until we run out
+    periods -exec 0.05
     command $run
   end
