[Bio] / FortyEight / send_job_completion_email.pl Repository:
ViewVC logotype

Annotation of /FortyEight/send_job_completion_email.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (view) (download) (as text)

1 : olson 1.1
2 :     use strict;
3 :     use Mail::Mailer;
4 :     use Data::Dumper;
5 :     use Job48;
6 :    
7 :     my $usage = "Usage: send_job_completion_email jobdir\n";
8 :    
9 :     @ARGV == 1 or die $usage;
10 :    
11 :     my($job_dir) = @ARGV;
12 :    
13 :     my $job = new Job48($job_dir);
14 :    
15 :     if (!$job)
16 :     {
17 :     die "Job $job_dir is not a valid job\n";
18 :     }
19 :    
20 :     my $job_id = $job->id;
21 :    
22 :     my $userobj = $job->getUserObject();
23 :    
24 :     if ($userobj)
25 :     {
26 :     my($email, $name);
27 :     if ($FIG_Config::rast_jobs eq '')
28 :     {
29 :     $email = $userobj->eMail();
30 :     $name = join(" " , $userobj->firstName(), $userobj->lastName());
31 :     }
32 :     else
33 :     {
34 :     $email = $userobj->email();
35 :     $name = join(" " , $userobj->firstname(), $userobj->lastname());
36 :     }
37 :    
38 :     my $full = $name ? "$name <$email>" : $email;
39 :     print "send email to $full\n";
40 :    
41 :     my $mail = Mail::Mailer->new();
42 :     $mail->open({
43 : olson 1.2 To => $full,
44 : olson 1.1 From => 'Annotation Server <rast@mcs.anl.gov>',
45 :     Subject => "RAST annotation server job completed"
46 :     });
47 :    
48 :     my $gname = $job->genome_name;
49 :     my $entry = $FIG_Config::fortyeight_home;
50 :     $entry = "http://www.nmpdr.org/anno-server/" if $entry eq '';
51 :     print $mail "The annotation job that you submitted for $gname has completed.\n";
52 :     print $mail "It is available for browsing at $entry as job number $job_id.\n";
53 :     $mail->close();
54 :     }
55 :    
56 :    

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3