Index: /branches/czw_branch/20100519/ippScripts/scripts/skycell_jpeg.pl
===================================================================
--- /branches/czw_branch/20100519/ippScripts/scripts/skycell_jpeg.pl	(revision 28045)
+++ /branches/czw_branch/20100519/ippScripts/scripts/skycell_jpeg.pl	(revision 28045)
@@ -0,0 +1,319 @@
+#! /usr/bin/env perl
+
+use warnings;
+use strict;
+use Carp;
+use IPC::Cmd 0.36 qw( can_run run);
+use PS::IPP::Metadata::List qw( parse_md_list );
+use PS::IPP::Config 1.01 qw( :standard );
+use Getopt::Long qw( GetOptions :config auto_help auto_version gnu_getopt );
+use Pod::Usage qw( pod2usage );
+use File::Temp qw( tempfile );
+
+my $db;
+
+my ($stage, $stage_id, $outroot, $camera, $dbname, $logfile, $verbose, $save_temps);
+my $missing_tools;
+my ($help,$masks);
+my ($tempFile,$tempName,$maskFile,$maskName);
+my $ppSkycell = can_run('ppSkycell') or (warn "Can't find ppSkycell" and $missing_tools = 1);
+my $warptool  = can_run('warptool') or (warn "Can't find warptool" and $missing_tools = 1);
+my $stacktool = can_run('stacktool') or (warn "Can't find stacktool" and $missing_tools = 1);
+my $difftool  = can_run('difftool') or (warn "Can't find difftool" and $missing_tools = 1);
+GetOptions(
+    'help|h'          => \$help,
+    'stage=s'         => \$stage,
+    'stage_id=s'      => \$stage_id,
+    'outroot=s'       => \$outroot,
+    'dbname=s'        => \$dbname,
+    'camera=s'        => \$camera,
+    'logfile=s'       => \$logfile,
+    'verbose'         => \$verbose,
+    'save_temps'      => \$save_temps,
+    'masks'           => \$masks,
+    'no-op'           => \$no_op,
+    'no-update'       => \$no_update,
+    ) or pod2usage ( 2 );
+
+pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2) if @ARGV;
+pod2usage(
+    -msg => "Required options: --stage --stage_id --outroot",
+    -exitval => 3,
+    ) unless
+    defined $stage and defined $stage_id and defined $outroot;
+
+my $ipprc = PS::IPP::Config->new( $camera ) or my_die("Unable to set up", $stage_id, $PS_EXIT_CONFIG_ERROR); # this is used for PATH, NEB filename conversions
+
+my %stages = ('warp' => 1, 'stack' => 1, 'diff' => 1);
+
+unless (exists($stages{$stage})) {
+    my_die("Unknown stage '$stage'",$stage_id,$PS_EXIT_UNKNOWN_ERROR);
+}
+
+my $mdcParser = PS::IPP::Metadata::Config->new; # Parser for metadata config files
+
+if ($stage eq 'warp') {
+    my $imfiles;
+    my $command = "$warptool -warped -warp_id $stage_id";
+    if (defined($dbname)) {
+	$command .= " -dbname $dbname";
+    }
+
+    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = run(command => $command, verbose => $verbose);
+    unless ($success) {
+	$error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
+	&my_die("unable to perform warptool: $error_code", $stage_id, $error_code);
+    }
+
+    if (@$stdout_buf == 0) {
+	# no results found;
+    }
+    
+    $imfiles = $mdcParser->parse_list(join "", @$stdout_buf) or
+	&my_die("unable to parse metadata config doc", $stage_id, $error_code);
+
+    my %tangents = ();
+    
+    foreach my $imfile (@$imfiles) {
+	my $skycell_id = $imfile->{skycell_id};
+	my $path_base  = $imfile->{path_base};
+	my $quality    = $imfile->{quality};
+	my $state      = $imfile->{data_state};
+	my $tangent_base = $skycell_id;
+	if ($quality == 8007 or $state ne 'full') {
+	    next;
+	}
+
+	$tangent_base =~ s/^(.*)\..*$/$1/;
+	
+	unless (exists($tangents{$tangent_base})) {
+	    # Make a temp file and fill, but be sure to save 
+	    ($tempFile, $tempName) = tempfile("/tmp/skycell.$tangent_base.XXXX",
+						 UNLINK => !$save_temps);
+	    $tangents{$tangent_base}{FILE} = $tempFile;
+	    $tangents{$tangent_base}{NAME} = $tempName;
+	    if ($masks) {
+		my ($maskFile, $maskName) = tempfile("/tmp/skycell.$tangent_base.masks.XXXX",
+						     UNLINK => !$save_temps);
+		$tangents{$tangent_base}{MFILE} = $maskFile;
+		$tangents{$tangent_base}{MNAME} = $maskName;
+	    }		
+	}
+	print "$skycell_id $tangent_base\n";	
+	my $file = $ipprc->filename("PSWARP.OUTPUT", $path_base, $skycell_id);
+	print "$file $state $quality\n";
+	my $f_fh = $tangents{$tangent_base}{FILE};
+	print $f_fh "$file\n";
+	if ($masks) {
+	    my $mask = $ipprc->filename("PSWARP.OUTPUT.MASK", $path_base, $skycell_id);
+	    print "$mask\n";
+	    my $m_fh = $tangents{$tangent_base}{MFILE};
+	    print $m_fh "$mask\n";
+	}
+    }
+    foreach my $tangent_base (keys %tangents) {
+	$command = "$ppSkycell -images $tangents{$tangent_base}{NAME}";
+	if ($masks) {
+	    $command .= " -masks $tangents{$tangent_base}{MNAME} ";
+	}
+	$command .= " ${outroot}.${tangent_base} ";
+	print "$command\n";
+	( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = run(command => $command, verbose => $verbose);
+	unless ($success) {
+	    $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
+	    &my_die("unable to perform ppSkycell: $error_code", $stage_id, $error_code);
+	}
+	# Update database:
+	$command = "$warptool -addsummary -warp_id $stage_id -tangent_base $tangent_base -outroot $outroot";
+	if (defined($dbname)) {
+	    $command .= " -dbname $dbname";
+	}
+	
+	( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = run(command => $command, verbose => $verbose);
+	unless ($success) {
+	    $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
+	    &my_die("unable to update warp summary: $error_code", $stage_id, $error_code);
+	}
+    }
+} #end warp stage
+if ($stage eq 'diff') {
+    my $imfiles;
+    my $command = "$difftool -diffskyfile -diff_id $stage_id";
+    if (defined($dbname)) {
+	$command .= " -dbname $dbname";
+    }
+
+    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = run(command => $command, verbose => $verbose);
+    unless ($success) {
+	$error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
+	&my_die("unable to perform difftool: $error_code", $stage_id, $error_code);
+    }
+
+    if (@$stdout_buf == 0) {
+	# no results found;
+    }
+    
+    $imfiles = $mdcParser->parse_list(join "", @$stdout_buf) or
+	&my_die("unable to parse metadata config doc", $stage_id, $error_code);
+
+    my %tangents = ();
+    
+    foreach my $imfile (@$imfiles) {
+	my $skycell_id = $imfile->{skycell_id};
+	my $path_base  = $imfile->{path_base};
+	my $quality    = $imfile->{quality};
+	my $state      = $imfile->{data_state};
+	my $tangent_base = $skycell_id;
+	if ($quality == 8007 or $state ne 'full') {
+	    next;
+	}
+
+	$tangent_base =~ s/^(.*)\..*$/$1/;
+	
+	unless (exists($tangents{$tangent_base})) {
+	    # Make a temp file and fill, but be sure to save 
+	    ($tempFile, $tempName) = tempfile("/tmp/skycell.$tangent_base.XXXX",
+						 UNLINK => !$save_temps);
+	    $tangents{$tangent_base}{FILE} = $tempFile;
+	    $tangents{$tangent_base}{NAME} = $tempName;
+	    if ($masks) {
+		my ($maskFile, $maskName) = tempfile("/tmp/skycell.$tangent_base.masks.XXXX",
+						     UNLINK => !$save_temps);
+		$tangents{$tangent_base}{MFILE} = $maskFile;
+		$tangents{$tangent_base}{MNAME} = $maskName;
+	    }		
+	}
+	print "$skycell_id $tangent_base\n";	
+	my $file = $ipprc->filename("PPSUB.OUTPUT", $path_base, $skycell_id);
+	print "$file $state $quality\n";
+	my $f_fh = $tangents{$tangent_base}{FILE};
+	print $f_fh "$file\n";
+	if ($masks) {
+	    my $mask = $ipprc->filename("PPSUB.OUTPUT.MASK", $path_base, $skycell_id);
+	    print "$mask\n";
+	    my $m_fh = $tangents{$tangent_base}{MFILE};
+	    print $m_fh "$mask\n";
+	}
+    }
+    foreach my $tangent_base (keys %tangents) {
+	$command = "$ppSkycell -images $tangents{$tangent_base}{NAME}";
+	if ($masks) {
+	    $command .= " -masks $tangents{$tangent_base}{MNAME} ";
+	}
+	$command .= " ${outroot}.${tangent_base} ";
+	print "$command\n";
+	( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = run(command => $command, verbose => $verbose);
+	unless ($success) {
+	    $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
+	    &my_die("unable to perform ppSkycell: $error_code", $stage_id, $error_code);
+	}
+	# Update database:
+	$command = "$difftool -addsummary -diff_id $stage_id -tangent_base $tangent_base -outroot $outroot";
+	if (defined($dbname)) {
+	    $command .= " -dbname $dbname";
+	}
+	
+	( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = run(command => $command, verbose => $verbose);
+	unless ($success) {
+	    $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
+	    &my_die("unable to update diff summary: $error_code", $stage_id, $error_code);
+	}
+    }
+} #end diff stage
+if ($stage eq 'stack') {
+    my $imfiles;
+    my $command = "$stacktool -stackskyfile -stack_id $stage_id";
+    if (defined($dbname)) {
+	$command .= " -dbname $dbname";
+    }
+
+    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = run(command => $command, verbose => $verbose);
+    unless ($success) {
+	$error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
+	&my_die("unable to perform stacktool: $error_code", $stage_id, $error_code);
+    }
+
+    if (@$stdout_buf == 0) {
+	# no results found;
+    }
+    
+    $imfiles = $mdcParser->parse_list(join "", @$stdout_buf) or
+	&my_die("unable to parse metadata config doc", $stage_id, $error_code);
+
+    my %tangents = ();
+    
+    foreach my $imfile (@$imfiles) {
+	my $skycell_id = $imfile->{skycell_id};
+	my $path_base  = $imfile->{path_base};
+	my $quality    = $imfile->{quality};
+	my $state      = $imfile->{data_state};
+	my $tangent_base = $skycell_id;
+	if ($quality == 8007 or $state ne 'full') {
+	    next;
+	}
+
+	$tangent_base =~ s/^(.*)\..*$/$1/;
+	
+	unless (exists($tangents{$tangent_base})) {
+	    # Make a temp file and fill, but be sure to save 
+	    ($tempFile, $tempName) = tempfile("/tmp/skycell.$tangent_base.XXXX",
+						 UNLINK => !$save_temps);
+	    $tangents{$tangent_base}{FILE} = $tempFile;
+	    $tangents{$tangent_base}{NAME} = $tempName;
+	    if ($masks) {
+		my ($maskFile, $maskName) = tempfile("/tmp/skycell.$tangent_base.masks.XXXX",
+						     UNLINK => !$save_temps);
+		$tangents{$tangent_base}{MFILE} = $maskFile;
+		$tangents{$tangent_base}{MNAME} = $maskName;
+	    }		
+	}
+	print "$skycell_id $tangent_base\n";	
+	my $file = $ipprc->filename("PPSTACK.OUTPUT", $path_base, $skycell_id);
+	print "$file $state $quality\n";
+	my $f_fh = $tangents{$tangent_base}{FILE};
+	print $f_fh "$file\n";
+	if ($masks) {
+	    my $mask = $ipprc->filename("PPSTACK.OUTPUT.MASK", $path_base, $skycell_id);
+	    print "$mask\n";
+	    my $m_fh = $tangents{$tangent_base}{MFILE};
+	    print $m_fh "$mask\n";
+	}
+    }
+    foreach my $tangent_base (keys %tangents) {
+	$command = "$ppSkycell -images $tangents{$tangent_base}{NAME}";
+	if ($masks) {
+	    $command .= " -masks $tangents{$tangent_base}{MNAME} ";
+	}
+	$command .= " ${outroot}.${tangent_base} ";
+	print "$command\n";
+	( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = run(command => $command, verbose => $verbose);
+	unless ($success) {
+	    $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
+	    &my_die("unable to perform ppSkycell: $error_code", $stage_id, $error_code);
+	}
+	# Update database:
+	$command = "$stacktool -addsummary -stack_id $stage_id -tangent_base $tangent_base -outroot $outroot";
+	if (defined($dbname)) {
+	    $command .= " -dbname $dbname";
+	}
+	
+	( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = run(command => $command, verbose => $verbose);
+	unless ($success) {
+	    $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
+	    &my_die("unable to update stack summary: $error_code", $stage_id, $error_code);
+	}
+    }
+} #end stack stage
+
+
+sub my_die
+{
+    my $msg = shift; # Warning message on die
+    my $stage = shift; # stage name
+    my $stage_id = shift; #  identifier
+    my $exit_code = shift; # Exit code
+    # outputImage and path_base are globals
+
+    carp($msg);
+    exit $exit_code;
+}
Index: /branches/czw_branch/20100519/ippTasks/diff.pro
===================================================================
--- /branches/czw_branch/20100519/ippTasks/diff.pro	(revision 28044)
+++ /branches/czw_branch/20100519/ippTasks/diff.pro	(revision 28045)
@@ -44,4 +44,10 @@
     active false
   end
+  task diff.summary.load
+    active true
+  end
+  task diff.summary.run
+    active true
+  end
 end
 
@@ -58,4 +64,10 @@
   end
   task diff.revert
+    active false
+  end
+  task diff.summary.load
+    active false
+  end
+  task diff.summary.run
     active false
   end
@@ -193,5 +205,4 @@
     # host anyhost
     # $WORKDIR = $WORKDIR_TEMPLATE
-
     if (($DIFF_MODE == 1)||("$DIFF_MODE" == "NULL")) 
 	$DIFF_TAG = ""
@@ -477,2 +488,151 @@
   end
 end
+
+### Load tasks for doing the diffs
+### Tasks are loaded into diffPendingSkyCell.
+task	       diff.summary.load
+  host         local
+
+  periods      -poll $LOADPOLL
+  periods      -exec $LOADEXEC
+  periods      -timeout 1200
+  npending     1
+
+  stdout NULL
+  stderr $LOGDIR/diff.summary.log
+
+  task.exec
+    if ($LABEL:n == 0) break
+    $run = difftool -tosummary
+    if ($DB:n == 0)
+      option DEFAULT
+    else
+      # save the DB name for the exit tasks
+      option $DB:$diffSummary_DB
+      $run = $run -dbname $DB:$diffSummary_DB
+      $diffSummary_DB ++
+      if ($diffSummary_DB >= $DB:n) set diffSummary_DB = 0
+    end
+    add_poll_args run
+    add_poll_labels run
+    command $run
+  end
+
+  # success
+  task.exit    0
+    # convert 'stdout' to book format
+    # XXX change tess_id to tess_dir when db is updated
+    ipptool2book stdout diffPendingSummary -key diff_id -uniq -setword dbname $options:0 -setword pantaskState INIT
+    if ($VERBOSE > 2)
+      book listbook diffPendingSummary
+    end
+
+    # delete existing entries in the appropriate pantaskStates
+    process_cleanup diffPendingSummary
+  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 calculating the diff overlaps
+### Tasks are taken from diffPendingSkyCell.
+task	       diff.summary.run
+  periods      -poll $RUNPOLL
+  periods      -exec $RUNEXEC
+  periods      -timeout 60
+
+  task.exec
+    # if we are unable to run the 'exec', use a long retry time
+    periods -exec $RUNEXEC
+
+    book npages diffPendingSummary -var N
+    if ($N == 0) break
+    if ($NETWORK == 0) break
+    
+    # look for new images in diffPendingSkyCell (pantaskState == INIT)
+    book getpage diffPendingSummary 0 -var pageName -key pantaskState INIT
+    if ("$pageName" == "NULL") break
+
+    book setword diffPendingSummary $pageName pantaskState RUN
+    book getword diffPendingSummary $pageName diff_id -var DIFF_ID
+    book getword diffPendingSummary $pageName camera -var CAMERA
+    book getword diffPendingSummary $pageName workdir -var WORKDIR_TEMPLATE
+    book getword diffPendingSummary $pageName dbname -var DBNAME
+    book getword warpPendingSummary $pageName tess_id -var TESS_DIR
+    book getword diffPendingSummary $pageName diff_mode -var DIFF_MODE
+    book getword diffPendingSummary $pageName exp_tag -var EXP_TAG
+    book getword diffPendingSummary $pageName state -var RUN_STATE
+
+    # set the host and workdir based on the skycell hash
+    host anyhost
+    strsub $WORKDIR_TEMPLATE @HOST@.0 $default_host -var WORKDIR
+#    set.workdir.by.skycell $SKYCELL_ID $WORKDIR_TEMPLATE $default_host WORKDIR
+
+#    if ("$PATH_BASE" == "NULL") 
+
+    if (($DIFF_MODE == 1)||("$DIFF_MODE" == "NULL")) 
+	$DIFF_TAG = ""
+    end
+    if ($DIFF_MODE == 2)
+	$DIFF_TAG = "WS."
+    end 
+    if ($DIFF_MODE == 3)
+	$DIFF_TAG = "SW."
+    end
+    if ($DIFF_MODE == 4)
+	$DIFF_TAG = "SS."
+    end
+
+    basename $TESS_DIR -var TESS_ID
+
+    sprintf outroot "%s/%s/%s/%s.%s.%sdif.%s.%s" $WORKDIR $TESS_ID $SKYCELL_ID $TESS_ID $SKYCELL_ID $DIFF_TAG $DIFF_ID
+        ## generate outroot specific to this exposure
+
+
+    stdout $LOGDIR/diff.summary.log
+    stderr $LOGDIR/diff.summary.log
+
+    $run = skycell_jpeg.pl --stage diff --stage_id $DIFF_ID --camera $CAMERA --outroot $outroot
+    add_standard_args run
+
+    # save the pageName for future reference below
+    options $pageName
+
+    # create the command line
+    if ($VERBOSE > 1)
+      echo command $run
+    end
+    periods -exec 0.05
+    command $run
+  end
+
+  # default exit status
+  task.exit    default
+    process_exit diffPendingSummary $options:0 $JOB_STATUS
+  end
+
+  # locked list
+  task.exit    crash
+    showcommand crash
+    echo "hostname: $JOB_HOSTNAME"
+    book setword diffPendingSummary $options:0 pantaskState CRASH
+  end
+
+  # operation timed out?
+  task.exit    timeout
+    showcommand timeout
+    book setword diffPendingSummary $options:0 pantaskState TIMEOUT
+  end
+end
Index: /branches/czw_branch/20100519/ippTasks/warp.pro
===================================================================
--- /branches/czw_branch/20100519/ippTasks/warp.pro	(revision 28044)
+++ /branches/czw_branch/20100519/ippTasks/warp.pro	(revision 28045)
@@ -55,4 +55,10 @@
     active true
   end
+  task warp.summary.load
+    active true
+  end
+  task warp.summary.run
+    active true
+  end
 end
 
@@ -78,4 +84,10 @@
   end
   task warp.revert.warped
+    active false
+  end
+  task warp.summary.load
+    active false
+  end
+  task warp.summary.run
     active false
   end
@@ -525,2 +537,136 @@
   end
 end
+
+### Load tasks for doing the warps
+### Tasks are loaded into warpPendingSkyCell.
+task	       warp.summary.load
+  host         local
+
+  periods      -poll $LOADPOLL
+  periods      -exec $LOADEXEC
+  periods      -timeout 1200
+  npending     1
+
+  stdout NULL
+  stderr $LOGDIR/warp.summary.log
+
+  task.exec
+    if ($LABEL:n == 0) break
+    $run = warptool -tosummary
+    if ($DB:n == 0)
+      option DEFAULT
+    else
+      # save the DB name for the exit tasks
+      option $DB:$warpSummary_DB
+      $run = $run -dbname $DB:$warpSummary_DB
+      $warpSummary_DB ++
+      if ($warpSummary_DB >= $DB:n) set warpSummary_DB = 0
+    end
+    add_poll_args run
+    add_poll_labels run
+    command $run
+  end
+
+  # success
+  task.exit    0
+    # convert 'stdout' to book format
+    # XXX change tess_id to tess_dir when db is updated
+    ipptool2book stdout warpPendingSummary -key warp_id -uniq -setword dbname $options:0 -setword pantaskState INIT
+    if ($VERBOSE > 2)
+      book listbook warpPendingSummary
+    end
+
+    # delete existing entries in the appropriate pantaskStates
+    process_cleanup warpPendingSummary
+  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 calculating the warp overlaps
+### Tasks are taken from warpPendingSkyCell.
+task	       warp.summary.run
+  periods      -poll $RUNPOLL
+  periods      -exec $RUNEXEC
+  periods      -timeout 60
+
+  task.exec
+    # if we are unable to run the 'exec', use a long retry time
+    periods -exec $RUNEXEC
+
+    book npages warpPendingSummary -var N
+    if ($N == 0) break
+    if ($NETWORK == 0) break
+    
+    # look for new images in warpPendingSkyCell (pantaskState == INIT)
+    book getpage warpPendingSummary 0 -var pageName -key pantaskState INIT
+    if ("$pageName" == "NULL") break
+
+    book setword warpPendingSummary $pageName pantaskState RUN
+    book getword warpPendingSummary $pageName warp_id -var WARP_ID
+    book getword warpPendingSummary $pageName camera -var CAMERA
+    book getword warpPendingSummary $pageName workdir -var WORKDIR_TEMPLATE
+    book getword warpPendingSummary $pageName dbname -var DBNAME
+    book getword warpPendingSummary $pageName tess_id -var TESS_DIR
+    book getword warpPendingSummary $pageName exp_tag -var EXP_TAG
+    book getword warpPendingSummary $pageName state -var RUN_STATE
+
+    # set the host and workdir based on the skycell hash
+    host anyhost
+    strsub $WORKDIR_TEMPLATE @HOST@.0 $default_host -var WORKDIR
+#    set.workdir.by.skycell $SKYCELL_ID $WORKDIR_TEMPLATE $default_host WORKDIR
+
+#    if ("$PATH_BASE" == "NULL") 
+        ## generate outroot specific to this exposure
+    basename $TESS_DIR -var TESS_ID
+
+    sprintf outroot "%s/%s/%s.wrp.%s.%s" $WORKDIR $EXP_TAG $EXP_TAG $WARP_ID $TESS_ID
+
+
+    stdout $LOGDIR/warp.summary.log
+    stderr $LOGDIR/warp.summary.log
+
+    $run = skycell_jpeg.pl --stage warp --stage_id $WARP_ID --camera $CAMERA --outroot $outroot
+    add_standard_args run
+
+    # save the pageName for future reference below
+    options $pageName
+
+    # create the command line
+    if ($VERBOSE > 1)
+      echo command $run
+    end
+    periods -exec 0.05
+    command $run
+  end
+
+  # default exit status
+  task.exit    default
+    process_exit warpPendingSummary $options:0 $JOB_STATUS
+  end
+
+  # locked list
+  task.exit    crash
+    showcommand crash
+    echo "hostname: $JOB_HOSTNAME"
+    book setword warpPendingSummary $options:0 pantaskState CRASH
+  end
+
+  # operation timed out?
+  task.exit    timeout
+    showcommand timeout
+    book setword warpPendingSummary $options:0 pantaskState TIMEOUT
+  end
+end
Index: /branches/czw_branch/20100519/ppSkycell/src/ppSkycellLoop.c
===================================================================
--- /branches/czw_branch/20100519/ppSkycell/src/ppSkycellLoop.c	(revision 28044)
+++ /branches/czw_branch/20100519/ppSkycell/src/ppSkycellLoop.c	(revision 28045)
@@ -301,8 +301,8 @@
         pmFPAfile *file1 = pmFPAfileSelectSingle(data->config->files, "PPSKYCELL.JPEG1", 0);
         file1->save = true;
-        file1->index = i;
+        file1->fileIndex = i;
         pmFPAfile *file2 = pmFPAfileSelectSingle(data->config->files, "PPSKYCELL.JPEG2", 0);
         file2->save = true;
-        file2->index = i;
+        file2->fileIndex = i;
 #if 0
         {
Index: /branches/czw_branch/20100519/psconfig/tagsets/ipp-2.9.dist
===================================================================
--- /branches/czw_branch/20100519/psconfig/tagsets/ipp-2.9.dist	(revision 28044)
+++ /branches/czw_branch/20100519/psconfig/tagsets/ipp-2.9.dist	(revision 28045)
@@ -73,4 +73,5 @@
   YYYYY  ppTranslate            ipp-2-9          -0
   YYYYY  ppViz                  ipp-2-9          -0
+  YYYYY  ppSkycell              ipp-2-9          -0
 
   YYYYY  extsrc/gpcsw           ipp-2-9          -0
