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

View of /FortyEight/save_job_signature.pl

Parent Directory Parent Directory | Revision Log Revision Log

Revision 1.1 - (download) (as text) (annotate)
Fri Jan 15 16:15:41 2010 UTC (9 years, 10 months ago) by olson
Branch: MAIN
CVS Tags: mgrast_dev_08112011, mgrast_dev_08022011, rast_rel_2014_0912, mgrast_dev_05262011, mgrast_dev_04082011, rast_rel_2010_0928, mgrast_version_3_2, mgrast_dev_12152011, mgrast_dev_06072011, rast_rel_2010_0526, rast_rel_2014_0729, mgrast_dev_02212011, rast_rel_2010_1206, mgrast_release_3_0, mgrast_dev_03252011, rast_rel_2010_0118, rast_rel_2011_0119, 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, rast_rel_2010_0827, myrast_33, rast_rel_2011_0928, mgrast_dev_04052011, mgrast_dev_02222011, mgrast_dev_10262011, HEAD
Add job caching support.

# Compute the job's signature and save the original
# annotations, subsystems, and features to original_state.tgz.

use strict;
use FIG_Config;
use Job48;

@ARGV == 1 or die "Usage: $0 job-dir\n";

my $dir = shift;

my $id;
if ($dir !~ m,/(\d+)$,)
    die "Job directory does not end with a number\n";

$id = $1;

# Compute the signature, save to JOB_SIGNATURE.
# The first line of the signature file is the signature itself.

my $rc = system("$FIG_Config::bin/compute_job_signature", $dir, "$dir/JOB_SIGNATURE");
$rc == 0 or die "compute_job_signature failed with rc=$rc\n";

my $sig = &FIG::file_head("$dir/JOB_SIGNATURE", 1);
chomp $sig;

my $db = DBMaster->new(-database => $FIG_Config::rast_jobcache_db,
		       -backend => 'MySQL',
		       -host => $FIG_Config::rast_jobcache_host,
		       -user => $FIG_Config::rast_jobcache_user);

# retrieve the job to make sure the directory matches the directory
# we were given.

my $job = $db->Job->init({ id => $id } );
$job or die "job $id does not exist\n";

my $jdir = $job->dir;
if ($jdir ne $dir)
    die "Directory for job $id is $jdir which does not match given directory $dir\n";


# Save a tarfile of the original annotations, subsystem analysis,
# and feaures.

my $org_dir = $job->org_dir;

opendir(D, $org_dir) or die "Cannot opendir $org_dir: $!";
my @fn_files = grep { $_ ne 'proposed_user_functions' && -f "$org_dir/$_" && /functions/ } readdir(D);

system("tar", "-c", "-z", "-f", "$jdir/pristine_annotations.tgz", "-C", $job->org_dir,
       @fn_files, "Features", "Subsystems", "annotations", "evidence.codes");

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3