#!/usr/bin/env bash
# hr_stop.sh TAG -- save the engine log, stop OUR container hr-TAG, drop the flat-weights dump, copy census cells.
W=$HOME/headroute; O=$W/out/$1
docker logs hr-$1 > $O/engine.log 2>&1; docker stop -t 60 hr-$1 >/dev/null; docker rm -f hr-$1 >/dev/null
cp $W/cache/s3c/cells.*.json $O/ 2>/dev/null; rm -f $W/cache/s3c/cells.*.json
rm -rf $W/cache/arbi-serve/flat-weights; echo "$1 stopped; root $(df --output=pcent / | tail -1 | tr -dc 0-9)%"
