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

Diff of /FortyEight/reset_stage.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1, Tue Oct 23 18:58:31 2007 UTC revision 1.2, Sat Jun 26 21:56:09 2010 UTC
# Line 13  Line 13 
13  my $jobdir = shift;  my $jobdir = shift;
14  my $stage = shift;  my $stage = shift;
15    
16  my $job = new Job48($jobdir);  my $job = Job48->new($jobdir);
17    
18  if ($job->active())  if ($job->active()) {
 {  
19      print "Job is still active, not changing\n";      print "Job is still active, not changing\n";
20      exit;      exit;
21  }  }
22    
23  my $meta = $job->meta;  my $meta    = $job->meta();
24    my $jobddir = $job->dir();
25    my $status  = $meta->get_metadata("status.$stage");
26    
27  my $st = $meta->get_metadata("status.$stage");  if ($status ne 'error') {
 if ($st ne 'error')  
 {  
28      print "Job stage $stage is not in error, not changing\n";      print "Job stage $stage is not in error, not changing\n";
29      exit;      exit(1);
30  }  }
31    
32  $meta->set_metadata("status.$stage", "not_started");  $meta->set_metadata("status.$stage", "not_started");
33  $meta->set_metadata("$stage.running", "no");  $meta->set_metadata("$stage.running", "no");
34    
35  my $jd = $job->dir;  
36  unlink("$jd/ERROR");  my $cfile = "$jobdir/CANCEL";
37  open(T, ">$jd/ACTIVE") or die "cannot touch $jd/ACTIVE: $!";  if (-f $cfile) {
38  close(T);      print "Clearing CANCEL file.\n";
39        unlink($cfile) || die "Could not remove CANCEL file \'$cfile\'";
40    }
41    
42    
43    my $efile = "$jobdir/ERROR";
44    if (-f $efile) {
45        my $etext = `cat $efile`;
46        print "Clearing ERROR file: $etext\n";
47        unlink($efile) || die "Could not remove ERROR file \'$efile\'";
48    }
49    
50    open(TMP, ">$jobdir/ACTIVE") or die "cannot touch $jobdir/ACTIVE: $!";
51    close(TMP);
52    

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3