parallel: Formatting of error messages. Passes testsuite.

This commit is contained in:
Ole Tange 2015-05-15 08:47:44 +02:00
parent ec8f851b6a
commit 847fbe125a
12 changed files with 33 additions and 26 deletions

View file

@ -1,3 +1,5 @@
Rasmus Villemoes: Code snips for signal processing.
Martin d'Anjou: Code snips for signal processing.
rici@stackoverflow.com: Documentation on exporting arrays using --env. rici@stackoverflow.com: Documentation on exporting arrays using --env.
Malcolm Cook: The idea to use a general perl expression as replacement strings. Malcolm Cook: The idea to use a general perl expression as replacement strings.
Ævar Arnfjörð Bjarmason: Reading the whole code. Ævar Arnfjörð Bjarmason: Reading the whole code.

View file

@ -1139,7 +1139,8 @@ sub parse_halt {
# Split: soon,fail=5% # Split: soon,fail=5%
my ($when,$fail_success,$pct_count) = split /[,=]/, $opt::halt; my ($when,$fail_success,$pct_count) = split /[,=]/, $opt::halt;
if(not grep { $when eq $_ } qw(never soon now)) { if(not grep { $when eq $_ } qw(never soon now)) {
::error("--halt must have 'never', 'soon', or 'now'\n"); ::error("--halt must have 'never', 'soon', or 'now'.");
::wait_and_exit(255);
} }
$Global::halt_when = $when; $Global::halt_when = $when;
if($when ne "never") { if($when ne "never") {
@ -1148,15 +1149,17 @@ sub parse_halt {
} elsif($fail_success eq "success") { } elsif($fail_success eq "success") {
$Global::halt_success = 1; $Global::halt_success = 1;
} else { } else {
::error("--halt $when must be followed by ,success or ,fail\n"); ::error("--halt $when must be followed by ,success or ,fail.");
::wait_and_exit(255);
} }
if($pct_count =~ /^(\d+)%$/) { if($pct_count =~ /^(\d+)%$/) {
$Global::halt_pct = $1/100; $Global::halt_pct = $1/100;
} elsif($pct_count =~ /^(\d+)$/) { } elsif($pct_count =~ /^(\d+)$/) {
$Global::halt_count = $1; $Global::halt_count = $1;
} else { } else {
::error("--halt $when,$fail_success ", ::error("--halt $when,$fail_success ".
"must be followed by ,number or ,percent%\n"); "must be followed by ,number or ,percent%.");
::wait_and_exit(255);
} }
} }
} }
@ -4752,8 +4755,8 @@ sub compute_number_of_processes {
::wait_and_exit(255); ::wait_and_exit(255);
} }
if(not $more_filehandles) { if(not $more_filehandles) {
::warning("Only enough file handles to run ", $system_limit, " jobs in parallel.", ::warning("Only enough file handles to run ". $system_limit. " jobs in parallel.",
"Running 'parallel -j0 -N $system_limit --pipe parallel -j0' or ". "Running 'parallel -j0 -N $system_limit --pipe parallel -j0' or ",
"raising ulimit -n or /etc/security/limits.conf may help."); "raising ulimit -n or /etc/security/limits.conf may help.");
} }
if($max_system_proc_reached) { if($max_system_proc_reached) {

View file

@ -148,9 +148,9 @@ echo '**'
parallel --halt 2 ::: 'sleep 1' burnP6 false; killall burnP6 && echo ERROR: burnP6 should be killed parallel --halt 2 ::: 'sleep 1' burnP6 false; killall burnP6 && echo ERROR: burnP6 should be killed
parallel --halt -2 ::: 'sleep 1' burnP5 true; killall burnP5 && echo ERROR: burnP5 should be killed parallel --halt -2 ::: 'sleep 1' burnP5 true; killall burnP5 && echo ERROR: burnP5 should be killed
parallel --halt error ::: 1 parallel --halt error echo ::: should not print
parallel --halt soon ::: 1 parallel --halt soon echo ::: should not print
parallel --halt now ::: 1 parallel --halt now echo ::: should not print
echo '**' echo '**'

View file

@ -58,7 +58,7 @@ bash -c 'echo bug \#43358: shellshock breaks exporting functions using --env _;
bug #43358: shellshock breaks exporting functions using --env _ bug #43358: shellshock breaks exporting functions using --env _
Non-shellshock-hardened to non-shellshock-hardened Non-shellshock-hardened to non-shellshock-hardened
Function non-shellshock-hardened Function non-shellshock-hardened
parallel: Warning: Shell functions may not be supported in bash parallel: Warning: Shell functions may not be supported in bash.
bash -c 'echo bug \#43358: shellshock breaks exporting functions using --env _; echo Non-shellshock-hardened to shellshock-hardened; funky() { echo Function $1; }; export -f funky; parallel --env funky -S parallel@192.168.1.72 funky ::: shellshock-hardened' bash -c 'echo bug \#43358: shellshock breaks exporting functions using --env _; echo Non-shellshock-hardened to shellshock-hardened; funky() { echo Function $1; }; export -f funky; parallel --env funky -S parallel@192.168.1.72 funky ::: shellshock-hardened'
bug #43358: shellshock breaks exporting functions using --env _ bug #43358: shellshock breaks exporting functions using --env _
Non-shellshock-hardened to shellshock-hardened Non-shellshock-hardened to shellshock-hardened

View file

@ -317,12 +317,12 @@ parallel --halt -2 ::: 'sleep 1' burnP5 true; killall burnP5 && echo ERROR: burn
parallel: This job succeeded: parallel: This job succeeded:
true true
burnP5: no process found burnP5: no process found
parallel --halt error ::: 1 parallel --halt error echo ::: should not print
parallel: Error: --halt must have 'never', 'soon', or 'now' parallel: Error: --halt must have 'never', 'soon', or 'now'.
parallel --halt soon ::: 1 parallel --halt soon echo ::: should not print
parallel: Error: --halt soon must be followed by ,success or ,fail parallel: Error: --halt soon must be followed by ,success or ,fail.
parallel --halt now ::: 1 parallel --halt now echo ::: should not print
parallel: Error: --halt now must be followed by ,success or ,fail parallel: Error: --halt now must be followed by ,success or ,fail.
echo '**' echo '**'
** **
echo '### bug #44995: parallel echo {#} ::: 1 2 ::: 1 2' echo '### bug #44995: parallel echo {#} ::: 1 2 ::: 1 2'

View file

@ -9,7 +9,8 @@ echo "### Test Force outside the file handle limit, 2009-02-17 Gave fork error"
### Test Force outside the file handle limit, 2009-02-17 Gave fork error ### Test Force outside the file handle limit, 2009-02-17 Gave fork error
(echo echo Start; seq 1 20000 | perl -pe 's/^/true /'; echo echo end) | stdout parallel -uj 0 | egrep -v 'processes took|adjusting' (echo echo Start; seq 1 20000 | perl -pe 's/^/true /'; echo echo end) | stdout parallel -uj 0 | egrep -v 'processes took|adjusting'
parallel: Warning: Only enough file handles to run 252 jobs in parallel. parallel: Warning: Only enough file handles to run 252 jobs in parallel.
Running 'parallel -j0 -N252 --pipe parallel -j0' or raising ulimit -n or /etc/security/limits.conf may help. parallel: Warning: Running 'parallel -j0 -N 252 --pipe parallel -j0' or
parallel: Warning: raising ulimit -n or /etc/security/limits.conf may help.
Start Start
end end
echo '**' echo '**'

View file

@ -1,7 +1,7 @@
echo '### Stop if all hosts are filtered and there are no hosts left to run on' echo '### Stop if all hosts are filtered and there are no hosts left to run on'
### Stop if all hosts are filtered and there are no hosts left to run on ### Stop if all hosts are filtered and there are no hosts left to run on
stdout parallel --filter-hosts -S no-such.host echo ::: 1 stdout parallel --filter-hosts -S no-such.host echo ::: 1
parallel: Warning: Removed no-such.host parallel: Warning: Removed no-such.host.
parallel: Error: There are no hosts left to run on. parallel: Error: There are no hosts left to run on.
echo '### Can csh propagate a variable containing \n'; export A=$(seq 3); parallel -S csh@localhost --env A bash -c \''echo "$A"'\' ::: dummy echo '### Can csh propagate a variable containing \n'; export A=$(seq 3); parallel -S csh@localhost --env A bash -c \''echo "$A"'\' ::: dummy
### Can csh propagate a variable containing \n ### Can csh propagate a variable containing \n

View file

@ -344,7 +344,8 @@ bug #38439: "open files" with --files --pipe blocks after a while
19 of 20 19 of 20
20 of 20 20 of 20
parallel: Warning: Only enough file handles to run 1 jobs in parallel. parallel: Warning: Only enough file handles to run 1 jobs in parallel.
Running 'parallel -j0 -N1 --pipe parallel -j0' or raising ulimit -n or /etc/security/limits.conf may help. parallel: Warning: Running 'parallel -j0 -N 1 --pipe parallel -j0' or
parallel: Warning: raising ulimit -n or /etc/security/limits.conf may help.
echo 'bug #34241: --pipe should not spawn unneeded processes - part 2' echo 'bug #34241: --pipe should not spawn unneeded processes - part 2'
bug #34241: --pipe should not spawn unneeded processes - part 2 bug #34241: --pipe should not spawn unneeded processes - part 2
seq 500 | parallel --tmpdir . -j10 --pipe --block 1k --files wc >/dev/null; ls *.par | wc -l; rm *.par; seq 500 | parallel --tmpdir . -j10 --pipe --block 1k --files --dry-run wc >/dev/null; echo No .par should exist; stdout ls *.par seq 500 | parallel --tmpdir . -j10 --pipe --block 1k --files wc >/dev/null; ls *.par | wc -l; rm *.par; seq 500 | parallel --tmpdir . -j10 --pipe --block 1k --files --dry-run wc >/dev/null; echo No .par should exist; stdout ls *.par

View file

@ -101,7 +101,7 @@ X : XXXXXXXXXX.XXX X.XXX X X X X true X
echo '### How do we deal with missing $HOME' echo '### How do we deal with missing $HOME'
### How do we deal with missing $HOME ### How do we deal with missing $HOME
unset HOME; stdout perl -w $(which parallel) -k echo ::: 1 2 3 unset HOME; stdout perl -w $(which parallel) -k echo ::: 1 2 3
parallel: Warning: $HOME not set. Using /tmp parallel: Warning: $HOME not set. Using /tmp.
1 1
2 2
3 3

View file

@ -1,7 +1,7 @@
### Test --pipe ### Test --pipe
echo '### Test 200M records with too small block'; ( echo start; seq 1 44 | parallel -uj1 cat /tmp/blocktest\;true; echo end; echo start; seq 1 44 | parallel -uj1 cat /tmp/blocktest\;true; echo end; echo start; seq 1 44 | parallel -uj1 cat /tmp/blocktest\;true; echo end; ) | stdout parallel -k --block 200m -j2 --pipe --recend 'end\n' wc -c | egrep -v '^0$' echo '### Test 200M records with too small block'; ( echo start; seq 1 44 | parallel -uj1 cat /tmp/blocktest\;true; echo end; echo start; seq 1 44 | parallel -uj1 cat /tmp/blocktest\;true; echo end; echo start; seq 1 44 | parallel -uj1 cat /tmp/blocktest\;true; echo end; ) | stdout parallel -k --block 200m -j2 --pipe --recend 'end\n' wc -c | egrep -v '^0$'
### Test 200M records with too small block ### Test 200M records with too small block
parallel: Warning: A record was longer than 200000000. Increasing to --blocksize 260000001 parallel: Warning: A record was longer than 200000000. Increasing to --blocksize 260000001.
303111434 303111434
303111434 303111434
303111434 303111434
@ -148,10 +148,10 @@ echo -n 01a02a0a0a12a34a45a6a | parallel -k -j1 --blocksize 100 --pipe --recen
2>0a12a34a 2>0a12a34a
3>45a6a 3>45a6a
echo -n 01a02a0a0a12a34a45a6a | stdout parallel -k -j1 --blocksize 1 --pipe --recend a -N 3 'echo -n "$PARALLEL_SEQ>"; cat; echo; sleep 0.1' echo -n 01a02a0a0a12a34a45a6a | stdout parallel -k -j1 --blocksize 1 --pipe --recend a -N 3 'echo -n "$PARALLEL_SEQ>"; cat; echo; sleep 0.1'
parallel: Warning: A record was longer than 1. Increasing to --blocksize 3 parallel: Warning: A record was longer than 1. Increasing to --blocksize 3.
parallel: Warning: A record was longer than 3. Increasing to --blocksize 5 parallel: Warning: A record was longer than 3. Increasing to --blocksize 5.
parallel: Warning: A record was longer than 5. Increasing to --blocksize 8.
1>01a02a0a 1>01a02a0a
parallel: Warning: A record was longer than 5. Increasing to --blocksize 8
2>0a12a34a 2>0a12a34a
3>45a6a 3>45a6a
echo '### Test 10M records with too big block'; ( echo start; seq 1 1 | parallel -uj1 cat /tmp/blocktest\;true; echo end; echo start; seq 1 1 | parallel -uj1 cat /tmp/blocktest\;true; echo end; echo start; seq 1 1 | parallel -uj1 cat /tmp/blocktest\;true; echo end; ) | stdout parallel -k --block 10M -j2 --pipe --recstart 'start\n' wc -c | egrep -v '^0$' echo '### Test 10M records with too big block'; ( echo start; seq 1 1 | parallel -uj1 cat /tmp/blocktest\;true; echo end; echo start; seq 1 1 | parallel -uj1 cat /tmp/blocktest\;true; echo end; echo start; seq 1 1 | parallel -uj1 cat /tmp/blocktest\;true; echo end; ) | stdout parallel -k --block 10M -j2 --pipe --recstart 'start\n' wc -c | egrep -v '^0$'

View file

@ -141,6 +141,7 @@ echo "# --recend '' --files --halt-on-error"
350eda13a37912d755c9d733d149bdaf - 350eda13a37912d755c9d733d149bdaf -
echo '### Test of -j filename - non-existent file'; nice stdout parallel -j no_such_file echo ::: 1 echo '### Test of -j filename - non-existent file'; nice stdout parallel -j no_such_file echo ::: 1
### Test of -j filename - non-existent file ### Test of -j filename - non-existent file
parallel: Error: Parsing of --jobs/-j/--max-procs/-P failed.
Usage: Usage:
parallel [options] [command [arguments]] < list_of_arguments parallel [options] [command [arguments]] < list_of_arguments
@ -178,7 +179,6 @@ please cite:
This helps funding further development; and it won't cost you a cent. This helps funding further development; and it won't cost you a cent.
If you pay 10000 EUR you should feel free to use GNU Parallel without citing. If you pay 10000 EUR you should feel free to use GNU Parallel without citing.
parallel: Error: Parsing of --jobs/-j/--max-procs/-P failed.
echo '### Test of -j filename'; echo 3 >/tmp/jobs_to_run1; parallel -j /tmp/jobs_to_run1 -v sleep {} ::: 10 8 6 5 4; # Should give 6 8 10 5 4 echo '### Test of -j filename'; echo 3 >/tmp/jobs_to_run1; parallel -j /tmp/jobs_to_run1 -v sleep {} ::: 10 8 6 5 4; # Should give 6 8 10 5 4
### Test of -j filename ### Test of -j filename
sleep 6 sleep 6

View file

@ -575,7 +575,7 @@ foo
3 3
parallel --filter-hosts -S 173.194.32.46,$SERVER1 echo ::: bar parallel --filter-hosts -S 173.194.32.46,$SERVER1 echo ::: bar
bar bar
parallel: Warning: Removed 173.194.32.46 parallel: Warning: Removed 173.194.32.46.
parallel --onall -S $SERVER1,$SERVER2 echo ::: foo bar parallel --onall -S $SERVER1,$SERVER2 echo ::: foo bar
foo foo
bar bar