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

Diff of /FortyEight/batch_rast.pl

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

revision 1.10, Wed Jan 27 17:25:32 2010 UTC revision 1.11, Wed Jan 27 17:35:29 2010 UTC
# Line 49  Line 49 
49    
50  my $job_dir = shift;  my $job_dir = shift;
51    
52    if (-f "$job_dir/CANCEL")
53    {
54        die "Job exiting due to earlier CANCEL\n";
55    }
56    
57  my $job = new Job48($job_dir);  my $job = new Job48($job_dir);
58    
59  my $sims_data_dir = $FIG_Config::rast_sims_data;  my $sims_data_dir = $FIG_Config::rast_sims_data;
# Line 349  Line 354 
354      if ($rc != 0)      if ($rc != 0)
355      {      {
356          $meta->add_log_entry($0, ['Failed', $rc, $cmd_str]);          $meta->add_log_entry($0, ['Failed', $rc, $cmd_str]);
357            if (open(FH, ">$job_dir/CANCEL"))
358            {
359                print FH "Cancel job due to error in $0 @cmd\n";
360                close(FH);
361            }
362            #
363            # Attempt to qdel any other parts of this job that are queued or running.
364            #
365            my @jobs;
366            for my $k ($meta->get_metadata_keys())
367            {
368                if ($k  =~ /ph_.*\.sge_job_id/)
369                {
370                    my $job_id = $meta->get_metadata($k);
371                    #
372                    # Don't qdel this job.
373                    #
374                    if ($job_id =~ /^\d+$/ && $job_id != $ENV{JOB_ID})
375                    {
376                        push(@jobs, $job_id);
377                    }
378    
379                }
380            }
381            if (@jobs)
382            {
383                my $rc2 = system("qdel", @jobs);
384                print "qdel @jobs returned $rc2\n";
385                $meta->add_log_entry($0, "Qdel @jobs due to failure returned status $rc2");
386            }
387    
388          confess "Cmd failed with rc=$rc: $cmd_str\n";          confess "Cmd failed with rc=$rc: $cmd_str\n";
389      }      }
390      $meta->add_log_entry($0, ['Done', $cmd_str]);      $meta->add_log_entry($0, ['Done', $cmd_str]);

Legend:
Removed from v.1.10  
changed lines
  Added in v.1.11

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3