From ccaa30b4c382589051715d42995126eead2e06dd Mon Sep 17 00:00:00 2001 From: Ole Tange Date: Thu, 23 Jun 2011 00:12:16 +0200 Subject: [PATCH] parallel: Fixes #33621: --bg -p should give an error message. Includes testsuite. Fixup of error msgs. --- doc/release_new_version | 43 +++++++++++++++------------------ src/parallel | 27 ++++++++++++++------- testsuite/tests-to-run/sem01.sh | 3 +++ testsuite/wanted-results/sem01 | 2 ++ 4 files changed, 42 insertions(+), 33 deletions(-) diff --git a/doc/release_new_version b/doc/release_new_version index 4044d618..588e8bec 100644 --- a/doc/release_new_version +++ b/doc/release_new_version @@ -163,42 +163,37 @@ cc:Peter Simons , Sandro Cazzaniga , Christian Faulhammer , Ryoichiro Suzuki , Jesse Alama -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/ -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: -* --onall will run all the jobs on all the computers. This is useful - for systemadinistrators having multiple servers. +* niceload: --noswap will slow down a program if the computer is + swapping. -* --nonall runs like --onall but reads no arguments from stdin - (standard input), so is possible to do: - parallel --nonall -S computer1,computer2 uptime +* niceload: --mem will slow down a program if free memory goes below a + certain limit. -* Context replace now works with multiple input sources: - parallel -X echo {1}-{2} ::: 1 2 3 ::: a b c +* niceload: --hard will suspend a program if a limit is reached - as + 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. - http://www.linux-magazine.es/issue/67/ +* niceload: --start-load, --start-noswap, --start-mem, --start-io will + defer starting a program until the system is below the limit. -* First blog post in Korean. Thanks to 민병국. - http://blog.daum.net/_blog/BlogTypeView.do?blogid=02RQ3&articleno=13380895&admin=# +* niceload got a major rewrite and is now object oriented. +) -* Blog post in Japanese. Thanks to Naoya Nakazawa. - http://www.sssg.org/blogs/naoya/archives/2003 - -* Blog post in English. Thanks to Dagon. - http://hekate.homeip.net/2011/05/29/ +* GNU Parallel was presented at Nordic Perl Workshop 2011. + http://conferences.yapceurope.org/npw2011/talk/3416 * Bug fixes and man page updates. diff --git a/src/parallel b/src/parallel index dd1bc991..70e20cba 100755 --- a/src/parallel +++ b/src/parallel @@ -622,6 +622,11 @@ sub parse_options { if(not defined $::opt_P) { $::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) { $::opt_progress = $::opt_eta; @@ -634,7 +639,8 @@ sub parse_options { # As we do not know the max line length on the remote machine # long commands generated by xargs may fail # 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) { @@ -642,7 +648,8 @@ sub parse_options { } if($::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); } else { print $Global::joblog @@ -698,7 +705,7 @@ sub read_options { if(grep /^$profile$/, @config_profiles) { # config file is not required to exist } else { - print STDERR "$profile not readable\n"; + print STDERR "$Global::progname: $profile not readable\n"; wait_and_exit(255); } } @@ -3392,8 +3399,8 @@ sub populate { last; } else { my $args = join(" ", map { $_->orig() } @$next_arg); - print STDERR ("Command line too long (", - $self->len(), " >= ", + print STDERR ("$Global::progname: Command line too ", + "long (", $self->len(), " >= ", Limits::Command::max_length(), ") at number ", $self->{'arg_queue'}->arg_number(), @@ -3895,8 +3902,8 @@ sub max_length { if($::opt_s <= $Limits::Command::line_max_len) { $Limits::Command::line_max_len = $::opt_s; } else { - print STDERR "$Global::progname: ", - "value for -s option should be < $Limits::Command::line_max_len\n"; + print STDERR "$Global::progname: value for -s option ", + "should be < $Limits::Command::line_max_len\n"; } } else { $Limits::Command::line_max_len = real_max_length(); @@ -4079,7 +4086,8 @@ sub new { my $fhs = shift; for my $fh (@$fhs) { 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 { @@ -4351,7 +4359,8 @@ sub trim_of { } elsif($Global::trim eq "rl" or $Global::trim eq "lr") { for $arg (@strings) { $arg =~ s/^\s+//; $arg =~ s/\s+$//; } } 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); } return wantarray ? @strings : "@strings"; diff --git a/testsuite/tests-to-run/sem01.sh b/testsuite/tests-to-run/sem01.sh index a9439a55..7c13cc89 100755 --- a/testsuite/tests-to-run/sem01.sh +++ b/testsuite/tests-to-run/sem01.sh @@ -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 --bg --semaphore seq 31 40 '|' pv -qL 30 sem --wait + +echo '### Test bug #33621: --bg -p should give an error message' +stdout parallel -p --bg echo x{} diff --git a/testsuite/wanted-results/sem01 b/testsuite/wanted-results/sem01 index ebb89452..6d0795d4 100644 --- a/testsuite/wanted-results/sem01 +++ b/testsuite/wanted-results/sem01 @@ -112,3 +112,5 @@ done 4 38 39 40 +### Test bug #33621: --bg -p should give an error message +parallel: Jobs running in the background cannot be interactive.