src/parallel: Fixed --filter-hosts. Bug due to --joblog - not working.

This commit is contained in:
Ole Tange 2013-06-26 16:07:14 +02:00
parent 21a77662ab
commit 14b15f3d43
2 changed files with 20 additions and 15 deletions

View file

@ -39,9 +39,7 @@ if(not $ENV{SHELL}) {
::warning("\$SHELL not set. Using /bin/sh.\n");
$ENV{SHELL} = "/bin/sh";
}
%Global::original_sig = %SIG;
$SIG{TERM} = sub {}; # Dummy until jobs really start
open $Global::original_stderr, ">&STDERR" or ::die_bug("Can't dup STDERR: $!");
save_sig_stdin_stdout_stderr();
parse_options();
my $number_of_args;
@ -641,7 +639,7 @@ sub get_options_from_array {
sub parse_options {
# Returns: N/A
# Defaults:
$Global::version = 20130622;
$Global::version = 20130626;
$Global::progname = 'parallel';
$Global::infinity = 2**31;
$Global::debug = 0;
@ -967,16 +965,18 @@ sub open_joblog {
::wait_and_exit(255);
}
} else {
# Overwrite the joblog
if(not open($Global::joblog, ">", $opt::joblog)) {
if($opt::joblog eq "-") {
# Use STDOUT as joblog
$Global::joblog = $Global::original_stdout
} elsif(not open($Global::joblog, ">", $opt::joblog)) {
# Overwrite the joblog
::error("Cannot write to --joblog $opt::joblog.\n");
::wait_and_exit(255);
} else {
print $Global::joblog
join("\t", "Seq", "Host", "Starttime", "Runtime",
"Send", "Receive", "Exitval", "Signal", "Command"
). "\n";
}
print $Global::joblog
join("\t", "Seq", "Host", "Starttime", "Runtime",
"Send", "Receive", "Exitval", "Signal", "Command"
). "\n";
}
}
}
@ -1268,15 +1268,20 @@ sub __RUNNING_THE_JOBS_AND_PRINTING_PROGRESS__ {}
# $Global::total_running = total number of running jobs
# $Global::total_started = total jobs started
sub init_run_jobs {
# Remember the original STDOUT and STDERR
sub save_sig_stdin_stdout_stderr {
# Remember the original signal handler, STDIN, STDOUT and STDERR
# Returns: N/A
%Global::original_sig = %SIG;
$SIG{TERM} = sub {}; # Dummy until jobs really start
open $Global::original_stdout, ">&", "STDOUT" or
::die_bug("Can't dup STDOUT: $!");
open $Global::original_stderr, ">&", "STDERR" or
::die_bug("Can't dup STDERR: $!");
open $Global::original_stdin, "<&", "STDIN" or
::die_bug("Can't dup STDIN: $!");
}
sub init_run_jobs {
$Global::total_running = 0;
$Global::total_started = 0;
$Global::tty_taken = 0;
@ -2789,7 +2794,7 @@ sub simultaneous_sshlogin_limit {
# Choose the minimal
my $ssh_limit =
::min($self->simultaneous_sshlogin($wanted_processes),
$self->simultaneous_sshlogin($wanted_processes));
$self->simultaneous_sshlogin($wanted_processes));
if($ssh_limit < $wanted_processes) {
my $serverlogin = $self->serverlogin();
::warning("ssh to $serverlogin only allows ",

View file

@ -1377,7 +1377,7 @@ seconds it will get killed with SIGTERM, followed by SIGTERM 200 ms
later, followed by SIGKILL 200 ms later.
If I<val> is followed by a % then the timeout will dynamically be
computed as a percentage of the smoothed average runtime. Only values
computed as a percentage of the median average runtime. Only values
> 100% will make sense.