Commit 14e3c000 authored by Vincent Pelletier's avatar Vincent Pelletier

Add bash scripts for parallel execution.

parent 7521f4cf
......@@ -2,3 +2,5 @@ include README
include TODO
include COPYING
include apachedex/jquery*.js
include parallel_parse.sh
include parallel_parse_helper.sh
......@@ -170,6 +170,10 @@ For better performance...
wait
apachedex "$@" --out access.html --state-file access.*.json
If you have bash and have an xargs implementation supporting `-P`, you may
want to use `parallel_parse.sh` (which needs `parallel_parse_helper.sh`)
available in source distribution or from repository.
Notes
=====
......
#!/bin/sh
usage() {
echo "Usage:"
echo " find [...] -print0 | $0 \\"
echo " path_to_helper parallelism state_dir out_file command [arg1 [...]]"
echo "Reads filenames to process from stdin, null-delimited."
}
if [ $1 = '-h' -o $1 = '--help' ]; then
usage
exit 0
fi
HELPER=$1
if [ ! -x "$HELPER" ]; then
echo "$HELPER cannot be executed"
exit 1
fi
shift
PARALLELISM=$1
shift
STATE_DIR=$1
mkdir -p "$STATE_DIR" || exit $?
shift
OUT_FILE=$1
shift
if [ $# -eq 0 ]; then
usage
exit 1
fi
xargs -0 -r -n 1 -P $PARALLELISM -I "@FILE@" "$HELPER" "@FILE@" "$STATE_DIR" "$@"
"$@" --out "$OUT_FILE" --state-file "$STATE_DIR"/*
#!/bin/bash
INFILE=$1
shift
STATE_DIR=$1
shift
echo -n '.'
exec "$@" -Q --format json --out "$STATE_DIR/$(sed s:/:@:g <<< "$INFILE").json" "$INFILE"
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment