python - GNU Parallel to replace piping xargs -n 1 -
i have python script operates on list of state abbreviations single argument, , text file contains state abbreviation strings.
the normal call is...
$ mypy.py "ak"
...to run script on alaska.
i'm using following run script on each state abbreviation taken statelist.txt file:
$ cat statelist.txt | xargs -n 1 ./mypy.py
i parallelize execution, , gnu parallels looks right option. saw from here should syntax replacing xargs -n1
:
$ find . -name '*.html' | parallel gzip --best
so, attempts were
$ cat statelist.txt | parallel python mypy.py
and
$ cat statelist.txt | parallel python mypy.py {}
but both of these returning:
/bin/bash: mypy.py: command not found traceback (most recent call last): file "<stdin>", line 1, in <module> nameerror: name 'ak' not defined
it seems passing in unquoted perhaps? when add quotes '{}' passes in literal "{}".
cat statelist.txt | parallel --gnu python mypy.py
without --gnu
, gnu parallel may choose emulate older tool same name (tollef's parallel). --tollef
default behavior on many distros, , why otherwise valid gnu style invocation fails.
ps: chances xargs
had -c
or -p
parallelization too.
Comments
Post a Comment