Skip to content

Commit

Permalink
Apply disservin's patches
Browse files Browse the repository at this point in the history
  • Loading branch information
linrock committed Dec 12, 2023
1 parent 7f002ad commit a026f44
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
3 changes: 3 additions & 0 deletions docker/worker/compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@ services:
restart: no
build:
dockerfile: ./Dockerfile
stop_grace_period: 1m30s
container_name: fishtest-worker
image: fishtest-worker
stdin_open: true # docker run -i
tty: true # docker run -t
environment:
- NUM_WORKERS
- WORKER_ARGS
22 changes: 20 additions & 2 deletions docker/worker/run_workers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,29 @@ git clone \
https://github.com/official-stockfish/fishtest \
~/fishtest

worker_pids=()

cleanup_workers() {
echo "Cleaning up workers..."
for pid in "${worker_pids[@]}"; do
echo "Killing worker $pid"
kill -s SIGINT "$pid"
tail --pid=$pid -f /dev/null
done
echo "Workers cleaned up."
exit
}

trap 'cleanup_workers' SIGTERM
trap 'cleanup_workers' SIGINT


for worker in $(seq 1 $NUM_WORKERS); do
worker_dir=~/worker$worker
cp -r fishtest $worker_dir
cd $worker_dir/worker
cp -r fishtest "$worker_dir"
cd "$worker_dir/worker"
python3 worker.py $WORKER_ARGS &
worker_pids+=($!)
cd ~
done

Expand Down

0 comments on commit a026f44

Please sign in to comment.