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

Annotation of /FortyEightMeta/finish_job.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (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 : redwards 1.2 #my $meta = new GenomeMeta("metajob_$job_id", "$job_dir/meta.xml");
18 :     my $meta = new GenomeMeta(undef, "$job_dir/meta.xml");
19 : redwards 1.1
20 :     &mark_job_done($job, $job_dir, $meta);
21 :    
22 :     sub mark_job_done
23 :     {
24 :     my($job_id, $job_dir, $meta) = @_;
25 :    
26 :     if (open(D, ">$job_dir/DONE"))
27 :     {
28 :     print D time . "\n";
29 :     close(D);
30 :     }
31 :     else
32 :     {
33 :     warn "Error opening $job_dir/DONE: $!\n";
34 :     }
35 :    
36 :     my $job = new Job48($job_id);
37 :    
38 :     # die Dumper($job);
39 : redwards 1.2 my $userobj;
40 :     eval {$userobj = $job->getUserObject()};
41 :    
42 : redwards 1.1
43 :     print "setting meta $meta\n";
44 :     $meta->set_metadata("status.final","complete");
45 :     print "setting meta $meta .. done\n";
46 :    
47 :     #die Dumper($userobj);
48 :    
49 :     if ($userobj)
50 :     {
51 :     my $email = $userobj->eMail();
52 :     my $name = join(" " , $userobj->firstName(), $userobj->lastName());
53 :    
54 :     my $full = $name ? "$name <$email>" : $email;
55 :     print "send email to $full\n";
56 :    
57 :     my $mail = Mail::Mailer->new();
58 :     $mail->open({
59 :     To => $full,
60 :     From => 'Metagenome RAST server <mg-rast@mcs.anl.gov>',
61 :     Subject => "MG-RAST job completed"
62 :     });
63 :    
64 :     my $gname = $job->genome_name;
65 :     my $entry = $FIG_Config::fortyeight_home;
66 :     $entry = "http://metagenomics.nmpdr.org/" if $entry eq '';
67 :     print $mail "The annotation job that you submitted for $gname has completed.\n";
68 :     print $mail "It is available for browsing at $entry as job number $job_id.\n";
69 :     $mail->close();
70 :     }
71 :     else {
72 :     print STDERR "USer object was not defined for job $job_id\n";
73 :     }
74 :     }
75 :    
76 :    

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3