2013-12-19 01:19:19 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2024-01-24 01:02:07 +00:00
|
|
|
# SPDX-FileCopyrightText: 2021-2024 Ole Tange, http://ole.tange.dk and Free Software and Foundation, Inc.
|
2021-03-22 20:16:35 +00:00
|
|
|
#
|
|
|
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
|
2013-12-19 01:19:19 +00:00
|
|
|
# Simple jobs that never fails
|
|
|
|
# Each should be taking 10-30s and be possible to run in parallel
|
|
|
|
# I.e.: No race conditions, no logins
|
2017-01-01 11:42:52 +00:00
|
|
|
|
2024-08-04 08:47:04 +00:00
|
|
|
par_--match() {
|
|
|
|
export PARALLEL=-k
|
|
|
|
echo Basic match
|
|
|
|
parallel --match '(.*)/([a-zA-Z]+)' echo {1.2} {1.1} \
|
|
|
|
::: works/This "works, too"/This
|
|
|
|
|
|
|
|
echo Simple CSV-parsing
|
|
|
|
echo https://gnu.org/s/parallel,myfile |
|
|
|
|
parallel --match '(.*),(.*)' echo url={1.1} filename={1.2}
|
|
|
|
|
|
|
|
echo Dummy --match for input source 1, real --match for input source 2
|
|
|
|
parallel --match '' --match '(.*)/([A-Z]+)' echo {2.1} {1} ::: works ::: This/SKIP
|
|
|
|
|
|
|
|
echo Reuse --match
|
|
|
|
parallel --match +2 --match '([A-Z]+)' echo {2.1} {1.1} \
|
|
|
|
::: ignoreOK ::: ignoreALL
|
|
|
|
|
|
|
|
echo With --header :
|
|
|
|
parallel --header : --match +2 --match '([A-Z]+)' echo {B.1} {A.1} \
|
|
|
|
::: A ignoreOK ::: B ignoreALL
|
|
|
|
|
|
|
|
echo Failure to match/Partial match
|
|
|
|
parallel --match '([a-z]+)' echo {1.1} ::: matches FAILS MATCHESpartly
|
|
|
|
|
|
|
|
echo Test error: missing --match
|
|
|
|
parallel --match 'dummy' echo {2.1} ::: should fail
|
|
|
|
|
|
|
|
echo 'Test error: \001 in match'
|
|
|
|
ctrl_a=$(perl -e 'printf "%c",1')
|
|
|
|
parallel --match "$ctrl_a" echo {1.1} ::: fail
|
|
|
|
|
|
|
|
echo From man parallel_examples
|
|
|
|
parallel --match '(.)' --dr 'mkdir -p {1.1} && mv {} {1.1}' ::: afile bfile adir
|
|
|
|
parallel --match '(.).* (.*)' echo {1.1}. {1.2} \
|
|
|
|
::: "Arthur Dent" "Ford Prefect" "Tricia McMillan" "Zaphod Beeblebrox"
|
|
|
|
parallel --match '(.*)/(.*)/(.*)' echo {1.3}-{1.1}-{1.2} \
|
|
|
|
::: 12/31/1969 01/19/2038 06/01/2002
|
|
|
|
parallel --match 'https://(.*?)/(.*)' echo Domain: {1.1} Path: {1.2} \
|
|
|
|
::: https://example.com/dir/page https://gnu.org/s/parallel
|
|
|
|
parallel --match '(.*),(.*)' echo Second: {1.2}, First: {1.1} \
|
|
|
|
::: "Arthur,Babel fish" "Adams,Betelgeuse" "Arcturan,Bistro"
|
|
|
|
parallel --match '([a-z])([a-z]*) ([a-z])([a-z]*)' \
|
|
|
|
echo '{=1.1 $_=uc($_) =}{1.2} {=1.3 $_=uc($_) =}{1.4}' \
|
|
|
|
::: "pan galactic" "gargle blaster"
|
|
|
|
dial=(
|
|
|
|
"DK(Denmark) 00,45"
|
|
|
|
"US(United States) 011,1"
|
|
|
|
"JP(Japan) 010,81"
|
|
|
|
"AU(Australia) 0011,61"
|
|
|
|
"CA(Canada) 011,1"
|
|
|
|
"RU(Russia) 810,7"
|
|
|
|
"TH(Thailand) 001,66"
|
|
|
|
"TW(Taiwan) 002,886"
|
|
|
|
)
|
|
|
|
parallel --match '(.*)\((.*)\) (.*),(.*)' --match +1 \
|
|
|
|
echo From {1.1}/{1.2} to {2.1}/{2.2} dial {1.3}-{2.4} \
|
|
|
|
::: "${dial[@]}" ::: "${dial[@]}"
|
|
|
|
|
|
|
|
echo Capture groups CSV-parsing - not implemented
|
|
|
|
echo https://gnu.org/s/parallel,myfile |
|
|
|
|
parallel --match '(?<url>.*),(?<file>.*)' echo url={url} filename={file}
|
|
|
|
|
|
|
|
echo Non posistional replacement fields - not implemented
|
|
|
|
parallel --match '(.*),(.*)_(.*)' echo {.2} {.3} {.1} ::: Gold,Heart_of
|
|
|
|
|
|
|
|
echo TODO Ignore case?
|
|
|
|
}
|
|
|
|
|
|
|
|
par__tee_too_many_args() {
|
2023-07-21 02:33:22 +00:00
|
|
|
echo '### Fail if there are more arguments than --jobs'
|
|
|
|
seq 11 | stdout parallel -k --tag --pipe -j4 --tee grep {} ::: {1..4}
|
|
|
|
tmp=`mktemp`
|
|
|
|
seq 11 | parallel -k --tag --pipe -j0 --tee grep {} ::: {1..10000} 2> "$tmp"
|
|
|
|
cat "$tmp" | perl -pe 's/\d+/999/g' |
|
|
|
|
grep -v 'Warning: Starting' |
|
|
|
|
grep -v 'Warning: Consider'
|
|
|
|
rm "$tmp"
|
|
|
|
}
|
|
|
|
|
2023-05-06 21:42:36 +00:00
|
|
|
par_retries_0() {
|
|
|
|
echo '--retries 0 = inf'
|
|
|
|
echo this wraps at 256 and should retry until it wraps
|
|
|
|
tmp=$(mktemp)
|
|
|
|
qtmp=$(parallel -0 --shellquote ::: "$tmp")
|
|
|
|
parallel --retries 0 -u 'printf {} >> '"$qtmp"';a=$(stat -c %s '"$qtmp"'); echo -n " $a"; exit $a' ::: a
|
|
|
|
echo
|
|
|
|
rm -f "$tmp"
|
|
|
|
}
|
|
|
|
|
|
|
|
par_seqreplace_long_line() {
|
|
|
|
echo '### Test --seqreplace and line too long'
|
|
|
|
seq 1 1000 |
|
|
|
|
stdout parallel -j1 -s 210 -k --seqreplace I echo IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII \|wc |
|
|
|
|
uniq -c
|
|
|
|
}
|
|
|
|
|
|
|
|
par__load_from_PARALLEL() {
|
2022-12-15 21:30:15 +00:00
|
|
|
echo "### Test reading load from PARALLEL"
|
|
|
|
export PARALLEL="--load 300%"
|
|
|
|
# Ignore stderr due to 'Starting processes took > 2 sec'
|
|
|
|
seq 1 1000000 |
|
|
|
|
parallel -kj200 --recend "\n" --spreadstdin gzip -1 2>/dev/null |
|
|
|
|
zcat | sort -n | md5sum
|
|
|
|
seq 1 1000000 |
|
|
|
|
parallel -kj20 --recend "\n" --spreadstdin gzip -1 |
|
|
|
|
zcat | sort -n | md5sum
|
|
|
|
}
|
|
|
|
|
2024-08-04 08:47:04 +00:00
|
|
|
par__quote_special_results() {
|
2023-01-30 21:51:56 +00:00
|
|
|
echo "### Test --results on file systems with limited UTF8 support"
|
2023-07-21 02:33:22 +00:00
|
|
|
export LC_ALL=C
|
2022-11-26 20:42:41 +00:00
|
|
|
doit() {
|
|
|
|
mkfs=$1
|
|
|
|
img=$(mktemp /dev/shm/par-test-loop-XXXX.img)
|
|
|
|
dir=$(mktemp -d /tmp/par-test-loop-XXXX)
|
2024-05-22 20:55:05 +00:00
|
|
|
dd if=/dev/zero bs=1024k count=301 > "$img"
|
2022-11-26 20:42:41 +00:00
|
|
|
# Use the mkfs.$filesystem
|
2023-01-30 21:51:56 +00:00
|
|
|
$mkfs "$img"
|
|
|
|
sudo mount "$img" "$dir" -oloop,uid=`id -u` 2>/dev/null ||
|
|
|
|
sudo mount "$img" "$dir" -oloop
|
|
|
|
cd "$dir"
|
2022-11-26 20:42:41 +00:00
|
|
|
sudo chown `id -u` .
|
2023-01-30 21:51:56 +00:00
|
|
|
df "$dir"
|
2022-11-26 20:42:41 +00:00
|
|
|
printf "%s\0" '' +m . +_ .. +__ ,. ,.. + ++ / +z |
|
|
|
|
parallel -0 --results a echo
|
2023-01-30 21:51:56 +00:00
|
|
|
(cd a/1 && find . -type d | sort | fmt -2000)
|
2022-11-26 20:42:41 +00:00
|
|
|
seq 128 | perl -ne 'printf "%c\0",$_' |
|
|
|
|
parallel -0 --results b128 echo
|
2023-01-30 21:51:56 +00:00
|
|
|
(cd b128/1 && find . -type d | sort | fmt -2000)
|
2022-11-26 20:42:41 +00:00
|
|
|
seq 128 255 | perl -ne 'printf "%c\0",$_' |
|
|
|
|
parallel -0 --results b255 echo
|
2023-01-30 21:51:56 +00:00
|
|
|
(cd b255/1 && find . -type d | sort | fmt -2000)
|
2022-11-26 20:42:41 +00:00
|
|
|
cd
|
2023-01-30 21:51:56 +00:00
|
|
|
sudo umount "$dir"
|
|
|
|
rmdir "$dir"/
|
|
|
|
rm "$img"
|
2022-11-26 20:42:41 +00:00
|
|
|
}
|
|
|
|
export -f doit
|
2023-07-21 02:33:22 +00:00
|
|
|
stdout parallel --timeout 1000% -k --tag --plus doit ::: \
|
2022-11-26 20:42:41 +00:00
|
|
|
mkfs.btrfs mkfs.exfat mkfs.ext2 mkfs.ext3 mkfs.ext4 \
|
|
|
|
"mkfs.reiserfs -fq" "mkfs.ntfs -F" "mkfs.xfs -f" mkfs.minix \
|
|
|
|
mkfs.fat mkfs.vfat mkfs.msdos mkfs.f2fs |
|
|
|
|
perl -pe 's:(/dev/loop|par-test-loop)\S+:$1:g;s/ +/ /g' |
|
2024-05-22 20:55:05 +00:00
|
|
|
G -v MB/s -v GB/s -v UUID -v Binutils -v 150000 -v exfatprogs |
|
2024-06-09 18:54:40 +00:00
|
|
|
G -v ID.SIZE.PATH |
|
|
|
|
# mkfs.xfs -f = crc=1 finobt=1, sparse=1, rmapbt=0
|
|
|
|
# mkfs.xfs -f = reflink=1 bigtime=0 inobtcount=0
|
|
|
|
G -v crc=..finobt=...sparse=...rmapbt= -v reflink=..bigtime=..inobtcount= |
|
|
|
|
# mkfs.xfs -f log =internal log bsize=4096 blocks=16384, version=2
|
|
|
|
G -v log.=internal.log.bsize= |
|
2024-05-22 20:55:05 +00:00
|
|
|
# mkfs.btrfs Incompat features: extref, skinny-metadata, no-holes
|
|
|
|
# mke2fs 1.46.5 (30-Dec-2021)
|
|
|
|
# btrfs-progs v6.6.3
|
2024-06-09 18:54:40 +00:00
|
|
|
G -vP Incompat.features -vP mke2fs.[.0-9]{5} -vP btrfs-progs.v[.0-9]{5} |
|
|
|
|
# F2FS-tools: mkfs.f2fs Ver: 1.14.0 (2020-08-24)
|
|
|
|
G -vP mkfs.f2fs.Ver:.[.0-9]{5} |
|
2024-05-22 20:55:05 +00:00
|
|
|
# See https://btrfs.readthedocs.io for more
|
|
|
|
# mkfs.f2fs Info: Overprovision segments = 27 (GC reserved = 18)
|
|
|
|
G -v 'See http' -v Overprovision |
|
|
|
|
# mkfs.f2fs /dev/loop 147952 70136 77816 48% /tmp/par-test-loop
|
2024-06-09 18:54:40 +00:00
|
|
|
perl -pe 's:/dev/loop \d+ \d+ \d+ \d+:/dev/loop 999999 99999 99999 9:'
|
2022-11-26 20:42:41 +00:00
|
|
|
# Skip:
|
|
|
|
# mkfs.bfs - ro
|
|
|
|
# mkfs.cramfs - ro
|
|
|
|
}
|
|
|
|
|
2022-11-02 19:09:16 +00:00
|
|
|
par_totaljobs() {
|
|
|
|
. `which env_parallel.bash`
|
|
|
|
myrun() {
|
|
|
|
total="$@"
|
|
|
|
slowseq() { seq "$@" | pv -qL 3; }
|
|
|
|
elapsed() { /usr/bin/time -f %e stdout "$@" 2>&1 >/dev/null; }
|
|
|
|
slowseq 5 | elapsed parallel -j 1 $total --bar 'sleep 1; true'
|
|
|
|
}
|
|
|
|
export -f myrun
|
|
|
|
parset mytime myrun ::: '' '--total 5'
|
|
|
|
# --total should run > 2 sec faster
|
|
|
|
perl -E 'say ((2+shift) < (shift) ? "Error: --total should be faster" : "OK")' ${mytime[0]} ${mytime[1]}
|
|
|
|
}
|
|
|
|
|
2022-10-15 19:09:51 +00:00
|
|
|
par_ll_long_line() {
|
|
|
|
echo '### --latest-line with lines longer than terminal width'
|
|
|
|
COLUMNS=30 parallel --delay 0.3 --tagstring '{=$_.="x"x$_=}' \
|
2022-11-08 23:09:33 +00:00
|
|
|
--ll 'echo {}00000 | sed -e "s/$/' {1..100} /'"' ::: {01..30} |
|
|
|
|
perl -ne 's/.\[A//g;
|
|
|
|
/.\[K .{4}\[m/ and next;
|
|
|
|
/x\s*$/ and next;
|
|
|
|
/\S/ && print'| sort -u
|
2022-10-15 19:09:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
par_ll_color_long_line() {
|
|
|
|
echo '### --latest-line --color with lines longer than terminal width'
|
|
|
|
COLUMNS=30 parallel --delay 0.3 --color --tagstring '{=$_.="x"x$_=}' \
|
2022-11-08 23:09:33 +00:00
|
|
|
--ll 'echo {}00000 | sed -e "s/$/' {1..100} /'"' ::: {01..30} |
|
|
|
|
perl -ne 's/.\[A//g;
|
|
|
|
/.\[K .{4}\[m/ and next;
|
|
|
|
/\S/ && print'| sort -u
|
2022-10-15 19:09:51 +00:00
|
|
|
}
|
|
|
|
|
2020-12-30 12:42:02 +00:00
|
|
|
par_load_blocks() {
|
|
|
|
echo "### Test if --load blocks. Bug.";
|
|
|
|
export PARALLEL="--load 300%"
|
|
|
|
(seq 1 1000 |
|
|
|
|
parallel -kj2 --load 300% --recend "\n" --spreadstdin gzip -1 |
|
|
|
|
zcat | sort -n | md5sum
|
|
|
|
seq 1 1000 |
|
|
|
|
parallel -kj200 --load 300% --recend "\n" --spreadstdin gzip -1 |
|
|
|
|
zcat | sort -n | md5sum) 2>&1 |
|
|
|
|
grep -Ev 'processes took|Consider adjusting -j'
|
|
|
|
}
|
|
|
|
|
2023-05-06 21:42:36 +00:00
|
|
|
par__round_robin_blocks() {
|
2022-03-09 22:03:26 +00:00
|
|
|
echo "bug #49664: --round-robin does not complete"
|
|
|
|
seq 20000000 | parallel -j8 --block 10M --round-robin --pipe wc -c | wc -l
|
|
|
|
}
|
|
|
|
|
2020-10-22 19:47:01 +00:00
|
|
|
par_compress_prg_fails() {
|
2023-05-06 21:42:36 +00:00
|
|
|
echo "### bug #41609: --compress fails"
|
|
|
|
seq 12 | parallel --compress --compress-program gzip -k seq {} 10000 | md5sum
|
|
|
|
seq 12 | parallel --compress -k seq {} 10000 | md5sum
|
|
|
|
|
2020-10-22 19:47:01 +00:00
|
|
|
echo '### bug #44546: If --compress-program fails: fail'
|
|
|
|
doit() {
|
|
|
|
(parallel $* --compress-program false \
|
|
|
|
echo \; sleep 1\; ls ::: /no-existing
|
|
|
|
echo $?) | tail -n1
|
|
|
|
}
|
|
|
|
export -f doit
|
|
|
|
stdout parallel --tag -k doit ::: '' --line-buffer ::: '' --tag ::: '' --files |
|
|
|
|
grep -v -- -dc
|
|
|
|
}
|
|
|
|
|
|
|
|
par_dryrun_timeout_ungroup() {
|
|
|
|
echo 'bug #51039: --dry-run --timeout 1.4m -u breaks'
|
|
|
|
seq 1000 | stdout parallel --dry-run --timeout 1.4m -u --jobs 10 echo | wc
|
|
|
|
}
|
|
|
|
|
|
|
|
par_opt_arg_eaten() {
|
|
|
|
echo 'bug #31716: Options with optional arguments may eat next argument'
|
|
|
|
echo '### Test https://savannah.gnu.org/bugs/index.php?31716'
|
|
|
|
seq 1 5 | stdout parallel -k -l echo {} OK
|
|
|
|
seq 1 5 | stdout parallel -k -l 1 echo {} OK
|
|
|
|
|
|
|
|
echo '### -k -l -0'
|
|
|
|
printf '1\0002\0003\0004\0005\000' | stdout parallel -k -l -0 echo {} OK
|
|
|
|
|
|
|
|
echo '### -k -0 -l'
|
|
|
|
printf '1\0002\0003\0004\0005\000' | stdout parallel -k -0 -l echo {} OK
|
|
|
|
|
|
|
|
echo '### -k -0 -l 1'
|
|
|
|
printf '1\0002\0003\0004\0005\000' | stdout parallel -k -0 -l 1 echo {} OK
|
|
|
|
|
|
|
|
echo '### -k -0 -l 0'
|
|
|
|
printf '1\0002\0003\0004\0005\000' | stdout parallel -k -0 -l 0 echo {} OK
|
|
|
|
|
|
|
|
echo '### -k -0 -L -0 - -0 is argument for -L'
|
|
|
|
printf '1\0002\0003\0004\0005\000' | stdout parallel -k -0 -L -0 echo {} OK
|
|
|
|
|
|
|
|
echo '### -k -0 -L 0 - -L always takes arg'
|
|
|
|
printf '1\0002\0003\0004\0005\000' | stdout parallel -k -0 -L 0 echo {} OK
|
|
|
|
|
|
|
|
echo '### -k -0 -L 0 - -L always takes arg'
|
|
|
|
printf '1\0002\0003\0004\0005\000' | stdout parallel -k -L 0 -0 echo {} OK
|
|
|
|
|
|
|
|
echo '### -k -e -0'
|
|
|
|
printf '1\0002\0003\0004\0005\000' | stdout parallel -k -e -0 echo {} OK
|
|
|
|
|
|
|
|
echo '### -k -0 -e eof'
|
|
|
|
printf '1\0002\0003\0004\0005\000' | stdout parallel -k -0 -e eof echo {} OK
|
|
|
|
|
|
|
|
echo '### -k -i -0'
|
|
|
|
printf '1\0002\0003\0004\0005\000' | stdout parallel -k -i -0 echo {} OK
|
|
|
|
|
|
|
|
echo '### -k -0 -i repl'
|
|
|
|
printf '1\0002\0003\0004\0005\000' | stdout parallel -k -0 -i repl echo repl OK
|
|
|
|
}
|
|
|
|
|
2024-08-04 08:47:04 +00:00
|
|
|
par__nice() {
|
2020-06-25 11:07:02 +00:00
|
|
|
echo 'Check that --nice works'
|
|
|
|
# parallel-20160422 OK
|
|
|
|
check_for_2_bzip2s() {
|
|
|
|
perl -e '
|
|
|
|
for(1..5) {
|
|
|
|
# Try 5 times if the machine is slow starting bzip2
|
|
|
|
sleep(1);
|
|
|
|
@out = qx{ps -eo "%c %n" | grep 18 | grep bzip2};
|
|
|
|
if($#out == 1) {
|
|
|
|
# Should find 2 lines
|
|
|
|
print @out;
|
|
|
|
exit 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
print "failed\n@out";
|
|
|
|
'
|
|
|
|
}
|
|
|
|
# wait for load < 8
|
|
|
|
parallel --load 8 echo ::: load_10
|
|
|
|
parallel -j0 --timeout 10 --nice 18 bzip2 '<' ::: /dev/zero /dev/zero &
|
|
|
|
pid=$!
|
|
|
|
check_for_2_bzip2s
|
|
|
|
parallel --retries 10 '! kill -TERM' ::: $pid 2>/dev/null
|
|
|
|
}
|
|
|
|
|
2020-01-12 08:14:21 +00:00
|
|
|
par_colsep() {
|
|
|
|
echo '### Test of --colsep'
|
|
|
|
echo 'a%c%b' | parallel --colsep % echo {1} {3} {2}
|
|
|
|
(echo 'a%c%b'; echo a%c%b%d) | parallel -k --colsep % echo {1} {3} {2} {4}
|
|
|
|
(echo a%c%b; echo d%f%e) | parallel -k --colsep % echo {1} {3} {2}
|
|
|
|
parallel -k --colsep % echo {1} {3} {2} ::: a%c%b d%f%e
|
|
|
|
parallel -k --colsep % echo {1} {3} {2} ::: a%c%b
|
|
|
|
parallel -k --colsep % echo {1} {3} {2} {4} ::: a%c%b a%c%b%d
|
|
|
|
|
|
|
|
|
|
|
|
echo '### Test of tab as colsep'
|
|
|
|
printf 'def\tabc\njkl\tghi' | parallel -k --colsep '\t' echo {2} {1}
|
|
|
|
parallel -k -a <(printf 'def\tabc\njkl\tghi') --colsep '\t' echo {2} {1}
|
|
|
|
|
|
|
|
echo '### Test of multiple -a plus colsep'
|
|
|
|
parallel --xapply -k -a <(printf 'def\njkl\n') -a <(printf 'abc\tghi\nmno\tpqr') --colsep '\t' echo {2} {1}
|
|
|
|
|
|
|
|
echo '### Test of multiple -a no colsep'
|
|
|
|
parallel --xapply -k -a <(printf 'ghi\npqr\n') -a <(printf 'abc\tdef\njkl\tmno') echo {2} {1}
|
|
|
|
|
|
|
|
echo '### Test of quoting after colsplit'
|
|
|
|
parallel --colsep % echo {2} {1} ::: '>/dev/null%>/tmp/null'
|
|
|
|
|
|
|
|
echo '### Test of --colsep as regexp'
|
|
|
|
(echo 'a%c%%b'; echo a%c%b%d) | parallel -k --colsep %+ echo {1} {3} {2} {4}
|
|
|
|
parallel -k --colsep %+ echo {1} {3} {2} {4} ::: a%c%%b a%c%b%d
|
|
|
|
(echo 'a% c %%b'; echo a%c% b %d) | parallel -k --colsep %+ echo {1} {3} {2} {4}
|
|
|
|
(echo 'a% c %%b'; echo a%c% b %d) | parallel -k --colsep %+ echo '"{1}_{3}_{2}_{4}"'
|
2020-08-07 20:20:30 +00:00
|
|
|
|
2020-01-12 08:14:21 +00:00
|
|
|
echo '### Test of -C'
|
|
|
|
(echo 'a% c %%b'; echo a%c% b %d) | parallel -k -C %+ echo '"{1}_{3}_{2}_{4}"'
|
2020-08-07 20:20:30 +00:00
|
|
|
|
2020-01-12 08:14:21 +00:00
|
|
|
echo '### Test of --trim n'
|
|
|
|
(echo 'a% c %%b'; echo a%c% b %d) | parallel -k --trim n --colsep %+ echo '"{1}_{3}_{2}_{4}"'
|
|
|
|
parallel -k -C %+ echo '"{1}_{3}_{2}_{4}"' ::: 'a% c %%b' 'a%c% b %d'
|
|
|
|
|
|
|
|
echo '### Test of bug: If input is empty string'
|
|
|
|
(echo ; echo abcbdbebf;echo abc) | parallel -k --colsep b -v echo {1}{2}
|
|
|
|
}
|
|
|
|
|
|
|
|
par_failing_compressor() {
|
|
|
|
echo 'Compress with failing (de)compressor'
|
|
|
|
echo 'Test --tag/--line-buffer/--files in all combinations'
|
|
|
|
echo 'Test working/failing compressor/decompressor in all combinations'
|
|
|
|
echo '(-k is used as a dummy argument)'
|
2022-10-22 14:58:06 +00:00
|
|
|
doit() {
|
|
|
|
# Print something to stdout/stderr
|
|
|
|
echo "$@"
|
|
|
|
echo "$@" >&2
|
|
|
|
}
|
|
|
|
export -f doit
|
2020-01-12 08:14:21 +00:00
|
|
|
stdout parallel -vk --header : --argsep ,,, \
|
2023-07-23 12:31:07 +00:00
|
|
|
stdout parallel -k {tag} {lb} {files} --compress \
|
|
|
|
--compress-program {comp} --decompress-program {decomp} doit \
|
|
|
|
::: C={comp},D={decomp} \
|
2020-01-12 08:14:21 +00:00
|
|
|
,,, tag --tag -k \
|
|
|
|
,,, lb --line-buffer -k \
|
2023-02-19 13:49:30 +00:00
|
|
|
,,, files --files0 -k \
|
2020-01-12 08:14:21 +00:00
|
|
|
,,, comp 'cat;true' 'cat;false' \
|
|
|
|
,,, decomp 'cat;true' 'cat;false' |
|
2023-02-19 13:49:30 +00:00
|
|
|
replace_tmpdir |
|
|
|
|
perl -pe 's:/par......par:/tmpfile:'
|
2019-06-23 06:31:28 +00:00
|
|
|
}
|
|
|
|
|
2020-01-12 08:14:21 +00:00
|
|
|
par_fifo_under_csh() {
|
|
|
|
echo '### Test --fifo under csh'
|
2023-02-03 15:37:25 +00:00
|
|
|
doit() {
|
|
|
|
csh -c "seq 3000000 | parallel -k --pipe --fifo 'sleep .{#};cat {}|wc -c ; false; echo \$status; false'"
|
|
|
|
echo exit $?
|
|
|
|
}
|
2023-01-30 21:51:56 +00:00
|
|
|
# csh does not seem to work with TMPDIR containing \n
|
2023-02-03 15:37:25 +00:00
|
|
|
doit
|
2023-01-30 21:51:56 +00:00
|
|
|
TMPDIR=/tmp
|
2023-02-03 15:37:25 +00:00
|
|
|
doit
|
2019-06-16 23:21:45 +00:00
|
|
|
}
|
|
|
|
|
2019-05-05 23:06:48 +00:00
|
|
|
par_END() {
|
|
|
|
echo '### Test -i and --replace: Replace with argument'
|
|
|
|
(echo a; echo END; echo b) | parallel -k -i -eEND echo repl{}ce
|
|
|
|
(echo a; echo END; echo b) | parallel -k --replace -eEND echo repl{}ce
|
|
|
|
(echo a; echo END; echo b) | parallel -k -i+ -eEND echo repl+ce
|
|
|
|
(echo e; echo END; echo b) | parallel -k -i'*' -eEND echo r'*'plac'*'
|
|
|
|
(echo a; echo END; echo b) | parallel -k --replace + -eEND echo repl+ce
|
|
|
|
(echo a; echo END; echo b) | parallel -k --replace== -eEND echo repl=ce
|
|
|
|
(echo a; echo END; echo b) | parallel -k --replace = -eEND echo repl=ce
|
|
|
|
(echo a; echo END; echo b) | parallel -k --replace=^ -eEND echo repl^ce
|
|
|
|
(echo a; echo END; echo b) | parallel -k -I^ -eEND echo repl^ce
|
|
|
|
|
|
|
|
echo '### Test -E: Artificial end-of-file'
|
|
|
|
(echo include this; echo END; echo not this) | parallel -k -E END echo
|
|
|
|
(echo include this; echo END; echo not this) | parallel -k -EEND echo
|
|
|
|
|
|
|
|
echo '### Test -e and --eof: Artificial end-of-file'
|
|
|
|
(echo include this; echo END; echo not this) | parallel -k -e END echo
|
|
|
|
(echo include this; echo END; echo not this) | parallel -k -eEND echo
|
|
|
|
(echo include this; echo END; echo not this) | parallel -k --eof=END echo
|
|
|
|
(echo include this; echo END; echo not this) | parallel -k --eof END echo
|
|
|
|
}
|
|
|
|
|
2024-08-04 08:47:04 +00:00
|
|
|
par__xargs_compat() {
|
2019-05-05 23:06:48 +00:00
|
|
|
echo xargs compatibility
|
2020-08-07 20:20:30 +00:00
|
|
|
a_b-c() { echo a_b; echo c; }
|
|
|
|
a_b_-c-d() { echo a_b' '; echo c; echo d; }
|
|
|
|
a_b_-c-d-e() { echo a_b' '; echo c; echo d; echo e; }
|
|
|
|
one_mb_line() { perl -e 'print "z"x1000000'; }
|
|
|
|
stdsort() { "$@" | LC_ALL=C sort; }
|
2019-05-05 23:06:48 +00:00
|
|
|
|
|
|
|
echo '### Test -L -l and --max-lines'
|
2020-08-07 20:20:30 +00:00
|
|
|
a_b-c | parallel -km -L2 echo
|
|
|
|
a_b-c | parallel -k -L2 echo
|
|
|
|
a_b-c | xargs -L2 echo
|
2019-05-05 23:06:48 +00:00
|
|
|
|
|
|
|
echo '### xargs -L1 echo'
|
2020-08-07 20:20:30 +00:00
|
|
|
a_b-c | parallel -km -L1 echo
|
|
|
|
a_b-c | parallel -k -L1 echo
|
|
|
|
a_b-c | xargs -L1 echo
|
2019-05-05 23:06:48 +00:00
|
|
|
|
|
|
|
echo 'Lines ending in space should continue on next line'
|
|
|
|
echo '### xargs -L1 echo'
|
2020-08-07 20:20:30 +00:00
|
|
|
a_b_-c-d | parallel -km -L1 echo
|
|
|
|
a_b_-c-d | parallel -k -L1 echo
|
|
|
|
a_b_-c-d | xargs -L1 echo
|
2019-05-05 23:06:48 +00:00
|
|
|
|
|
|
|
echo '### xargs -L2 echo'
|
2020-08-07 20:20:30 +00:00
|
|
|
a_b_-c-d-e | parallel -km -L2 echo
|
|
|
|
a_b_-c-d-e | parallel -k -L2 echo
|
|
|
|
a_b_-c-d-e | xargs -L2 echo
|
2019-05-05 23:06:48 +00:00
|
|
|
|
|
|
|
echo '### xargs -l echo'
|
2020-08-07 20:20:30 +00:00
|
|
|
a_b_-c-d-e | parallel -l -km echo # This behaves wrong
|
|
|
|
a_b_-c-d-e | parallel -l -k echo # This behaves wrong
|
|
|
|
a_b_-c-d-e | xargs -l echo
|
2019-05-05 23:06:48 +00:00
|
|
|
|
|
|
|
echo '### xargs -l2 echo'
|
2020-08-07 20:20:30 +00:00
|
|
|
a_b_-c-d-e | parallel -km -l2 echo
|
|
|
|
a_b_-c-d-e | parallel -k -l2 echo
|
|
|
|
a_b_-c-d-e | xargs -l2 echo
|
2019-05-05 23:06:48 +00:00
|
|
|
|
|
|
|
echo '### xargs -l1 echo'
|
2020-08-07 20:20:30 +00:00
|
|
|
a_b_-c-d-e | parallel -km -l1 echo
|
|
|
|
a_b_-c-d-e | parallel -k -l1 echo
|
|
|
|
a_b_-c-d-e | xargs -l1 echo
|
2019-05-05 23:06:48 +00:00
|
|
|
|
|
|
|
echo '### xargs --max-lines=2 echo'
|
2020-08-07 20:20:30 +00:00
|
|
|
a_b_-c-d-e | parallel -km --max-lines 2 echo
|
|
|
|
a_b_-c-d-e | parallel -k --max-lines 2 echo
|
|
|
|
a_b_-c-d-e | xargs --max-lines=2 echo
|
2019-05-05 23:06:48 +00:00
|
|
|
|
|
|
|
echo '### xargs --max-lines echo'
|
2020-08-07 20:20:30 +00:00
|
|
|
a_b_-c-d-e | parallel --max-lines -km echo # This behaves wrong
|
|
|
|
a_b_-c-d-e | parallel --max-lines -k echo # This behaves wrong
|
|
|
|
a_b_-c-d-e | xargs --max-lines echo
|
2019-05-05 23:06:48 +00:00
|
|
|
|
|
|
|
echo '### test too long args'
|
2020-08-07 20:20:30 +00:00
|
|
|
one_mb_line | parallel echo 2>&1
|
|
|
|
one_mb_line | xargs echo 2>&1
|
|
|
|
(seq 1 10; one_mb_line; seq 12 15) | stdsort parallel -j1 -km -s 10 echo
|
|
|
|
(seq 1 10; one_mb_line; seq 12 15) | stdsort xargs -s 10 echo
|
|
|
|
(seq 1 10; one_mb_line; seq 12 15) | stdsort parallel -j1 -kX -s 10 echo
|
2019-05-05 23:06:48 +00:00
|
|
|
|
|
|
|
echo '### Test -x'
|
2020-08-07 20:20:30 +00:00
|
|
|
echo '-km'
|
2019-05-05 23:06:48 +00:00
|
|
|
(seq 1 10; echo 12345; seq 12 15) | stdsort parallel -j1 -km -s 10 -x echo
|
2020-08-07 20:20:30 +00:00
|
|
|
echo '-kX'
|
2019-05-05 23:06:48 +00:00
|
|
|
(seq 1 10; echo 12345; seq 12 15) | stdsort parallel -j1 -kX -s 10 -x echo
|
2020-08-07 20:20:30 +00:00
|
|
|
echo '-x'
|
2019-05-05 23:06:48 +00:00
|
|
|
(seq 1 10; echo 12345; seq 12 15) | stdsort xargs -s 10 -x echo
|
2020-08-07 20:20:30 +00:00
|
|
|
echo '-km -x'
|
2019-05-05 23:06:48 +00:00
|
|
|
(seq 1 10; echo 1234; seq 12 15) | stdsort parallel -j1 -km -s 10 -x echo
|
2020-08-07 20:20:30 +00:00
|
|
|
echo '-kX -x'
|
2019-05-05 23:06:48 +00:00
|
|
|
(seq 1 10; echo 1234; seq 12 15) | stdsort parallel -j1 -kX -s 10 -x echo
|
2020-08-07 20:20:30 +00:00
|
|
|
echo '-x'
|
2019-05-05 23:06:48 +00:00
|
|
|
(seq 1 10; echo 1234; seq 12 15) | stdsort xargs -s 10 -x echo
|
|
|
|
}
|
|
|
|
|
2018-01-06 18:58:01 +00:00
|
|
|
par_line_buffer() {
|
|
|
|
echo "### --line-buffer"
|
2022-05-22 08:36:45 +00:00
|
|
|
tmp1=$(mktemp)
|
|
|
|
tmp2=$(mktemp)
|
2018-01-06 18:58:01 +00:00
|
|
|
|
2023-01-30 21:51:56 +00:00
|
|
|
seq 10 | parallel -j20 --line-buffer 'seq {} 10 | pv -qL 10' > "$tmp1"
|
|
|
|
seq 10 | parallel -j20 'seq {} 10 | pv -qL 10' > "$tmp2"
|
|
|
|
cat "$tmp1" | wc
|
|
|
|
diff "$tmp1" "$tmp2" >/dev/null
|
2018-01-06 18:58:01 +00:00
|
|
|
echo These must diff: $?
|
2023-01-30 21:51:56 +00:00
|
|
|
rm "$tmp1" "$tmp2"
|
2018-01-06 18:58:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
par_pipe_line_buffer() {
|
|
|
|
echo "### --pipe --line-buffer"
|
2022-05-22 08:36:45 +00:00
|
|
|
tmp1=$(mktemp)
|
|
|
|
tmp2=$(mktemp)
|
2018-01-06 18:58:01 +00:00
|
|
|
|
2018-07-08 18:45:39 +00:00
|
|
|
nowarn() {
|
|
|
|
# Ignore certain warnings
|
|
|
|
# parallel: Warning: Starting 11 processes took > 2 sec.
|
|
|
|
# parallel: Warning: Consider adjusting -j. Press CTRL-C to stop.
|
|
|
|
grep -v '^parallel: Warning: (Starting|Consider)'
|
|
|
|
}
|
|
|
|
|
|
|
|
export PARALLEL="-N10 -L1 --pipe -j20 --tagstring {#}"
|
2023-01-30 21:51:56 +00:00
|
|
|
seq 200| parallel --line-buffer pv -qL 10 > "$tmp1" 2> >(nowarn)
|
|
|
|
seq 200| parallel pv -qL 10 > "$tmp2" 2> >(nowarn)
|
|
|
|
cat "$tmp1" | wc
|
|
|
|
diff "$tmp1" "$tmp2" >/dev/null
|
2018-01-06 18:58:01 +00:00
|
|
|
echo These must diff: $?
|
2023-01-30 21:51:56 +00:00
|
|
|
rm "$tmp1" "$tmp2"
|
2018-01-06 18:58:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
par_pipe_line_buffer_compress() {
|
|
|
|
echo "### --pipe --line-buffer --compress"
|
2023-01-30 21:51:56 +00:00
|
|
|
seq 200 |
|
|
|
|
parallel -N10 -L1 --pipe -j20 --line-buffer --compress --tagstring {#} pv -qL 10 |
|
|
|
|
wc
|
2018-01-06 18:58:01 +00:00
|
|
|
}
|
|
|
|
|
2017-06-22 11:35:58 +00:00
|
|
|
par__pipepart_spawn() {
|
|
|
|
echo '### bug #46214: Using --pipepart doesnt spawn multiple jobs in version 20150922'
|
2018-12-29 21:33:50 +00:00
|
|
|
seq 1000000 > /tmp/num1000000
|
|
|
|
stdout parallel --pipepart --progress -a /tmp/num1000000 --block 10k -j0 true |
|
2021-02-17 14:49:47 +00:00
|
|
|
grep 1:local | perl -pe 's/\d\d\d/999/g; s/\d\d+|[2-9]/2+/g;'
|
2017-06-22 11:35:58 +00:00
|
|
|
}
|
|
|
|
|
2023-05-06 21:42:36 +00:00
|
|
|
par_pipe_tee() {
|
2017-06-22 11:35:58 +00:00
|
|
|
echo 'bug #45479: --pipe/--pipepart --tee'
|
|
|
|
echo '--pipe --tee'
|
|
|
|
|
2018-12-29 21:33:50 +00:00
|
|
|
random100M() {
|
2017-06-22 11:35:58 +00:00
|
|
|
< /dev/zero openssl enc -aes-128-ctr -K 1234 -iv 1234 2>/dev/null |
|
2018-12-29 21:33:50 +00:00
|
|
|
head -c 100M;
|
2017-06-22 11:35:58 +00:00
|
|
|
}
|
2018-12-29 21:33:50 +00:00
|
|
|
random100M | parallel --pipe --tee cat ::: {1..3} | LC_ALL=C wc -c
|
2017-06-22 11:35:58 +00:00
|
|
|
}
|
|
|
|
|
2023-05-06 21:42:36 +00:00
|
|
|
par_pipepart_tee() {
|
2017-06-22 11:35:58 +00:00
|
|
|
echo 'bug #45479: --pipe/--pipepart --tee'
|
|
|
|
echo '--pipepart --tee'
|
|
|
|
|
2018-12-29 21:33:50 +00:00
|
|
|
export TMPDIR=/dev/shm/parallel
|
|
|
|
mkdir -p $TMPDIR
|
|
|
|
random100M() {
|
2017-06-22 11:35:58 +00:00
|
|
|
< /dev/zero openssl enc -aes-128-ctr -K 1234 -iv 1234 2>/dev/null |
|
2018-12-29 21:33:50 +00:00
|
|
|
head -c 100M;
|
2017-06-22 11:35:58 +00:00
|
|
|
}
|
|
|
|
tmp=$(mktemp)
|
2023-01-30 21:51:56 +00:00
|
|
|
random100M >"$tmp"
|
2018-10-22 22:46:38 +00:00
|
|
|
parallel --pipepart --tee -a $tmp cat ::: {1..3} | LC_ALL=C wc -c
|
2023-01-30 21:51:56 +00:00
|
|
|
rm "$tmp"
|
2017-06-22 11:35:58 +00:00
|
|
|
}
|
|
|
|
|
2017-01-01 11:42:52 +00:00
|
|
|
par_k() {
|
|
|
|
echo '### Test -k'
|
|
|
|
ulimit -n 50
|
2018-12-29 20:04:58 +00:00
|
|
|
(echo "sleep 3; echo begin";
|
|
|
|
seq 1 30 |
|
|
|
|
parallel -j1 -kq echo "sleep 1; echo {}";
|
|
|
|
echo "echo end") |
|
|
|
|
stdout nice parallel -k -j0 |
|
2019-04-21 18:16:33 +00:00
|
|
|
grep -Ev 'No more file handles.|Raising ulimit -n' |
|
|
|
|
perl -pe '/parallel:/ and s/\d/X/g'
|
2016-12-14 07:48:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
par_k_linebuffer() {
|
|
|
|
echo '### bug #47750: -k --line-buffer should give current job up to now'
|
|
|
|
|
|
|
|
parallel --line-buffer --tag -k 'seq {} | pv -qL 10' ::: {10..20}
|
|
|
|
parallel --line-buffer -k 'echo stdout top;sleep 1;echo stderr in the middle >&2; sleep 1;echo stdout' ::: end 2>&1
|
|
|
|
}
|
|
|
|
|
|
|
|
par_maxlinelen_m_I() {
|
|
|
|
echo "### Test max line length -m -I"
|
|
|
|
|
2018-10-22 22:46:38 +00:00
|
|
|
seq 1 60000 | parallel -I :: -km -j1 echo a::b::c | LC_ALL=C sort >/tmp/114-a$$;
|
2016-12-14 07:48:27 +00:00
|
|
|
md5sum </tmp/114-a$$;
|
|
|
|
export CHAR=$(cat /tmp/114-a$$ | wc -c);
|
|
|
|
export LINES=$(cat /tmp/114-a$$ | wc -l);
|
|
|
|
echo "Chars per line ($CHAR/$LINES): "$(echo "$CHAR/$LINES" | bc);
|
|
|
|
rm /tmp/114-a$$
|
|
|
|
}
|
|
|
|
|
|
|
|
par_maxlinelen_X_I() {
|
|
|
|
echo "### Test max line length -X -I"
|
|
|
|
|
2018-10-22 22:46:38 +00:00
|
|
|
seq 1 60000 | parallel -I :: -kX -j1 echo a::b::c | LC_ALL=C sort >/tmp/114-b$$;
|
2016-12-14 07:48:27 +00:00
|
|
|
md5sum </tmp/114-b$$;
|
|
|
|
export CHAR=$(cat /tmp/114-b$$ | wc -c);
|
|
|
|
export LINES=$(cat /tmp/114-b$$ | wc -l);
|
|
|
|
echo "Chars per line ($CHAR/$LINES): "$(echo "$CHAR/$LINES" | bc);
|
|
|
|
rm /tmp/114-b$$
|
|
|
|
}
|
|
|
|
|
2016-12-18 10:14:06 +00:00
|
|
|
par_results_csv() {
|
|
|
|
echo "bug #: --results csv"
|
|
|
|
|
|
|
|
doit() {
|
2023-02-03 15:37:25 +00:00
|
|
|
parallel -k $@ --results -.csv echo ::: H2 22 23 ::: H1 11 12 \
|
2023-02-19 13:49:30 +00:00
|
|
|
2> >(grep -v TMPDIR) |
|
|
|
|
replace_tmpdir
|
2016-12-18 10:14:06 +00:00
|
|
|
}
|
|
|
|
export -f doit
|
|
|
|
parallel -k --tag doit ::: '--header :' '' \
|
2023-02-19 13:49:30 +00:00
|
|
|
::: --tag '' ::: --files0 '' ::: --compress '' |
|
|
|
|
perl -pe 's:/par......par:/tmpfile:g;s/\d+\.\d+/999.999/g'
|
2016-12-18 10:14:06 +00:00
|
|
|
}
|
|
|
|
|
2017-01-01 11:42:52 +00:00
|
|
|
par_kill_children_timeout() {
|
|
|
|
echo '### Test killing children with --timeout and exit value (failed if timed out)'
|
2018-01-06 18:58:01 +00:00
|
|
|
pstree $$ | grep sleep | grep -v anacron | grep -v screensave | wc
|
2017-01-01 11:42:52 +00:00
|
|
|
doit() {
|
|
|
|
for i in `seq 100 120`; do
|
|
|
|
bash -c "(sleep $i)" &
|
|
|
|
sleep $i &
|
|
|
|
done;
|
|
|
|
wait;
|
|
|
|
echo No good;
|
|
|
|
}
|
|
|
|
export -f doit
|
2018-01-06 18:58:01 +00:00
|
|
|
parallel --timeout 3 doit ::: 1000000000 1000000001
|
2017-01-01 11:42:52 +00:00
|
|
|
echo $?;
|
|
|
|
sleep 2;
|
|
|
|
pstree $$ | grep sleep | grep -v anacron | grep -v screensave | wc
|
|
|
|
}
|
|
|
|
|
2017-01-21 18:55:14 +00:00
|
|
|
par_tmux_fg() {
|
|
|
|
echo 'bug #50107: --tmux --fg should also write how to access it'
|
2023-02-19 13:49:30 +00:00
|
|
|
stdout parallel --tmux --fg sleep ::: 3 |
|
|
|
|
replace_tmpdir |
|
|
|
|
perl -pe 's:/tms.....:tmpfile:'
|
2017-01-21 18:55:14 +00:00
|
|
|
}
|
2017-01-01 11:42:52 +00:00
|
|
|
|
2017-03-28 19:30:06 +00:00
|
|
|
|
2018-04-25 20:38:42 +00:00
|
|
|
par_retries_all_fail() {
|
|
|
|
echo "bug #53748: -k --retries 10 + out of filehandles = blocking"
|
|
|
|
ulimit -n 30
|
|
|
|
seq 8 |
|
|
|
|
parallel -k -j0 --retries 2 --timeout 0.1 'echo {}; sleep {}; false' 2>/dev/null
|
|
|
|
}
|
|
|
|
|
2018-07-22 06:58:32 +00:00
|
|
|
par_long_line_remote() {
|
|
|
|
echo '### Deal with long command lines on remote servers'
|
|
|
|
perl -e "print(((\"'\"x5000).\"\\n\")x6)" |
|
|
|
|
parallel -j1 -S lo -N 10000 echo {} |wc
|
|
|
|
perl -e 'print((("\$"x5000)."\n")x50)' |
|
|
|
|
parallel -j1 -S lo -N 10000 echo {} |wc
|
|
|
|
}
|
|
|
|
|
2019-06-27 13:49:49 +00:00
|
|
|
par_shellquote() {
|
|
|
|
echo '### Test --shellquote in all shells'
|
|
|
|
doit() {
|
|
|
|
# Run --shellquote for ascii 1..255 in a shell
|
|
|
|
shell="$1"
|
|
|
|
"$shell" -c perl\ -e\ \'print\ pack\(\"c\*\",1..255\)\'\ \|\ parallel\ -0\ --shellquote
|
|
|
|
}
|
|
|
|
export -f doit
|
2024-08-21 20:14:24 +00:00
|
|
|
parallel --tag -q -k doit {} ::: bash csh dash fish fizsh ksh2020 ksh93 lksh mksh posh rzsh sash sh static-sh tcsh yash zsh csh tcsh
|
2019-06-27 13:49:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
par_tmp_full() {
|
|
|
|
# Assume /tmp/shm is easy to fill up
|
|
|
|
export SHM=/tmp/shm/parallel
|
|
|
|
mkdir -p $SHM
|
|
|
|
sudo umount -l $SHM 2>/dev/null
|
|
|
|
sudo mount -t tmpfs -o size=10% none $SHM
|
|
|
|
|
|
|
|
echo "### Test --tmpdir running full. bug #40733 was caused by this"
|
2024-05-05 17:06:38 +00:00
|
|
|
stdout parallel -j1 --tmpdir $SHM cat /dev/zero ::: dummy |
|
|
|
|
grep -v 'Warning:.*No space left on device during global destruction'
|
2019-06-27 13:49:49 +00:00
|
|
|
}
|
|
|
|
|
2020-05-23 18:04:09 +00:00
|
|
|
par_jobs_file() {
|
|
|
|
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
|
|
|
|
}
|
2019-05-05 23:06:48 +00:00
|
|
|
|
2016-12-14 07:48:27 +00:00
|
|
|
export -f $(compgen -A function | grep par_)
|
2024-01-21 06:53:12 +00:00
|
|
|
compgen -A function | G par_ "$@" | LC_ALL=C sort |
|
2020-01-12 08:14:21 +00:00
|
|
|
parallel --timeout 1000% -j10 --tag -k --joblog /tmp/jl-`basename $0` '{} 2>&1' |
|
2019-09-22 05:30:08 +00:00
|
|
|
perl -pe 's/,31,0/,15,0/' |
|
2020-08-07 20:20:30 +00:00
|
|
|
# Replace $PWD with . even if given as ~/...
|
2023-01-30 21:51:56 +00:00
|
|
|
perl -pe 's:~:'"$HOME"':g' |
|
|
|
|
perl -pe 's:'"$HOME"':~:g'
|