Changeset 42 for trunk/oarutils


Ignore:
Timestamp:
Dec 5, 2011, 4:30:17 PM (12 years ago)
Author:
g7moreau
Message:
  • Small polish
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/oarutils/oar-parexec

    r41 r42  
    108108
    109109my $oar_checkpoint = new Coro::Semaphore 0;
    110 $SIG{USR2} = sub {$oar_checkpoint->up};
     110$SIG{USR2} = sub {
     111   print "warning: receive checkpoint at "
     112      . time
     113      . ", no new job, just finishing running job\n"
     114      if $verbose;
     115   $oar_checkpoint->up();
     116   };
    111117
    112118async {
     
    147153         };
    148154
    149       $log_h->printf("start job %5i at %s\n", $job_num, time) if $logfile;
    150       printf "start job %5i / %5i at %s on node %s\n",
    151          $job_num, $job_pid, time, $job_ressource
    152         if $verbose;
     155      my $msg = sprintf "start job %5i / %5i at %s on node %s\n",
     156         $job_num, $job_pid, time, $job_ressource;
     157      $log_h->print($msg) if $logfile;
     158      print($msg) if $verbose;
    153159
    154160      my ($job_stdout, $job_stderr);
     
    180186      for my $job_pid (keys %scheduled) {
    181187         if (waitpid($job_pid, WNOHANG)) {
    182             $log_h->printf("end   job %5i at %s\n",
    183                $scheduled{$job_pid}->{num}, time)
    184                if $logfile;
    185             printf "end   job %5i / %5i at %s on node %s\n",
     188            my $msg = sprintf "end   job %5i / %5i at %s on node %s\n",
    186189               $scheduled{$job_pid}->{num},
    187                $job_pid, time, $scheduled{$job_pid}->{ressource}
    188                if $verbose;
     190               $job_pid, time, $scheduled{$job_pid}->{ressource};
     191            $log_h->print($msg) if $logfile;
     192            print($msg) if $verbose;
    189193            close $scheduled{$job_pid}->{fh};
    190194            $ressources->put($scheduled{$job_pid}->{ressource});
     
    195199         }
    196200
    197       $finished->send if $oar_checkpoint->count > 0 and keys(%scheduled) == 0;
    198 
    199       $finished->send if $job_todo->count == 0;
     201      $finished->send if $oar_checkpoint->count() > 0 and scalar(keys(%scheduled)) == 0;
     202
     203      $finished->send if $job_todo->count() == 0;
    200204      cede;
    201205      }
Note: See TracChangeset for help on using the changeset viewer.