Skip to content

Instantly share code, notes, and snippets.

@wvl
Created January 10, 2011 12:32
Show Gist options
  • Save wvl/772719 to your computer and use it in GitHub Desktop.
Save wvl/772719 to your computer and use it in GitHub Desktop.
map reduce with redo: apenwarr #1
[ -n "$OK_TO_STAMP" ] || exit 99
redo-ifchange $1.data
date # make sure the file is nonempty so redo-targets remembers it
filelist()
{
# FIXME: maybe delete .stamp files where the corresponding .data
# has been deleted, before running redo-ood
redo-ood | grep '.stamp$' || true
for d in *.data; do
echo "${d%.data}.stamp"
done | sort >all-targets
redo-targets | sort >known-targets
comm -2 -3 all-targets known-targets
}
targets=$(filelist | sort | uniq)
sh do-reduce $targets
# only stamp them *after* reduce-files succeeds!
OK_TO_STAMP=1 redo-ifchange $targets
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment