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

View of /FortyEightMeta/finish_job.pl

Parent Directory Parent Directory | Revision Log Revision Log

Revision 1.2 - (download) (as text) (annotate)
Fri Apr 3 05:38:24 2009 UTC (11 years, 2 months ago) by redwards
Branch: MAIN
CVS Tags: mgrast_dev_08112011, mgrast_dev_08022011, mgrast_dev_05262011, mgrast_dev_04082011, mgrast_version_3_2, mgrast_dev_12152011, mgrast_dev_06072011, mgrast_dev_10262011, mgrast_dev_02212011, mgrast_release_3_0, mgrast_dev_03252011, mgrast_release_3_0_4, mgrast_release_3_0_2, mgrast_release_3_0_3, mgrast_release_3_0_1, mgrast_dev_03312011, mgrast_release_3_1_2, mgrast_release_3_1_1, mgrast_release_3_1_0, mgrast_dev_04132011, mgrast_dev_04012011, myrast_33, mgrast_dev_04052011, mgrast_dev_02222011, HEAD
Changes since 1.1: +5 -3 lines
changing the user object accessors

# 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.

use GenomeMeta;
use Mail::Mailer;
use Job48;

$ENV{DBHOST} = 'bioseed.mcs.anl.gov';

my $job=shift || die "job number";
my $job_dir=$FIG_Config::mgrast_jobs."/".$job;
unless (-e "$job_dir/DONE") {die "$job is not DONE\n"}

#my $meta = new GenomeMeta("metajob_$job_id", "$job_dir/meta.xml");
my $meta = new GenomeMeta(undef, "$job_dir/meta.xml");

&mark_job_done($job, $job_dir, $meta);

sub mark_job_done
    my($job_id, $job_dir, $meta) = @_;

    if (open(D, ">$job_dir/DONE"))
        print D time . "\n";
        warn "Error opening $job_dir/DONE: $!\n";

    my $job = new Job48($job_id);

    # die Dumper($job);
    my $userobj;
    eval {$userobj = $job->getUserObject()};

    print "setting meta $meta\n";
    print "setting meta $meta .. done\n";

    #die Dumper($userobj);

    if ($userobj)
        my $email = $userobj->eMail();
        my $name = join(" " , $userobj->firstName(), $userobj->lastName());

        my $full = $name ? "$name <$email>" : $email;
        print "send email to $full\n";
        my $mail = Mail::Mailer->new();
            To => $full,
            From => 'Metagenome RAST server <mg-rast@mcs.anl.gov>',
            Subject => "MG-RAST job completed"

        my $gname = $job->genome_name;
        my $entry = $FIG_Config::fortyeight_home;
        $entry = "http://metagenomics.nmpdr.org/" if $entry eq '';
        print $mail "The annotation job that you submitted for $gname has completed.\n";
        print $mail "It is available for browsing at $entry as job number $job_id.\n";
    else {
    	print STDERR "USer object was not defined for job $job_id\n";

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3