[Bio] / FortyEightMeta / finish_job.pl Repository:
ViewVC logotype

Annotation of /FortyEightMeta/finish_job.pl

Parent Directory Parent Directory | Revision Log Revision Log


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

1 : redwards 1.1 #__perl__
2 :     #
3 :     # Finish a metagenome manually. It is not clear why they are stalling, and this is just the code that it supposed to make the done.
4 :     #
5 :    
6 :    
7 :     use GenomeMeta;
8 :     use Mail::Mailer;
9 :     use Job48;
10 :    
11 :     $ENV{DBHOST} = 'bioseed.mcs.anl.gov';
12 :    
13 :     my $job=shift || die "job number";
14 :     my $job_dir=$FIG_Config::mgrast_jobs."/".$job;
15 :     unless (-e "$job_dir/DONE") {die "$job is not DONE\n"}
16 :    
17 :     my $meta = new GenomeMeta("metajob_$job_id", "$job_dir/meta.xml");
18 :    
19 :     &mark_job_done($job, $job_dir, $meta);
20 :    
21 :     sub mark_job_done
22 :     {
23 :     my($job_id, $job_dir, $meta) = @_;
24 :    
25 :     if (open(D, ">$job_dir/DONE"))
26 :     {
27 :     print D time . "\n";
28 :     close(D);
29 :     }
30 :     else
31 :     {
32 :     warn "Error opening $job_dir/DONE: $!\n";
33 :     }
34 :    
35 :     my $job = new Job48($job_id);
36 :    
37 :     # die Dumper($job);
38 :     my $userobj = $job->getUserObject();
39 :    
40 :    
41 :     print "setting meta $meta\n";
42 :     $meta->set_metadata("status.final","complete");
43 :     print "setting meta $meta .. done\n";
44 :    
45 :     #die Dumper($userobj);
46 :    
47 :     if ($userobj)
48 :     {
49 :     my $email = $userobj->eMail();
50 :     my $name = join(" " , $userobj->firstName(), $userobj->lastName());
51 :    
52 :     my $full = $name ? "$name <$email>" : $email;
53 :     print "send email to $full\n";
54 :    
55 :     my $mail = Mail::Mailer->new();
56 :     $mail->open({
57 :     To => $full,
58 :     From => 'Metagenome RAST server <mg-rast@mcs.anl.gov>',
59 :     Subject => "MG-RAST job completed"
60 :     });
61 :    
62 :     my $gname = $job->genome_name;
63 :     my $entry = $FIG_Config::fortyeight_home;
64 :     $entry = "http://metagenomics.nmpdr.org/" if $entry eq '';
65 :     print $mail "The annotation job that you submitted for $gname has completed.\n";
66 :     print $mail "It is available for browsing at $entry as job number $job_id.\n";
67 :     $mail->close();
68 :     }
69 :     else {
70 :     print STDERR "USer object was not defined for job $job_id\n";
71 :     }
72 :     }
73 :    
74 :    

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3