Skip to content

Commit

Permalink
uninstall dataclasses if python version is >= 3.7.x
Browse files Browse the repository at this point in the history
dup image hash check

build ray-ml

uninstall dataclasses in the last docker image

build whl

remove GPU tag and dataclasses uninstall patch
ray-project#10909
ray-project#10936
  • Loading branch information
Leemoonsoo committed Oct 3, 2020
1 parent a386c05 commit 8f4809a
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 10 deletions.
24 changes: 21 additions & 3 deletions .staroid/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ SHORT_VER=`echo $PYTHON_VERSION | sed "s/\([0-9]*\)[.]\([0-9]*\)[.][0-9]*/\1\2/g

# true to build .whl from source (will take about 3 hours).
# false to use pre-built whl file from http(s) url.
BUILD_WHEEL=${BUILD_WHEEL:-false}
BUILD_WHEEL=${BUILD_WHEEL:-true}

if [ "$BUILD_WHEEL" == "true" ]; then
if [ ! -d ".whl" ]; then # check if already built.
Expand Down Expand Up @@ -54,16 +54,34 @@ fi
# print patched files
git diff

cat docker/ray/Dockerfile
cat docker/base-deps/Dockerfile
cat docker/ray-deps/Dockerfile
cat docker/ray/Dockerfile
cat docker/ray-ml/Dockerfile

# cp requirements to ray-ml dir
cp python/requirements* docker/ray-ml

# build docker image
./build-docker.sh --no-cache-build --gpu --python-version $PYTHON_VERSION

# print images
docker tag rayproject/ray:latest-gpu $IMAGE
docker tag rayproject/ray-ml:latest-gpu $IMAGE
docker images

# verify image hash are all different.
# In case of a parent image build fail,
# 'FROM ...' command child image will pull from internet instead of using local build,
# and child image bulid will success without error.
# In this case, multiple image may end up with the same image hash.
UNIQ_IMAGES=`docker images | grep ray-py | awk '{print $3}' | uniq | wc -l`
NUM_IMAGES=`docker images | grep ray-py | awk '{print $3}' | wc -l`

if [ "$NUM_IMAGES" != "$UNIQ_IMAGES" ]; then
echo "Error. Duplicated image hash found."
exit 1
fi

if $PUSH_IMAGE; then
docker push $IMAGE
fi
8 changes: 4 additions & 4 deletions .staroid/k8s/ray.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
apiVersion: v1
kind: Service
metadata:
name: ray-dashboard
name: dashboard
annotations:
service.staroid.com/link: "show"
spec:
ports:
- name: ray-dashboard
- name: dashboard
port: 8265
selector:
component: ray-head
Expand Down Expand Up @@ -40,5 +40,5 @@ spec:
image: ray-py3-7-7 # skaffold adds postfix
- name: ray-py3-6-9
image: ray-py3-6-9
- name: ray-py-3-8-3
image: ray-py-3-8-3
- name: ray-py3-8-3
image: ray-py3-8-3
5 changes: 3 additions & 2 deletions .staroid/ray_patch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ if [ "$OP" == "patch" ]; then
$SED_INPLACE "s|^WHEEL_URL=.*|WHEEL_URL=\"$WHEEL\"|g" $RAY_HOME/build-docker.sh
fi

# patch GPU tag https://github.com/ray-project/ray/pull/10909
$SED_INPLACE "s/:latest/:latest\$GPU/g" $RAY_HOME/build-docker.sh
# build ray-ml
$SED_INPLACE "s/\"ray-deps\" \"ray\"/\"ray-deps\" \"ray\" \"ray-ml\"/g" $RAY_HOME/build-docker.sh

# patch PATH
$SED_INPLACE "s/\/root/\/home\/ray/g" ${RAY_HOME}/docker/base-deps/Dockerfile
Expand All @@ -55,6 +55,7 @@ if [ "$OP" == "patch" ]; then
# patch rm
$SED_INPLACE "s/ rm / sudo rm /g" ${RAY_HOME}/docker/ray-deps/Dockerfile
$SED_INPLACE "s/ rm / sudo rm /g" ${RAY_HOME}/docker/ray/Dockerfile
$SED_INPLACE "s/ rm / sudo rm /g" ${RAY_HOME}/docker/ray-ml/Dockerfile

# Add ray user & install sudo
# lines until 'ARG DEBIAN_FRONTNED ...'
Expand Down
2 changes: 1 addition & 1 deletion .staroid/skaffold.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ build:
context: .
custom:
buildCommand: .staroid/build.sh 3.6.9
- image: ray-py-3-8-3
- image: ray-py3-8-3
context: .
custom:
buildCommand: .staroid/build.sh 3.8.3
Expand Down

0 comments on commit 8f4809a

Please sign in to comment.