package SendDPSS;
use strict;
use English;
use Carp;
use vars
qw(@ISA $VERSION $VERSION $name $author $date $version @instList $numberOfStreams);
@ISA = qw(Module);
use ModuleResources;
#### DEBUG
use Data::Dumper;
#### DEBUG
# Declare identity, version, author, date, etc.
$name=__PACKAGE__;
$VERSION="2.09";
$version=$VERSION;
$author="Dean Hinshaw,Duncan John Fyfe,Ed Chapin";
$date="2013-06-11";
#
# ChangeLog
# =========
#
# Version 2.09 - 2013-06-11 (EC)
# ------------
#
# + Merge changes from SOC version.
#
# Version 2.08 - 2006-03-23 (DJF)
# ------------
#
# + Added call to create supplimentary files required for screening.
# + dpsssrc is now run as part of the screening preparatory scripts.
#
# Version 2.07 - 2002-06-28 (DH)
# ------------
#
# + Changed From: address to sscops
#
# Version 2.06 - 2002-05-21 (DH)
# ------------
#
# + Change maxlikthresh param in dpsssrc from 50 to 0.
#
# Version 2.05 - 2002-04-29 (DH)
# ------------
#
# + Add format specification for find ml source lists do that
# only FITS files are selected. Mostly needed for catalogue
# pipeline.
#
# Version 2.04 - 2001-11-02 (DH)
# ------------
#
# + Add name of pipeline to screening email message.
#
# Version 2.03 - 2001-10-09 (DH)
# ------------
#
# + Per instructions from HB, change maxlikthresh in dpsssrc from
# 10 to 50.
#
# Version 2.02 - 2001-10-09 (DH)
# ------------
#
# + Use more reliable method for obtaining the sequence number, using
# the (new) thisSequence function.
#
# Version 2.01 - 2001-10-09 (DH)
# ------------
#
# + Now uses ModuleResources functions to read and write ASCII files.
#
# Version 2.00 - 2001-10-04 (DH)
# ------------
#
# + Reconfigured to run after Finalize module. Now sends message to
# sscops about sequence being ready for screening.
#
# Version 1.09 - 2001-04-13 (DH)
# ------------
#
# + Fix bug in 1.08, lomaxlikthesh parameter changed to maxlikthresh
# + dpsssrc cannot deal with input files that have a path prepended.
# Make work-around to deal with this.
#
# Version 1.08 - 2001-04-11 (DH)
# ------------
#
# + Adapt to version 0.4.1 of dpsssrc, which has a different
# interface from the hacked version (0.5) used previously.
#
# Version 1.07 - 2001-03-16 (DH)
# ------------
#
# + Print out version number in performAction() for
# tracking purposes.
#
# Version 1.06 - 2001-01-11 (DH)
# ------------
#
# + Check for existence of input event lists.
#
# Version 1.05 - 2000-12-15 (DH)
# ------------
#
# + First production version.
#
# Declare list of instruments this module is interested in@instList=qw(all);
@instList=qw(all);
# Number of streams
sub numberOfStreams {
return 1;
}
# Rules method
sub evaluateRules {
return unless allComplete(module => 'Finalize');
start();
}
# Action method
sub performAction {
info("Module version number: $version");
prepareScreening();
# Make sure the files we used are re-compressed.
compressIntermediates();
compressProducts();
my $messageFile=newFile(class => 'intermediate'
,content => 'DPSS send ready'
,'format' => 'ASCII'
);
my $message;
my $seq = thisSequence;
#### DEBUG
my $debugseq = Dumper($seq);
#### DEBUG
my $pipe = thisPipeline;
push @$message, "From: XMM-Newton Pipeline Operations at ESAC\n";
push @$message, "Subject: seq $seq, pipe $pipe is ready for screening.\n";
push @$message, "The sequence $seq in pipeline $pipe has sucessfully finished its processing and is ready for screening.\n";
#### DEBUG
push @$message, "DEBUG: seq - value of $seq is $debugseq\n";
#### DEBUG
writeASCIIFile(name=>$messageFile, text=>$message);
# sendMail(to => 'eduardo.ojero@esa.int',
# file => $messageFile
# );
# Create a prodset record for this product set.
ModuleResources::Createprodset();
return success();
}
1;