-
Notifications
You must be signed in to change notification settings - Fork 184
/
conda-build-docker.sh
executable file
·240 lines (212 loc) · 8.17 KB
/
conda-build-docker.sh
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
#!/bin/bash
# ================================================================
# NOTE
# cpu-build:
# - here we run conda build inside the docker container
# - builds the artifacts
# - but doesn't run any test
# - it just needs CPU
# - and it runs on top on gpuci/rapidsai-driver docker image
# - https://gpuci.gpuopenanalytics.com/job/blazingsql/job/gpuci/job/pyblazing/job/prb/job/pyblazing-cpu-build/
# ================================================================
# NOTE
# gpu-build:
# - here we install a new conda dev env inside the docker container
# - builds the artifacts
# - and run any all the tests: unit tests and e2e
# - it needs GPU
# - it runs on top on gpuci/rapidsai docker image
# - https://gpuci.gpuopenanalytics.com/job/blazingsql/job/gpuci/job/pyblazing/job/prb/job/pyblazing-gpu-build/
# ================================================================
# NOTE Examples:
# Run GPUCI jobs (first the gpu-build and then the cpu-build):
# ./conda-build-docker.sh cudf_version cuda_version python_version conda_token conda_username custom_label
#
# Run only the CPU BUILD job (use this one if you want to debug issues with conda build on gpuci)
# BLAZING_GPUCI_JOB=cpu-build ./conda-build-docker.sh cudf_version cuda_version python_version conda_token conda_username custom_label
#
# Run only the GPU BUILD job (use this one if you want to debug issues with tests on gpuci/gpu build)
# BLAZING_GPUCI_JOB=gpu-build ./conda-build-docker.sh cudf_version cuda_version python_version
#
# Run only the CPU BUILD job and upload the blazingsql package to your conda channel with the label main
# BLAZING_GPUCI_JOB=cpu-build ./conda-build-docker.sh 0.18 10.2 3.7 conda_token main conda_username
#
# Run GPUCI jobs with defaults:
# ./conda-build-docker.sh
# ================================================================
# NOTE Defaults:
# cudf_version=0.18
# cuda_version=10.2
# python_version=3.7
# conda_token=""
# conda_username="blazingsql-nightly"
# custom_label=""
# ================================================================
# NOTE Remarks:
# - In case a job fails then you will go automatically into the docker for debugging
# - Don't forget to kill all the containers after you finish
# ================================================================
NUMARGS=$#
ARGS=$*
VALIDARGS="-h"
HELP="# ================================================================
# NOTE
# cpu-build:
# - here we run conda build inside the docker container
# - builds the artifacts
# - but doesn't run any test
# - it just needs CPU
# - and it runs on top on gpuci/rapidsai-driver docker image
# - https://gpuci.gpuopenanalytics.com/job/blazingsql/job/gpuci/job/pyblazing/job/prb/job/pyblazing-cpu-build/
# ================================================================
# NOTE
# gpu-build:
# - here we install a new conda dev env inside the docker container
# - builds the artifacts
# - and run any all the tests: unit tests and e2e
# - it needs GPU
# - it runs on top on gpuci/rapidsai docker image
# - https://gpuci.gpuopenanalytics.com/job/blazingsql/job/gpuci/job/pyblazing/job/prb/job/pyblazing-gpu-build/
# ================================================================
# NOTE Examples:
# Run GPUCI jobs (first the gpu-build and then the cpu-build):
# ./conda-build-docker.sh cudf_version cuda_version python_version conda_token custom_label conda_username
#
# Run only the CPU BUILD job (use this one if you want to debug issues with conda build on gpuci)
# BLAZING_GPUCI_JOB=cpu-build ./conda-build-docker.sh cudf_version cuda_version python_version conda_token custom_label conda_username
#
# Run only the GPU BUILD job (use this one if you want to debug issues with tests on gpuci/gpu build)
# BLAZING_GPUCI_JOB=gpu-build ./conda-build-docker.sh cudf_version cuda_version python_version
#
# Run only the CPU BUILD job and upload the blazingsql package to your conda channel with the label main
# BLAZING_GPUCI_JOB=cpu-build ./conda-build-docker.sh 0.18 10.2 3.7 conda_token main conda_username
#
# Run GPUCI jobs with defaults:
# ./conda-build-docker.sh
# ================================================================
# NOTE Defaults:
# cudf_version=0.18
# cuda_version=10.2
# python_version=3.7
# conda_token=""
# custom_label=""
# conda_username="blazingsql-nightly"
# ================================================================
# NOTE Remarks:
# - In case a job fails then you will go automatically into the docker for debugging
# - Don't forget to kill all the containers after you finish
# ================================================================"
function hasArg {
(( ${NUMARGS} != 0 )) && (echo " ${ARGS} " | grep -q " $1 ")
}
if hasArg -h; then
echo "${HELP}"
exit 0
fi
# Logger function for build status output
function logger() {
echo -e "\n>>>> $@\n"
}
export WORKSPACE=$PWD
if [ -z $BLAZING_GPUCI_JOB ]; then
BLAZING_GPUCI_JOB=""
echo "BLAZING_GPUCI_JOB: $BLAZING_GPUCI_JOB"
fi
if [ -z $BLAZING_GPUCI_OS ]; then
BLAZING_GPUCI_OS="ubuntu16.04"
echo "BLAZING_GPUCI_OS: $BLAZING_GPUCI_OS"
fi
CUDF_VERSION="0.18"
if [ ! -z $1 ]; then
CUDF_VERSION=$1
fi
echo "CUDF_VERSION: $CUDF_VERSION"
CUDA_VERSION="10.2"
if [ ! -z $2 ]; then
CUDA_VERSION=$2
fi
echo "CUDA_VERSION: $CUDA_VERSION"
PYTHON_VERSION="3.7"
if [ ! -z $3 ]; then
PYTHON_VERSION=$3
fi
echo "PYTHON_VERSION: $PYTHON_VERSION"
#USER=$(id -u):$(id -g)
USER="0:0"
echo "USER: $USER"
if [ "$BLAZING_GPUCI_JOB" = "" ] || [ "$BLAZING_GPUCI_JOB" = "cpu-build" ]; then
MY_UPLOAD_KEY=""
UPLOAD_BLAZING="0"
if [ ! -z $4 ]; then
MY_UPLOAD_KEY=$4
UPLOAD_BLAZING=1
fi
echo "MY_UPLOAD_KEY: ${MY_UPLOAD_KEY:(-4)}"
echo "UPLOAD_BLAZING: $UPLOAD_BLAZING"
CONDA_USERNAME="blazingsql-nightly"
if [ ! -z $5 ]; then
CONDA_USERNAME=$5
fi
echo "CONDA_USERNAME: $CONDA_USERNAME"
TYPE="nightly"
if [ ! -z $6 ]; then
TYPE=$6
fi
echo "TYPE: $TYPE"
CUSTOM_LABEL=""
if [ ! -z $7 ]; then
CUSTOM_LABEL=$7
fi
echo "CUSTOM_LABEL: $CUSTOM_LABEL"
fi
if [ "$BLAZING_GPUCI_JOB" = "" ] || [ "$BLAZING_GPUCI_JOB" = "gpu-build" ]; then
logger "Cleaning the workspace before start the GPU BUILD job ..."
cd $WORKSPACE
./build.sh clean
./build.sh clean thirdparty
gpu_build_cmd="./ci/gpu/build.sh"
gpu_build_img=gpuci/rapidsai:$CUDF_VERSION-cuda${CUDA_VERSION}-devel-$BLAZING_GPUCI_OS-py$PYTHON_VERSION
logger "Updating the docker image for the GPU BUILD job ..."
echo "docker pull $gpu_build_img"
docker pull $gpu_build_img
gpu_container="blazingsql-gpuci-gpu-build-"$RANDOM
logger "Running the docker container for the GPU BUILD job ..."
GPU_DOCKER="docker run --name $gpu_container --rm \
--runtime=nvidia \
-u $USER \
-e CUDA_VER=${CUDA_VERSION} -e PYTHON_VER=$PYTHON_VERSION \
-e WORKSPACE=$WORKSPACE \
-v /etc/passwd:/etc/passwd \
-v ${WORKSPACE}:${WORKSPACE} -w ${WORKSPACE} \
$gpu_build_img \
$gpu_build_cmd"
echo "GPU_DOCKER: "$GPU_DOCKER
eval $GPU_DOCKER
fi
if [ "$BLAZING_GPUCI_JOB" = "" ] || [ "$BLAZING_GPUCI_JOB" = "cpu-build" ]; then
logger "Cleaning the workspace before start the CPU BUILD job ..."
cd $WORKSPACE
./build.sh clean
./build.sh clean thirdparty
#cpu_build_cmd="bash"
cpu_build_cmd="./ci/cpu/build.sh"
cpu_build_img=gpuci/rapidsai-driver:$CUDF_VERSION-cuda${CUDA_VERSION}-devel-$BLAZING_GPUCI_OS-py$PYTHON_VERSION
logger "Updating the docker image for the CPU BUILD job ..."
echo "docker pull $cpu_build_img"
docker pull $cpu_build_img
cpu_container="blazingsql-gpuci-cpu-build-"$RANDOM
logger "Running the docker container for the CPU BUILD job ..."
CPU_DOCKER="docker run --name $cpu_container --rm \
-u $USER \
-e CUDA_VER=${CUDA_VERSION} -e PYTHON_VER=$PYTHON_VERSION \
-e CONDA_USERNAME=$CONDA_USERNAME -e MY_UPLOAD_KEY=$MY_UPLOAD_KEY \
-e BUILD_MODE=branch -e TYPE=$TYPE \
-e UPLOAD_BLAZING=$UPLOAD_BLAZING -e CUSTOM_LABEL=$CUSTOM_LABEL \
-e WORKSPACE=$WORKSPACE \
-v /etc/passwd:/etc/passwd \
-v ${WORKSPACE}:${WORKSPACE} -w ${WORKSPACE} \
$cpu_build_img \
$cpu_build_cmd"
echo "CPU_DOCKER: "$CPU_DOCKER
eval $CPU_DOCKER
fi