package Deliver;
use strict;
use English;
use Carp;
use vars
qw(@ISA $VERSION $name $author $date $version @instList $numberOfStreams);
@ISA = qw(Module);
use ModuleResources;
# Declare identity, version, author, date, etc.
$name = __PACKAGE__;
$VERSION = '1.11';
$version = $VERSION;
$author="Dean Hinshaw,Duncan John Fyfe,Ed Chapin";
$date="2013-06-11";
#
# ChangeLog
# =========
#
# Version 1.11 - 2013-06-11 (EC)
# ------------
#
# + Merge changes from SOC version.
# + This version includes for the first time the changes made to this module in
# slew pipeline.
#
# Version 1.10 - 2006-08-15 (DJF)
# ------------
#
# + Change to find release note via value provided by configuration file.
# + Changed to look for screening report in intermediate directory.
#
# Version 1.09 - 2005-12-15 (DJF)
# ------------
#
# + Change evaluteRules to take account of new ReceiveDPSS module
# + Remove call to duplicateCheck. This is no longer possible
# within a sequence as it doesn't have access to a pipeline level database
#
# Version 1.08 - 2004-04-15 (DJF)
# ------------
#
# + evaluate conditions were calling start() rather than returning start().
#
# Version 1.07 - 2004-03-24 (DJF)
# ------------
#
# + Removed delivery and sending of delivery email from this module.
# An external delivery program can monitor the Delivery flag for completeness
# and use that as a flag for delivery.
# The pertinent files are:
# The product set product/PIPE_SSCXSS_D__??????????___00000.XMM
# The TDF file PIPE_SSCXSS_D__??????????___00000.TDF
# The delivery email = intermediate/Deliver-all-1-PPS_delivery_email_message-X0000000000.ascii
#
# Version 1.06 - 2004-03-23 (DJF)
# ------------
#
# + deliverProductSet does not return a value. Removed test for a value.
#
# Version 1.05 - 2004-03-04 (DJF)
# ------------
#
# + hanged sendXFTS to deliverProductSet which will put files in delivery spool.
# + Added conditional deliver() function to make delivery
# a pipeline configuration parameter
# Version 1.04 - 2003-09-01 (DJF)
# ------------
#
# + Made delivery note recipients not hardwired into module.
# Now retrieved with call to ModuleResources::deliveryNoteRecipients
#
# Version 1.03 - 2002-02-18 (DH)
# ------------
#
# + Add duplicateCheck() call, to see if this obs is running elsewhere
# in either of the production pipelines.
#
# Version 1.02 - 2001-12-18 (DH)
# ------------
#
# + Change email list for sending delivery note to send to xmmdoc
# and cgabriel.
# + Minor re-format of the delivery note.
#
# Version 1.01 - 2001-10-09 (DH)
# ------------
#
# + First production version.
#
# Declare list of instruments this module is interested in
@instList=qw(all);
# Number of streams
$numberOfStreams=1;
# Rules method
sub evaluateRules {
return ignore()
if ( ignored(module => 'ReceiveDPSS', stream => 1)
) ;
return start()
if ( complete(module => 'ReceiveDPSS', stream => 1)
);
}
# Action method
sub performAction {
info("Module version number: $version");
# Check that this observation is not processing elsewhere
#duplicateCheck();
# Build the PPS message file
my $indexFile=findFile(class => 'product',
instrument => 'ob',
content => 'PPS product index');
my $fileInf=fileInfo(class => 'product', name => $indexFile);
my $obs = getObservationProperties();
my $obs_id = $$obs{obs_id};
$obs_id =~ s/\..*//;
my @message;
my $title = "Delivery Note for Observation - $$obs{orbit}/$obs_id ($$obs{object})";
push @message, "\n $title\n";
push @message, " ===============================================================\n\n";
push @message, "XFTS Delivery Date to SOC : ", scalar localtime, "\n\n";
push @message, "1 PCMS Processing\n";
push @message, "-----------------\n\n";
push @message , &findFullReleaseNote();
my $scrnreport = "screening/dpss_log_$$fileInf{'sequence'}.txt";
push @message, "\n2 Data Product Screening Report";
push @message, "\n-------------------------------\n\n";
if ( -f $scrnreport )
{
push @message, join("\n", readASCIIFile( name=>$scrnreport )), "\n";
}
else
{
push @message , "No data product screening report currently available.\n";
}
my $messageFile=newFile(class => 'product'
,content => 'PPS RUN MESSAGE'
,'format' => 'ASCII'
);
writeASCIIFile(name=>$messageFile, text=> \@message);
insertRunMessage(message => $messageFile);
# Construct and send delivery email
my @email;
push @email, "From: pcms\@sciops.esa.int\n";
push @email, "Subject: $title\n";
push @email, @message;
my $emailFile=newFile(class => 'intermediate'
,content => 'PPS delivery email message'
,'format' => 'ASCII'
);
writeASCIIFile(name=>$emailFile, text=>\@email);
sequenceComplete();
return success();
}
1;