mirror of
https://git.savannah.gnu.org/git/parallel.git
synced 2024-11-22 22:17:54 +00:00
76 lines
2.1 KiB
Bash
Executable file
76 lines
2.1 KiB
Bash
Executable file
#!/bin/bash
|
|
|
|
par_parcat_mixing() {
|
|
echo 'parcat output should mix: a b a b'
|
|
mktmpfifo() {
|
|
tmp=$(tempfile)
|
|
rm $tmp
|
|
mkfifo $tmp
|
|
echo $tmp
|
|
}
|
|
slow_output() {
|
|
string=$1
|
|
perl -e 'print "'$string'"x9000,"start\n"'
|
|
sleep 2
|
|
perl -e 'print "'$string'"x9000,"end\n"'
|
|
}
|
|
tmp1=$(mktmpfifo)
|
|
tmp2=$(mktmpfifo)
|
|
slow_output a > $tmp1 &
|
|
sleep 1
|
|
slow_output b > $tmp2 &
|
|
parcat $tmp1 $tmp2 | tr -s ab
|
|
}
|
|
|
|
par_tmux_termination() {
|
|
echo '### --tmux test - check termination'
|
|
doit() {
|
|
perl -e 'map {printf "$_%o%c\n",$_,$_}1..255' |
|
|
stdout parallel --tmux 'sleep 0.2;echo {}' :::: - ::: a b |
|
|
perl -pe 's:(/tmp\S*/tms).....:$1XXXXX:;'
|
|
}
|
|
export -f doit
|
|
stdout parallel --timeout 120 doit ::: 1
|
|
}
|
|
|
|
par_linebuffer_tag_slow_output() {
|
|
echo "Test output tag with mixing halflines"
|
|
halfline() {
|
|
perl -e '$| = 1; map { print $ARGV[0]; sleep(1); print "$_\n" } split //, "Half\n"' $1
|
|
}
|
|
export -f halfline
|
|
parallel --delay 0.5 -j0 --tag --line-buffer halfline ::: a b
|
|
}
|
|
|
|
par_distribute_input_by_ability() {
|
|
echo "### bug #48290: round-robin does not distribute data based on business"
|
|
echo "### Distribute input to jobs that are ready"
|
|
echo "Job-slot n is 50% slower than n+1, so the order should be 1..7"
|
|
seq 20000000 |
|
|
parallel --tagstring {#} -j7 --block 300k --round-robin --pipe \
|
|
'pv -qL{=$_=$job->seq()**3+9=}0000 |wc -c' |
|
|
sort -nk2 | field 1
|
|
}
|
|
|
|
par_print_before_halt_on_error() {
|
|
echo '### What is printed before the jobs are killed'
|
|
mytest() {
|
|
HALT=$1
|
|
(echo 0.1;
|
|
echo 3.2;
|
|
seq 0 7;
|
|
echo 0.3;
|
|
echo 8) |
|
|
parallel --tag --delay 0.1 -j4 -kq --halt $HALT \
|
|
perl -e 'sleep 1; sleep $ARGV[0]; print STDERR "",@ARGV,"\n"; '$HALT' > 0 ? exit shift : exit not shift;' {};
|
|
echo exit code $?
|
|
}
|
|
export -f mytest
|
|
parallel -j0 -k --tag mytest ::: -2 -1 0 1 2
|
|
}
|
|
|
|
export -f $(compgen -A function | grep par_)
|
|
compgen -A function | grep par_ | sort |
|
|
# parallel --joblog /tmp/jl-`basename $0` -j10 --tag -k '{} 2>&1'
|
|
parallel --joblog /tmp/jl-`basename $0` -j1 --tag -k '{} 2>&1'
|