changeset 281:25d49e1f6c1d default tip

automate a cdb chain
author Henry S. Thompson <ht@inf.ed.ac.uk>
date Wed, 05 Mar 2025 23:29:25 +0000
parents e054fe9403af
children
files bin/cdb_chain.sh bin/cdbp.sh
diffstat 2 files changed, 28 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bin/cdb_chain.sh	Wed Mar 05 23:29:25 2025 +0000
@@ -0,0 +1,15 @@
+#!/usr/bin/bash
+# Chain together n steps of test_cdbp 
+# Usage cdb_chain n
+# First step takes stdin, intermediate steps use FIFOs, last step goes to stdout
+export PYTHONPATH=~/lib/python/cc/lmh
+n=$1
+mkfifo from0
+cat | { cdbp.sh 0 > from0 ; } &
+seq 1 $((n - 2)) | while read i ; do
+ mkfifo from$i
+ cdbp.sh $i < from$((i - 1)) > from$i &
+ rm $from$((i - 1))
+done
+cdbp.sh $((n - 1)) < from$((n - 2))
+rm from$((n - 2))
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bin/cdbp.sh	Wed Mar 05 23:29:25 2025 +0000
@@ -0,0 +1,13 @@
+#!/usr/bin/bash
+# One cdb pipeline step, doing 1/17th of the work
+# Usage: cdbp.sh i
+# where i is the 0-origin index of a 17th, so e.g. cdbp.sh 2 will run 
+#   test_cdbp.py ... ks_%d-%d.cdb 2 3 12 18
+i=$1
+k1=$((i * 6))
+k2=$(((i + 1) * 6))
+k2=$((k2 > 100 ? 100 : k2))
+echo wc -l $(printf ks_%d-%d.cdb $k1 $((k2 - 1))) 1>&2
+wc -l $(printf ks_%d-%d.cdb $k1 $((k2 - 1))) 1>&2
+python3 -c 'import test_cdbp;test_cdbp.mainp()' ks_%d-%d.cdb $i $((i + 1)) $k1 $k2
+