parallel.pod: Added graph over related options.

This commit is contained in:
Ole Tange 2022-02-19 19:54:01 +01:00
parent 961ad63bdc
commit 2ebb75eb17
7 changed files with 590 additions and 336 deletions

View file

@ -31,7 +31,7 @@ doc_DATA = parallel.html env_parallel.html sem.html sql.html \
parallel.pdf env_parallel.pdf sem.pdf sql.pdf niceload.pdf \
parallel_tutorial.pdf parallel_book.pdf parallel_design.pdf \
parallel_alternatives.pdf parcat.pdf parset.pdf parsort.pdf \
parallel_cheat_bw.pdf
parallel_cheat_bw.pdf parallel_options_map.pdf
endif
web: sphinx
@ -345,6 +345,10 @@ parallel_cheat_bw.pdf: parallel_cheat_bw.fodt
libreoffice --headless --convert-to pdf parallel_cheat_bw.fodt \
|| echo "Warning: libreoffice failed. Using old parallel_cheat_bw.pdf"
parallel_options_map.pdf: parallel.pod
./pod2graph parallel.pod > parallel_options_map.pdf \
|| echo "Warning: pod2graph failed. Using old parallel_options_map.pdf"
sem: parallel
ln -fs parallel sem
@ -365,7 +369,7 @@ DISTCLEANFILES = parallel.1 env_parallel.1 sem.1 sql.1 niceload.1 \
parallel.pdf env_parallel.pdf sem.pdf sql.pdf niceload.pdf \
parallel_tutorial.pdf parallel_book.pdf parallel_design.pdf \
parallel_alternatives.pdf parcat.pdf parset.pdf parsort.pdf \
parallel_cheat_bw.pdf
parallel_cheat_bw.pdf parallel_options_map.pdf
EXTRA_DIST = parallel sem sql niceload parcat parset parsort \
env_parallel env_parallel.ash env_parallel.bash \

File diff suppressed because it is too large Load diff

101
src/pod2graph Executable file
View file

