parallel: Fixes #33621: --bg -p should give an error message.

Includes testsuite.
Fixup of error msgs.
This commit is contained in:
Ole Tange 2011-06-23 00:12:16 +02:00
parent fff3204c23
commit ccaa30b4c3
4 changed files with 42 additions and 33 deletions

View file

@ -163,42 +163,37 @@ cc:Peter Simons <simons@cryp.to>, Sandro Cazzaniga <kharec@mandriva.org>,
Christian Faulhammer <fauli@gentoo.org>, Ryoichiro Suzuki <ryoichiro.suzuki@gmail.com>, Christian Faulhammer <fauli@gentoo.org>, Ryoichiro Suzuki <ryoichiro.suzuki@gmail.com>,
Jesse Alama <jesse.alama@gmail.com> Jesse Alama <jesse.alama@gmail.com>
Subject: GNU Parallel 20110622 ('Bean sprout') released Subject: GNU Parallel 20110722 ('XXX') released
GNU Parallel 20116022 ('Bean sprout') has been released. It is GNU Parallel 20110722 ('XXX') has been released. It is
available for download at: http://ftp.gnu.org/gnu/parallel/ available for download at: http://ftp.gnu.org/gnu/parallel/
For sysadmins this is a major release, as --onall makes it easy to run
the same commands on a list of computers.
New in this release: New in this release:
* --onall will run all the jobs on all the computers. This is useful * niceload: --noswap will slow down a program if the computer is
for systemadinistrators having multiple servers. swapping.
* --nonall runs like --onall but reads no arguments from stdin * niceload: --mem will slow down a program if free memory goes below a
(standard input), so is possible to do: certain limit.
parallel --nonall -S computer1,computer2 uptime
* Context replace now works with multiple input sources: * niceload: --hard will suspend a program if a limit is reached - as
parallel -X echo {1}-{2} ::: 1 2 3 ::: a b c opposed to just slowing the program down.
* --noswap do not start a job on a server that is swapping. * niceload: --soft will slowing the program down - as opposed to
suspending the program completely.
* Article: Parallel processing without Hadoop! (
http://www.solutionhacker.com/parallel-processing-without-hadoop/ * niceload: --io will slow down a program if disk io goes above a
certain limit.
* Article in Linux Magazine (Spanish). Thanks to Ben Martin. * niceload: --start-load, --start-noswap, --start-mem, --start-io will
http://www.linux-magazine.es/issue/67/ defer starting a program until the system is below the limit.
* First blog post in Korean. Thanks to 민병국. * niceload got a major rewrite and is now object oriented.
http://blog.daum.net/_blog/BlogTypeView.do?blogid=02RQ3&articleno=13380895&admin=# )
* Blog post in Japanese. Thanks to Naoya Nakazawa. * GNU Parallel was presented at Nordic Perl Workshop 2011.
http://www.sssg.org/blogs/naoya/archives/2003 http://conferences.yapceurope.org/npw2011/talk/3416
* Blog post in English. Thanks to Dagon.
http://hekate.homeip.net/2011/05/29/
* Bug fixes and man page updates. * Bug fixes and man page updates.

View file

@ -622,6 +622,11 @@ sub parse_options {
if(not defined $::opt_P) { if(not defined $::opt_P) {
$::opt_P = 1; $::opt_P = 1;
} }
if($Global::interactive and $::opt_bg) {
print STDERR "$Global::progname: Jobs running in the ".
"background cannot be interactive.\n";
::wait_and_exit(255);
}
} }
if(defined $::opt_eta) { if(defined $::opt_eta) {
$::opt_progress = $::opt_eta; $::opt_progress = $::opt_eta;
@ -634,7 +639,8 @@ sub parse_options {
# As we do not know the max line length on the remote machine # As we do not know the max line length on the remote machine
# long commands generated by xargs may fail # long commands generated by xargs may fail
# If opt_N is set, it is probably safe # If opt_N is set, it is probably safe
print STDERR ("parallel: Warning: using -X or -m with --sshlogin may fail\n"); print STDERR ("$Global::progname: Warning: using -X or -m ",
"with --sshlogin may fail\n");
} }
if(not defined $::opt_P) { if(not defined $::opt_P) {
@ -642,7 +648,8 @@ sub parse_options {
} }
if($::opt_joblog) { if($::opt_joblog) {
if(not open($Global::joblog,">$::opt_joblog")) { if(not open($Global::joblog,">$::opt_joblog")) {
print STDERR "Cannot write to --joblog $::opt_joblog\n"; print STDERR ("$Global::progname: Cannot write to ",
"--joblog $::opt_joblog\n");
::wait_and_exit(255); ::wait_and_exit(255);
} else { } else {
print $Global::joblog print $Global::joblog
@ -698,7 +705,7 @@ sub read_options {
if(grep /^$profile$/, @config_profiles) { if(grep /^$profile$/, @config_profiles) {
# config file is not required to exist # config file is not required to exist
} else { } else {
print STDERR "$profile not readable\n"; print STDERR "$Global::progname: $profile not readable\n";
wait_and_exit(255); wait_and_exit(255);
} }
} }
@ -3392,8 +3399,8 @@ sub populate {
last; last;
} else { } else {
my $args = join(" ", map { $_->orig() } @$next_arg); my $args = join(" ", map { $_->orig() } @$next_arg);
print STDERR ("Command line too long (", print STDERR ("$Global::progname: Command line too ",
$self->len(), " >= ", "long (", $self->len(), " >= ",
Limits::Command::max_length(), Limits::Command::max_length(),
") at number ", ") at number ",
$self->{'arg_queue'}->arg_number(), $self->{'arg_queue'}->arg_number(),
@ -3895,8 +3902,8 @@ sub max_length {
if($::opt_s <= $Limits::Command::line_max_len) { if($::opt_s <= $Limits::Command::line_max_len) {
$Limits::Command::line_max_len = $::opt_s; $Limits::Command::line_max_len = $::opt_s;
} else { } else {
print STDERR "$Global::progname: ", print STDERR "$Global::progname: value for -s option ",
"value for -s option should be < $Limits::Command::line_max_len\n"; "should be < $Limits::Command::line_max_len\n";
} }
} else { } else {
$Limits::Command::line_max_len = real_max_length(); $Limits::Command::line_max_len = real_max_length();
@ -4079,7 +4086,8 @@ sub new {
my $fhs = shift; my $fhs = shift;
for my $fh (@$fhs) { for my $fh (@$fhs) {
if(-t $fh) { if(-t $fh) {
print STDERR "$Global::progname: Input is tty. Press CTRL-D to exit.\n"; print STDERR "$Global::progname: Input is tty. ".
"Press CTRL-D to exit.\n";
} }
} }
return bless { return bless {
@ -4351,7 +4359,8 @@ sub trim_of {
} elsif($Global::trim eq "rl" or $Global::trim eq "lr") { } elsif($Global::trim eq "rl" or $Global::trim eq "lr") {
for $arg (@strings) { $arg =~ s/^\s+//; $arg =~ s/\s+$//; } for $arg (@strings) { $arg =~ s/^\s+//; $arg =~ s/\s+$//; }
} else { } else {
print STDERR "$Global::progname: --trim must be one of: r l rl lr\n"; print STDERR "$Global::progname: --trim must be one of: r l ".
"rl lr\n";
::wait_and_exit(255); ::wait_and_exit(255);
} }
return wantarray ? @strings : "@strings"; return wantarray ? @strings : "@strings";

View file

@ -38,3 +38,6 @@ parallel -u --bg --semaphore seq 11 20 '|' pv -qL 30
parallel -u --fg --semaphore seq 21 30 '|' pv -qL 30 parallel -u --fg --semaphore seq 21 30 '|' pv -qL 30
parallel -u --bg --semaphore seq 31 40 '|' pv -qL 30 parallel -u --bg --semaphore seq 31 40 '|' pv -qL 30
sem --wait sem --wait
echo '### Test bug #33621: --bg -p should give an error message'
stdout parallel -p --bg echo x{}

View file

@ -112,3 +112,5 @@ done 4
38 38
39 39
40 40
### Test bug #33621: --bg -p should give an error message
parallel: Jobs running in the background cannot be interactive.