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

Annotation of /FortyEight/reset_stage.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (view) (download) (as text)

1 : olson 1.1 #
2 :     # Reset the given stage of the job, and set the job to active
3 :     # (remove ERROR, touch ACTIVE).
4 :     #
5 :    
6 :     use strict;
7 :     use Job48;
8 :    
9 :     my $usage = "reset_stage jobdir stage";
10 :    
11 :     @ARGV == 2 or die $usage;
12 :    
13 :     my $jobdir = shift;
14 :     my $stage = shift;
15 :    
16 : gdpusch 1.2 my $job = Job48->new($jobdir);
17 : olson 1.1
18 : gdpusch 1.2 if ($job->active()) {
19 : olson 1.1 print "Job is still active, not changing\n";
20 :     exit;
21 :     }
22 :    
23 : gdpusch 1.2 my $meta = $job->meta();
24 :     my $jobddir = $job->dir();
25 :     my $status = $meta->get_metadata("status.$stage");
26 : olson 1.1
27 : gdpusch 1.2 if ($status ne 'error') {
28 : olson 1.1 print "Job stage $stage is not in error, not changing\n";
29 : gdpusch 1.2 exit(1);
30 : olson 1.1 }
31 :    
32 :     $meta->set_metadata("status.$stage", "not_started");
33 :     $meta->set_metadata("$stage.running", "no");
34 :    
35 : gdpusch 1.2
36 :     my $cfile = "$jobdir/CANCEL";
37 :     if (-f $cfile) {
38 :     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 : olson 1.1

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3