[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.11, Wed Jan 27 17:35:29 2010 UTC revision 1.12, Wed Jun 8 21:00:28 2011 UTC
# Line 49  Line 49 
49    
50  my $job_dir = shift;  my $job_dir = shift;
51    
52    #
53    # Only write process startup log if we're not doing sims
54    # or we're not in the SGE context. Otherwise we are
55    # flaying the NFS locking system badly.
56    #
57    my $log_subprocesses;
58    if (!$phase{3} || ($ENV{SGE_TASK_ID} eq '' || $ENV{SGE_TASK_ID} < 2))
59    {
60        $log_subprocesses++;
61    }
62    
63  if (-f "$job_dir/CANCEL")  if (-f "$job_dir/CANCEL")
64  {  {
65      die "Job exiting due to earlier CANCEL\n";      die "Job exiting due to earlier CANCEL\n";
# Line 72  Line 83 
83    
84  my $host = `hostname`;  my $host = `hostname`;
85  chomp $host;  chomp $host;
86  $meta->add_log_entry($0, "Running phases @phase on $host");  $meta->add_log_entry($0, "Running phases @phase on $host") if $log_subprocesses;
87    
88  #  #
89  # Emulate execution of SGE parallel environment via the  # Emulate execution of SGE parallel environment via the
# Line 349  Line 360 
360    
361      my $cmd_str = join(" ", @cmd);      my $cmd_str = join(" ", @cmd);
362      print "Start: $cmd_str\n";      print "Start: $cmd_str\n";
363      $meta->add_log_entry($0, ['Start', $cmd_str]);      $meta->add_log_entry($0, ['Start', $cmd_str]) if $log_subprocesses;
364      my $rc = system(@cmd);      my $rc = system(@cmd);
365      if ($rc != 0)      if ($rc != 0)
366      {      {
367          $meta->add_log_entry($0, ['Failed', $rc, $cmd_str]);          $meta->add_log_entry($0, ['Failed', $rc, $cmd_str]);
368          if (open(FH, ">$job_dir/CANCEL"))          print STDERR "Failed: $rc $cmd_str\n";
369            if (open(FH, ">", "$job_dir/CANCEL"))
370          {          {
371              print FH "Cancel job due to error in $0 @cmd\n";              print FH "Cancel job due to error in $0 @cmd\n";
372              close(FH);              close(FH);
373          }          }
374          #          #
375          # Attempt to qdel any other parts of this job that are queued or running.          # Attempt to qdel any other parts of this job that are queued or running.
376            # Only if we are running in the SGE environment.
377          #          #
378            if ($ENV{SGE_ARCH} ne '')
379            {
380          my @jobs;          my @jobs;
381    
382          for my $k ($meta->get_metadata_keys())          for my $k ($meta->get_metadata_keys())
383          {          {
384              if ($k  =~ /ph_.*\.sge_job_id/)                  if ($k  =~ /p_.*\.sge_job_id/)
385              {              {
386                  my $job_id = $meta->get_metadata($k);                  my $job_id = $meta->get_metadata($k);
387                  #                  #
# Line 382  Line 398 
398          {          {
399              my $rc2 = system("qdel", @jobs);              my $rc2 = system("qdel", @jobs);
400              print "qdel @jobs returned $rc2\n";              print "qdel @jobs returned $rc2\n";
401              $meta->add_log_entry($0, "Qdel @jobs due to failure returned status $rc2");                  $meta->add_log_entry($0, "Qdel @jobs due to failure returned status $rc2") if $log_subprocesses;
402                }
403          }          }
404    
405          confess "Cmd failed with rc=$rc: $cmd_str\n";          confess "Cmd failed with rc=$rc: $cmd_str\n";
406      }      }
407      $meta->add_log_entry($0, ['Done', $cmd_str]);      $meta->add_log_entry($0, ['Done', $cmd_str]) if $log_subprocesses;
408      print "Done: $cmd_str\n";      print "Done: $cmd_str\n";
409  }  }

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

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3