parallel: --filter-host with --delay and --retries. Incl test.

This commit is contained in:
Ole Tange 2013-11-28 16:05:25 +01:00
parent e39e3c7b0f
commit f4db50264a
3 changed files with 23 additions and 3 deletions

View file

@ -119,8 +119,7 @@ if($opt::filter_hosts and (@opt::sshlogin or @opt::sshloginfile)) {
my ($fh, $tmpfile) = ::tempfile(SUFFIX => ".ssh");
print $fh @cores, @cpus, @maxline, @echo;
close $fh;
# my $cmd = "cat $tmpfile | $0 -j0 --timeout 5 -s 1000 --joblog - --plain --delay 0.1 --retries 3 --tag --tagstring {1} --colsep '\t' -k eval {2} 2>/dev/null";
my $cmd = "cat $tmpfile | $0 -j0 --timeout 5 -s 1000 --joblog - --plain --tag --tagstring {1} --colsep '\t' -k eval {2} 2>/dev/null";
my $cmd = "cat $tmpfile | $0 -j0 --timeout 5 -s 1000 --joblog - --plain --delay 0.1 --retries 3 --tag --tagstring {1} --colsep '\t' -k eval {2} 2>/dev/null";
::debug($cmd."\n");
open(my $host_fh, "-|", $cmd) || ::die_bug("parallel host check: $cmd");
my (%ncores, %ncpus, %time_to_login, %maxlen, %echo);
@ -801,7 +800,7 @@ sub get_options_from_array {
sub parse_options {
# Returns: N/A
# Defaults:
$Global::version = 20131122;
$Global::version = 20131129;
$Global::progname = 'parallel';
$Global::infinity = 2**31;
$Global::debug = 0;

View file

@ -19,4 +19,11 @@ echo '### --filter-hosts - OK, non-such-user, connection refused, wrong host'
echo '### test --workdir . in $HOME'
cd && mkdir -p parallel-test && cd parallel-test &&
echo OK > testfile && parallel --workdir . --transfer -S $SSHLOGIN1 cat {} ::: testfile
echo '### test --timeout --retries'
parallel -j0 --timeout 5 --retries 3 -k ssh {} echo {} ::: 192.168.1.197 8.8.8.8 n m o c f w
echo '### test --filter-hosts with server w/o ssh, non-existing server, and 5 proxied through the same'
parallel -S 192.168.1.197,8.8.8.8,n,m,o,c,f,w --filter-hosts --nonall --tag echo | sort
EOF

View file

@ -104,3 +104,17 @@ TODO test ssh with > 9 simultaneous
aspire
### test --workdir . in $HOME
OK
### test --timeout --retries
n
m
o
c
f
w
### test --filter-hosts with server w/o ssh, non-existing server, and 5 proxied through the same
c
f
m
n
o
w