Skip to content
This repository has been archived by the owner on Dec 6, 2023. It is now read-only.

Commit

Permalink
even safer traps
Browse files Browse the repository at this point in the history
  • Loading branch information
casperdcl committed Oct 23, 2023
1 parent e7b98ee commit fc96cf8
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions cht-petals/setup-petals.sh
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
#!/usr/bin/env bash
# Usage: setup-petals.sh [--model-path=<DIR>] [--dht-prefix=<PREFIX>] [--port=<INT>]
set -eEuo pipefail

tmpdir="${PREM_APPDIR:-.}/$(uuid)"
tmpdir="${PREM_APPDIR:-.}/petals-$(uuid)"

cleanup(){
for i in $(jobs -p); do
kill -n 9 $i
kill -n 9 $i || :
done
rm -rf "$tmpdir"
exit 0
}

trap "cleanup" SIGTERM
trap "cleanup" SIGINT
trap "cleanup" ERR

# clone source
git clone -n --depth=1 --filter=tree:0 https://github.com/premAI-io/prem-services.git "$tmpdir"
Expand Down

0 comments on commit fc96cf8

Please sign in to comment.