Mercurial > hg > cc > azure
comparison master/bin/wrun.sh @ 30:9275e2a8b5e2
hacking to get id into wbash.sh, maybe buggy?
author | Henry S. Thompson <ht@markup.co.uk> |
---|---|
date | Mon, 19 Nov 2018 18:32:30 +0000 |
parents | 2fbefb8d1a9e |
children |
comparison
equal
deleted
inserted
replaced
29:2bde174fe9e2 | 30:9275e2a8b5e2 |
---|---|
20 fi | 20 fi |
21 group=cc | 21 group=cc |
22 name=$1 | 22 name=$1 |
23 cmd="$2" | 23 cmd="$2" |
24 shift 2 | 24 shift 2 |
25 if [ "$1" = "-d" ] | |
26 then | |
27 debug=-d | |
28 shift | |
29 fi | |
25 if [ "$1" = "-x" ] | 30 if [ "$1" = "-x" ] |
26 then | 31 then |
27 id=-x | 32 xx=-x |
28 shift | 33 shift |
29 else | 34 else |
30 id= | 35 xx= |
31 fi | 36 fi |
32 if [ "$1" = "-np" ] | 37 if [ "$1" = "-np" ] |
33 then | 38 then |
34 np=$2 | 39 np=$2 |
35 shift | 40 shift |
44 if [ "$1" = "-f" ] | 49 if [ "$1" = "-f" ] |
45 then | 50 then |
46 file=$2 | 51 file=$2 |
47 shift 2 | 52 shift 2 |
48 tfile=$(mktemp) | 53 tfile=$(mktemp) |
49 split -n r/$np -u --filter="cat > $tfile\$\$" $file & | 54 tee >(wc -l 1>&2) | split -n r/$np -u --filter="cat > $tfile\$\$" $file |
50 # Wait for files to be built | |
51 while [ $np -gt $(ls ${tfile}* | wc -l) ]; do echo -n . 1>&2; sleep 1; done | |
52 echo 1>&2 | |
53 wc -l ${tfile}* 1>&2 | 55 wc -l ${tfile}* 1>&2 |
54 elif [ "$1" = "-ff" ] | 56 elif [ "$1" = "-ff" ] |
55 then | 57 then |
56 file=$2 | 58 file=$2 |
57 shift 2 | 59 shift 2 |
81 <(az vmss list-instance-connection-info -g $group -n $name | tr -s ',": ' '\t' | \ | 83 <(az vmss list-instance-connection-info -g $group -n $name | tr -s ',": ' '\t' | \ |
82 tail -n +2 | head -$np |cut -f 3-5 | \ | 84 tail -n +2 | head -$np |cut -f 3-5 | \ |
83 while read i ip port | 85 while read i ip port |
84 do | 86 do |
85 echo $i $port $ip | 87 echo $i $port $ip |
86 done) | \ | 88 done) | tee /tmp/test.txt | \ |
87 parallel --gnu --colsep ' ' -j $np "$(dirname "$0")"/internal/invoke.sh $wait $id $me "$cmd" {} "$@" || { r=$? ; echo parallel exited with status=$r 1>&2;} | 89 parallel --gnu --colsep ' ' -j $np "$(dirname "$0")"/internal/invoke.sh $debug $wait $xx $me "$cmd" {} "$@" || { r=$? ; echo parallel exited with status=$r 1>&2;} |
88 if [ "${tfile}" ]; then rm ${tfile}*; fi | 90 #if [ "${tfile}" ]; then rm ${tfile}*; fi |