[Bio] / FortyEight / reset-failed-rp.pl Repository:
ViewVC logotype

View of /FortyEight/reset-failed-rp.pl

Parent Directory Parent Directory | Revision Log Revision Log

Revision 1.1 - (download) (as text) (annotate)
Mon Apr 7 20:07:27 2008 UTC (11 years, 11 months ago) by olson
Branch: MAIN
CVS Tags: rast_rel_2008_06_18, rast_rel_2008_06_16, rast_rel_2008_12_18, rast_rel_2008_07_21, rast_2008_0924, rast_rel_2008_04_23, rast_rel_2008_09_30, mgrast_rel_2008_0924, mgrast_rel_2008_1110_v2, rast_rel_2009_02_05, mgrast_rel_2008_0625, rast_rel_2008_10_09, rast_release_2008_09_29, mgrast_rel_2008_0806, mgrast_rel_2008_0923, mgrast_rel_2008_0919, mgrast_rel_2008_1110, rast_rel_2008_09_29, mgrast_rel_2008_0917, rast_rel_2008_10_29, rast_rel_2008_11_24, rast_rel_2008_08_07
Add reset-failed-rp which will fix a job which RP broke for.

# Reset a job that has failed rapid_propagation.
# Need to ensure that status.rp is "error". We aren't handling anything more general at the moment.
# We zero out any status.rp.* values, set status.rp to not_started, rp.running to no.

use strict;
use FIG;
use FIG_Config;
use File::Basename;
use GenomeMeta;
use Carp 'croak';
use POSIX;

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

my $jobdir = shift;

-d $jobdir or die "$0: job dir $jobdir does not exist\n";

my $genome = &FIG::file_head("$jobdir/GENOME_ID");
chomp $genome;
$genome =~ /^\d+\.\d+/ or die "$0: Cannnot find genome ID for jobdir $jobdir\n";

my $meta = new GenomeMeta($genome, "$jobdir/meta.xml");

if ($meta->get_metadata("status.rp") ne "error")
    die "Job is not in RP error state\n";

if (-f "$jobdir/ACTIVE")
    die "Job is still marked ACTIVE\n";

for my $k ($meta->get_metadata_keys())
    if ($k =~ /^status\.rp\./)
	my $old = $meta->get_metadata($k);
	print "Old vlaue of $k: $old\n";
	$meta->set_metadata($k, 0);

my $rpdir = "$jobdir/rp/$genome";

if (-d $rpdir)
    my $new = "$rpdir." . strftime("%Y-%m-%d-%H-%M-%S", localtime);
    if (rename($rpdir, $new))
	print "Moved old processed data $rpdir to $new\n";
	die "Error renaming $rpdir to $new: $!\n";

$meta->set_metadata("status.rp", "not_started");
$meta->set_metadata("rp.running", "no");

my $efile = "$jobdir/ERROR";

if (-f $efile)
    my $etext = `cat $efile`;
    print "Clearing error file: $etext\n";

print "Job reset. touch $jobdir/ACTIVE to restart\n";

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3