@ -0,0 +1,101 @@
#!/usr/bin/perl
# Convert .pod file containing:
#
# =item --option
#
# See also: --other-option
#
# to a graph.pdf with link between --option and --other-option
$pod=join("",<>);
$pod=~s/^.*=head1 OPTIONS//s;
$pod=~s/=head1 EXAMPLES.*//s;
$pod=~s/^.*?=over//s;
$pod=~s/=back\s*$//s;
$pod=~s/=over.*?=back//sg;
$in_text = 0;
$in_item = 0;
$in_see_also = 0;
for(split(/\n\n+/,$pod)) {
if(/^See also:\s+(\S.*)/s) {
$lex = "seealso";
$in_text = 0;
$in_item = 0;
$in_see_only = 1;
} elsif(/^=item\s+(B<[{]=.*?perl expression.*?=[}]>|[IB]<.*?>)(\s|$)/s) {
$lex = "item";
$in_text = 0;
$in_item = 1;
$in_see_only = 0;
} elsif(/\S/) {
$lex = "text";
$in_text = 1;
$in_item = 0;
$in_see_only = 0;
}
if($lex eq "seealso") {
if($lastlex eq "item") {
@saveditems = @items;
@items = ();
}
my $to = $1;
my $from = (join "/",
map {
s/I<(.*?)>/$1/g;
s/B<(.*?)>/$1/g;
$_ }
@saveditems[0]);
my @to;
while($to =~ s/(B<[{]=.*?perl expression.*?=[}]>|[BI]<.*?>)(\s|$)//) {
my $v = $1;
push @to, map {
s/I<(.*?)>/$1/g;
s/B<(.*?)>/$1/g;
$_;
} $v;
}
map {
if(not $seen{$from,$_}++
and
not $seen{$_,$from}++) {
push @nodelines, "\"$from\" -- \"$_\"\n"
}
} @to;
} elsif($lex eq "text") {
if($lastlex eq "item") {
@saveditems = @items;
@items = ();
}
} elsif($lex eq "item") {
push(@items,$1);
}
$lastlex=$lex;
}
sub header() {
return q[
graph test123 {
graph [splines=true overlap=false;nodesep=2;
];
labelloc="t";
label="Related map for options for GNU Parallel\nFind which options relate to which";fontsize=33;
"{}"[margin=0.3;]
"--sshlogin"[margin=0.3]
"--pipe"[margin=0.3;]
":::"[margin=0.3;]
"-N"[margin=0.3]
];
}
open(GRAPHVIZ,"|-","sfdp -Tpdf") || die;
print GRAPHVIZ header(), (sort { rand()*3 -1 } @nodelines), "}";
close GRAPHVIZ;

View file

@ -8,21 +8,6 @@
# Each should be taking 10-30s and be possible to run in parallel
# I.e.: No race conditions, no logins
par_bin() {
echo '### Test --bin'
seq 10 | parallel --pipe --bin 1 -j4 wc | sort
paste <(seq 10) <(seq 10 -1 1) |
parallel --pipe --colsep '\t' --bin 2 -j4 wc | sort
echo '### Test --bin with expression that gives 1..n'
paste <(seq 10) <(seq 10 -1 1) |
parallel --pipe --colsep '\t' --bin '2 $_=$_%2+1' -j4 wc | sort
echo '### Test --bin with expression that gives 0..n-1'
paste <(seq 10) <(seq 10 -1 1) |
parallel --pipe --colsep '\t' --bin '2 $_%=2' -j4 wc | sort
# Fails - blocks!
# paste <(seq 10) <(seq 10 -1 1) | parallel --pipe --colsep '\t' --bin 2 wc
}
par_load_blocks() {
echo "### Test if --load blocks. Bug.";
export PARALLEL="--load 300%"

View file

@ -8,6 +8,22 @@
# Each should be taking 30-100s and be possible to run in parallel
# I.e.: No race conditions, no logins
par_bin() {
echo '### Test --bin'
seq 10 | parallel --pipe --bin 1 -j4 wc | sort
paste <(seq 10) <(seq 10 -1 1) |
parallel --pipe --colsep '\t' --bin 2 -j4 wc | sort
echo '### Test --bin with expression that gives 1..n'
paste <(seq 10) <(seq 10 -1 1) |
parallel --pipe --colsep '\t' --bin '2 $_=$_%2+1' -j4 wc | sort
echo '### Test --bin with expression that gives 0..n-1'
paste <(seq 10) <(seq 10 -1 1) |
parallel --pipe --colsep '\t' --bin '2 $_%=2' -j4 wc | sort
echo '### Blocks in version 20220122'
echo 10 | ppar --pipe --bin 1 -j100% wc
paste <(seq 10) <(seq 10 -1 1) | parallel --pipe --colsep '\t' --bin 2 wc
}
par_shard_a() {
echo '### --shard'
# Each of the 5 lines should match:

View file

@ -24,25 +24,6 @@ par__pipepart_spawn 1:local / 2+ / 2+
par__pipepart_tee bug #45479: --pipe/--pipepart --tee
par__pipepart_tee --pipepart --tee
par__pipepart_tee 314572800
par_bin ### Test --bin
par_bin 2 2 4
par_bin 2 2 4
par_bin 3 3 6
par_bin 3 3 7
par_bin 2 4 8
par_bin 2 4 8
par_bin 3 6 13
par_bin 3 6 13
par_bin ### Test --bin with expression that gives 1..n
par_bin 0 0 0
par_bin 0 0 0
par_bin 5 10 21
par_bin 5 10 21
par_bin ### Test --bin with expression that gives 0..n-1
par_bin 0 0 0
par_bin 0 0 0
par_bin 5 10 21
par_bin 5 10 21
par_colsep ### Test of --colsep
par_colsep a b c
par_colsep a b c

View file

@ -1,3 +1,39 @@
par_bin ### Test --bin
par_bin 2 2 4
par_bin 2 2 4
par_bin 3 3 6
par_bin 3 3 7
par_bin 2 4 8
par_bin 2 4 8
par_bin 3 6 13
par_bin 3 6 13
par_bin ### Test --bin with expression that gives 1..n
par_bin 0 0 0
par_bin 0 0 0
par_bin 5 10 21
par_bin 5 10 21
par_bin ### Test --bin with expression that gives 0..n-1
par_bin 0 0 0
par_bin 0 0 0
par_bin 5 10 21
par_bin 5 10 21
par_bin ### Blocks in version 20220122
par_bin 0 0 0
par_bin 0 0 0
par_bin 1 1 3
par_bin 0 0 0
par_bin 0 0 0
par_bin 0 0 0
par_bin 0 0 0
par_bin 0 0 0
par_bin 1 2 4
par_bin 1 2 4
par_bin 1 2 4
par_bin 2 4 9
par_bin 1 2 4
par_bin 2 4 9
par_bin 1 2 4
par_bin 1 2 4
par_exit_code bug #52207: Exit status 0 when child job is killed, even with "now,fail=1"
par_exit_code # Ideally the command should return the same
par_exit_code # with or without parallel
@ -1640,95 +1676,97 @@ par_race_condition1 9
par_race_condition1 10
par_round_robin_blocks bug #49664: --round-robin does not complete
par_round_robin_blocks 8
par_shard ### --shard
par_shard OK
par_shard OK
par_shard OK
par_shard OK
par_shard OK
par_shard 10 1
par_shard 10 2
par_shard 10 3
par_shard 10 4
par_shard 10 5
par_shard 10 6
par_shard 10 7
par_shard 10 8
par_shard 10 9
par_shard 9 0
par_shard 9 1
par_shard 9 2
par_shard 9 3
par_shard 9 4
par_shard 9 5
par_shard 9 6
par_shard 9 7
par_shard 9 8
par_shard 9 9
par_shard 10 1
par_shard 10 2
par_shard 10 3
par_shard 10 4
par_shard 10 5
par_shard 10 6
par_shard 10 7
par_shard 10 8
par_shard 10 9
par_shard 9 0
par_shard 9 1
par_shard 9 2
par_shard 9 3
par_shard 9 4
par_shard 9 5
par_shard 9 6
par_shard 9 7
par_shard 9 8
par_shard 9 9
par_shard 10 1
par_shard 10 2
par_shard 10 3
par_shard 10 4
par_shard 10 5
par_shard 10 6
par_shard 10 7
par_shard 10 8
par_shard 10 9
par_shard 2 c1
par_shard 9 0
par_shard 9 1
par_shard 9 2
par_shard 9 3
par_shard 9 4
par_shard 9 5
par_shard 9 6
par_shard 9 7
par_shard 9 8
par_shard 9 9
par_shard 2 c2
par_shard 10 1
par_shard 10 2
par_shard 10 3
par_shard 10 4
par_shard 10 5
par_shard 10 6
par_shard 10 7
par_shard 10 8
par_shard 10 9
par_shard 2 c1
par_shard 9 0
par_shard 9 1
par_shard 9 2
par_shard 9 3
par_shard 9 4
par_shard 9 5
par_shard 9 6
par_shard 9 7
par_shard 9 8
par_shard 9 9
par_shard 2 c2
par_shard *** broken
par_shard parallel: Error: --shard requires --jobs to be higher than the number of
par_shard parallel: Error: arguments. Increase --jobs.
par_shard_a ### --shard
par_shard_a OK
par_shard_a OK
par_shard_a OK
par_shard_a OK
par_shard_a OK
par_shard_a 10 1
par_shard_a 10 2
par_shard_a 10 3
par_shard_a 10 4
par_shard_a 10 5
par_shard_a 10 6
par_shard_a 10 7
par_shard_a 10 8
par_shard_a 10 9
par_shard_a 9 0
par_shard_a 9 1
par_shard_a 9 2
par_shard_a 9 3
par_shard_a 9 4
par_shard_a 9 5
par_shard_a 9 6
par_shard_a 9 7
par_shard_a 9 8
par_shard_a 9 9
par_shard_b ### --shard
par_shard_b 10 1
par_shard_b 10 2
par_shard_b 10 3
par_shard_b 10 4
par_shard_b 10 5
par_shard_b 10 6
par_shard_b 10 7
par_shard_b 10 8
par_shard_b 10 9
par_shard_b 9 0
par_shard_b 9 1
par_shard_b 9 2
par_shard_b 9 3
par_shard_b 9 4
par_shard_b 9 5
par_shard_b 9 6
par_shard_b 9 7
par_shard_b 9 8
par_shard_b 9 9
par_shard_c ### --shard
par_shard_c 10 1
par_shard_c 10 2
par_shard_c 10 3
par_shard_c 10 4
par_shard_c 10 5
par_shard_c 10 6
par_shard_c 10 7
par_shard_c 10 8
par_shard_c 10 9
par_shard_c 2 c1
par_shard_c 9 0
par_shard_c 9 1
par_shard_c 9 2
par_shard_c 9 3
par_shard_c 9 4
par_shard_c 9 5
par_shard_c 9 6
par_shard_c 9 7
par_shard_c 9 8
par_shard_c 9 9
par_shard_c 2 c2
par_shard_d 10 1
par_shard_d 10 2
par_shard_d 10 3
par_shard_d 10 4
par_shard_d 10 5
par_shard_d 10 6
par_shard_d 10 7
par_shard_d 10 8
par_shard_d 10 9
par_shard_d 2 c1
par_shard_d 9 0
par_shard_d 9 1
par_shard_d 9 2
par_shard_d 9 3
par_shard_d 9 4
par_shard_d 9 5
par_shard_d 9 6
par_shard_d 9 7
par_shard_d 9 8
par_shard_d 9 9
par_shard_d 2 c2
par_shard_d *** broken
par_shard_d parallel: Error: --shard requires --jobs to be higher than the number of
par_shard_d parallel: Error: arguments. Increase --jobs.
par_sighup ### Test SIGHUP
par_sighup 1
par_sighup 10