-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathloadlsststack.sh
More file actions
executable file
·35 lines (24 loc) · 946 Bytes
/
Copy pathloadlsststack.sh
File metadata and controls
executable file
·35 lines (24 loc) · 946 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/bin/bash
set -xeo pipefail
ROOT_DIR="$(dirname "$(pwd)")"
LSSTSW_DIR="${ROOT_DIR}/lsstsw"
GCP_BUCKET="gs://eups-lsstsw-cache"
TMP_FOLDER="/tmp/lsstswcache"
fail() {
echo "$1" >&2
exit 1
}
[[ $# -eq 0 ]] && fail "No tag was passed"
DATE_TAG=$1
ARCH_VER=$(uname -m)
TARGET="${DATE_TAG}_${ARCH_VER}_lsstsw.tar.zst"
mkdir -p "${TMP_FOLDER}"
gcloud storage ls "${GCP_BUCKET}/${TARGET}" || fail "failed file or tag doesn't exist"
cd "${ROOT_DIR}" || fail "Can't find ${ROOT_DIR}"
gcloud storage cp "${GCP_BUCKET}/${TARGET}" "${TARGET}" || fail "Download failed"
tar -I "zstd -T0" -xf "${TARGET}" --checkpoint=500000 || fail "Extraction failed"
[[ -d "$LSSTSW_DIR" ]] || fail "Can't find lsstsw dir"
[[ -d "$LSSTSW_DIR/miniconda" ]] || fail "Can't find miniconda dir"
[[ -d "$LSSTSW_DIR/stack" ]] || fail "Can't find stack dir"
rm "${TARGET}" || fail "Couldn't delete artifact"
cd "${LSSTSW_DIR}" || fail "Can't find ${LSSTSW_DIR}"