-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathrapids-wheels-anaconda
executable file
·75 lines (64 loc) · 1.91 KB
/
rapids-wheels-anaconda
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/bin/bash
# A utility script to upload Python wheel packages to Anaconda repository using anaconda-client.
# Positional Arguments:
# 1) wheel name
# 2) package type (one of: 'cpp', 'python'). If not provided, defaults to 'python' for compatibility with older code where python was the only behavior.
#
# [usage]
#
# # upload any wheels found in CI artifacts with names like '*wheel_python_sparkly-unicorn*.tar.gz'
# rapids-wheels-anaconda 'sparkly-unicorn' 'python'
#
set -eou pipefail
source rapids-constants
export RAPIDS_SCRIPT_NAME="rapids-wheels-anaconda"
if [ -z "$1" ]; then
rapids-echo-stderr "Must specify input arguments: WHEEL_NAME"
exit 1
fi
WHEEL_NAME="$1"
PKG_TYPE="${2:-python}"
case "${PKG_TYPE}" in
cpp)
;;
python)
;;
*)
rapids-echo-stderr 'Pass one of the following package types: "cpp", "python"'
exit 1
;;
esac
WHEEL_SEARCH_KEY="wheel_${PKG_TYPE}_${WHEEL_NAME}"
WHEEL_DIR="./dist"
mkdir -p "${WHEEL_DIR}"
S3_PATH=$(rapids-s3-path)
BUCKET_PREFIX=${S3_PATH/s3:\/\/${RAPIDS_DOWNLOADS_BUCKET}\//} # removes s3://rapids-downloads/ from s3://rapids-downloads/ci/rmm/...
# shellcheck disable=SC2016
WHEEL_TARBALLS=$(
set -eo pipefail;
aws \
--output json \
s3api list-objects \
--bucket "${RAPIDS_DOWNLOADS_BUCKET}" \
--prefix "${BUCKET_PREFIX}" \
--page-size 100 \
--query "Contents[?contains(Key, '${WHEEL_SEARCH_KEY}')].Key" \
| jq -c
)
export WHEEL_TARBALLS
# first untar them all
for OBJ in $(jq -nr 'env.WHEEL_TARBALLS | fromjson | .[]'); do
FILENAME=$(basename "${OBJ}")
S3_URI="${S3_PATH}${FILENAME}"
rapids-echo-stderr "Untarring ${S3_URI} into ${WHEEL_DIR}"
aws s3 cp --only-show-errors "${S3_URI}" - | tar xzf - -C "${WHEEL_DIR}"
done
export RAPIDS_RETRY_SLEEP=180
# shellcheck disable=SC2086
rapids-retry anaconda \
-t "${RAPIDS_CONDA_TOKEN}" \
upload \
--skip-existing \
--no-progress \
"${WHEEL_DIR}"/*.whl
echo ""