Mercurial > hg > cc > azure
annotate master/src/wecu/run_sac.sh @ 59:8332faef25e1
get quoting and arg positions right
author | Henry S. Thompson <ht@markup.co.uk> |
---|---|
date | Thu, 28 May 2020 09:58:38 +0000 |
parents | a3edba8dab11 |
children | 5fdca5baa4e9 |
rev | line source |
---|---|
57
ac1a20e627a9
from lukasz git repo 2020-05-26 (see ~/src/wecu), then editted,
Henry S. Thompson <ht@markup.co.uk>
parents:
diff
changeset
|
1 #!/bin/bash |
59
8332faef25e1
get quoting and arg positions right
Henry S. Thompson <ht@markup.co.uk>
parents:
58
diff
changeset
|
2 # Usage: run_sac.sh numcores hostsFilename workDir resType patType patterns |
57
ac1a20e627a9
from lukasz git repo 2020-05-26 (see ~/src/wecu), then editted,
Henry S. Thompson <ht@markup.co.uk>
parents:
diff
changeset
|
3 cores=$1 |
ac1a20e627a9
from lukasz git repo 2020-05-26 (see ~/src/wecu), then editted,
Henry S. Thompson <ht@markup.co.uk>
parents:
diff
changeset
|
4 hosts=$2 |
ac1a20e627a9
from lukasz git repo 2020-05-26 (see ~/src/wecu), then editted,
Henry S. Thompson <ht@markup.co.uk>
parents:
diff
changeset
|
5 wd=$3 |
ac1a20e627a9
from lukasz git repo 2020-05-26 (see ~/src/wecu), then editted,
Henry S. Thompson <ht@markup.co.uk>
parents:
diff
changeset
|
6 shift |
ac1a20e627a9
from lukasz git repo 2020-05-26 (see ~/src/wecu), then editted,
Henry S. Thompson <ht@markup.co.uk>
parents:
diff
changeset
|
7 shift |
ac1a20e627a9
from lukasz git repo 2020-05-26 (see ~/src/wecu), then editted,
Henry S. Thompson <ht@markup.co.uk>
parents:
diff
changeset
|
8 shift |
ac1a20e627a9
from lukasz git repo 2020-05-26 (see ~/src/wecu), then editted,
Henry S. Thompson <ht@markup.co.uk>
parents:
diff
changeset
|
9 rm -f allout |
ac1a20e627a9
from lukasz git repo 2020-05-26 (see ~/src/wecu), then editted,
Henry S. Thompson <ht@markup.co.uk>
parents:
diff
changeset
|
10 |
59
8332faef25e1
get quoting and arg positions right
Henry S. Thompson <ht@markup.co.uk>
parents:
58
diff
changeset
|
11 # Get quoting right... |
8332faef25e1
get quoting and arg positions right
Henry S. Thompson <ht@markup.co.uk>
parents:
58
diff
changeset
|
12 worker () { |
8332faef25e1
get quoting and arg positions right
Henry S. Thompson <ht@markup.co.uk>
parents:
58
diff
changeset
|
13 f=$1 |
8332faef25e1
get quoting and arg positions right
Henry S. Thompson <ht@markup.co.uk>
parents:
58
diff
changeset
|
14 shift |
8332faef25e1
get quoting and arg positions right
Henry S. Thompson <ht@markup.co.uk>
parents:
58
diff
changeset
|
15 shift # we don't need/want the resType either |
8332faef25e1
get quoting and arg positions right
Henry S. Thompson <ht@markup.co.uk>
parents:
58
diff
changeset
|
16 hostname 1>&2 |
8332faef25e1
get quoting and arg positions right
Henry S. Thompson <ht@markup.co.uk>
parents:
58
diff
changeset
|
17 export PYTHONIOENCODING=utf-8 |
8332faef25e1
get quoting and arg positions right
Henry S. Thompson <ht@markup.co.uk>
parents:
58
diff
changeset
|
18 curl -s -N https://commoncrawl.s3.amazonaws.com/$f | \ |
8332faef25e1
get quoting and arg positions right
Henry S. Thompson <ht@markup.co.uk>
parents:
58
diff
changeset
|
19 unpigz -dp 1 -c | tee >(wc -l 1>&2) | ./sac_mapper.py "$@" 2>&1 |
8332faef25e1
get quoting and arg positions right
Henry S. Thompson <ht@markup.co.uk>
parents:
58
diff
changeset
|
20 } |
8332faef25e1
get quoting and arg positions right
Henry S. Thompson <ht@markup.co.uk>
parents:
58
diff
changeset
|
21 |
8332faef25e1
get quoting and arg positions right
Henry S. Thompson <ht@markup.co.uk>
parents:
58
diff
changeset
|
22 export -f worker |
8332faef25e1
get quoting and arg positions right
Henry S. Thompson <ht@markup.co.uk>
parents:
58
diff
changeset
|
23 |
57
ac1a20e627a9
from lukasz git repo 2020-05-26 (see ~/src/wecu), then editted,
Henry S. Thompson <ht@markup.co.uk>
parents:
diff
changeset
|
24 parallel -v \ |
ac1a20e627a9
from lukasz git repo 2020-05-26 (see ~/src/wecu), then editted,
Henry S. Thompson <ht@markup.co.uk>
parents:
diff
changeset
|
25 --sshloginfile $hosts \ |
ac1a20e627a9
from lukasz git repo 2020-05-26 (see ~/src/wecu), then editted,
Henry S. Thompson <ht@markup.co.uk>
parents:
diff
changeset
|
26 --retries 3 \ |
ac1a20e627a9
from lukasz git repo 2020-05-26 (see ~/src/wecu), then editted,
Henry S. Thompson <ht@markup.co.uk>
parents:
diff
changeset
|
27 --transferfile $(which sac_mapper.py|sed 's/sac_/.\/sac_/') \ |
ac1a20e627a9
from lukasz git repo 2020-05-26 (see ~/src/wecu), then editted,
Henry S. Thompson <ht@markup.co.uk>
parents:
diff
changeset
|
28 --will-cite \ |
ac1a20e627a9
from lukasz git repo 2020-05-26 (see ~/src/wecu), then editted,
Henry S. Thompson <ht@markup.co.uk>
parents:
diff
changeset
|
29 --jobs $cores \ |
ac1a20e627a9
from lukasz git repo 2020-05-26 (see ~/src/wecu), then editted,
Henry S. Thompson <ht@markup.co.uk>
parents:
diff
changeset
|
30 --workdir $wd \ |
ac1a20e627a9
from lukasz git repo 2020-05-26 (see ~/src/wecu), then editted,
Henry S. Thompson <ht@markup.co.uk>
parents:
diff
changeset
|
31 -a input_paths \ |
59
8332faef25e1
get quoting and arg positions right
Henry S. Thompson <ht@markup.co.uk>
parents:
58
diff
changeset
|
32 --env worker \ |
8332faef25e1
get quoting and arg positions right
Henry S. Thompson <ht@markup.co.uk>
parents:
58
diff
changeset
|
33 worker '{}' "$@" | tee -a allout | grep -v 'Authorized uses only' | \ |
8332faef25e1
get quoting and arg positions right
Henry S. Thompson <ht@markup.co.uk>
parents:
58
diff
changeset
|
34 sac_reducer.py "$@" |