Skip to content

Commit 0397c84

Browse files
authored
remove dataset from Dockerfile.ci (#2088)
* remove dataset from Dockerfile.ci * fix ci * add set -e * debug ci
1 parent 9a86d1c commit 0397c84

File tree

7 files changed

+48
-29
lines changed

7 files changed

+48
-29
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ share/python-wheels/
3939
MANIFEST
4040
*.ckpt
4141
elasticdl/go/bin/elasticdl_ps
42+
data/
4243

4344
# PyInstaller
4445
# Usually these files are written by a python script from a template

.travis.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,13 @@ jobs:
7979
- docker build --target ci -t elasticdl:ci
8080
-f elasticdl/docker/Dockerfile.ci
8181
--build-arg BASE_IMAGE="$BASE_IMAGE" .
82+
- mkdir -p data && docker run --rm -it --net=host
83+
-v $HOME/.cache:/root/.cache
84+
-v $HOME/.keras/datasets:/root/.keras/datasets
85+
-v $HOME/.kube:/root/.kube
86+
-v $HOME/.minikube:/home/$USER/.minikube
87+
-v $PWD:/work -w /work
88+
elasticdl:dev bash -c "scripts/travis/gen_dataset.sh data"
8289
- |
8390
JOB_TYPES=(
8491
odps
@@ -87,7 +94,7 @@ jobs:
8794
predict
8895
)
8996
for JOB_TYPE in "${JOB_TYPES[@]}"; do
90-
bash scripts/travis/run_job.sh $JOB_TYPE
97+
bash scripts/travis/run_job.sh $JOB_TYPE $PWD/data
9198
done
9299
93100
# Only build on this list of branches

elasticdl/docker/Dockerfile.ci

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -7,27 +7,6 @@ WORKDIR /
77
COPY elasticdl/docker/bashrc /etc/bash.bashrc
88
RUN chmod a+rx /etc/bash.bashrc
99

10-
# Generate data
11-
# This assumes that the data generation package is independent with the
12-
# rest part of ElasticDL. The generated data will be in /data.
13-
RUN pip install pyrecordio>=0.0.6 && pip install sklearn && pip install pandas
14-
COPY elasticdl/python/data/recordio_gen/image_label.py /var/image_label.py
15-
RUN python /var/image_label.py --dataset mnist --fraction 0.15 \
16-
--records_per_shard 4096 /data
17-
18-
# Copy frappe dataset
19-
COPY elasticdl/python/data/recordio_gen/frappe_recordio_gen.py \
20-
/var/frappe_recordio_gen.py
21-
RUN python /var/frappe_recordio_gen.py --data /root/.keras/datasets \
22-
--output_dir /data/frappe \
23-
--fraction 0.05
24-
# Copy heart dataset
25-
COPY elasticdl/python/data/recordio_gen/heart_recordio_gen.py \
26-
/var/heart_recordio_gen.py
27-
RUN python /var/heart_recordio_gen.py --data_dir /root/.keras/datasets \
28-
--output_dir /data/heart
29-
30-
3110
# Copy model zoo
3211
COPY model_zoo /model_zoo
3312
RUN python -m pip install --quiet -r /model_zoo/requirements.txt \
@@ -55,5 +34,5 @@ RUN python -m pip install --quiet /elasticdl-develop-py3-none-any.whl \
5534
ENV PATH /usr/local/lib/python3.6/dist-packages/elasticdl/go/bin:$PATH
5635

5736
# Generate mnist checkpoint for evaluation and prediction
58-
COPY scripts/gen_mnist_checkpoint.py /gen_mnist_checkpoint.py
37+
COPY scripts/travis/gen_mnist_checkpoint.py /gen_mnist_checkpoint.py
5938
RUN python /gen_mnist_checkpoint.py --checkpoint_dir=/model_zoo/test_data/mnist_ckpt

scripts/client_test.sh

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@
1717
JOB_TYPE=$1
1818
PS_NUM=$2
1919
WORKER_NUM=$3
20+
DATA_PATH=$4
2021

2122
MNIST_CKPT_DIR=/model_zoo/test_data/mnist_ckpt/
2223

23-
2424
if [[ "$JOB_TYPE" == "train" ]]; then
2525
elasticdl train \
2626
--image_name=elasticdl:ci \
@@ -47,8 +47,8 @@ if [[ "$JOB_TYPE" == "train" ]]; then
4747
--job_name=test-train \
4848
--log_level=INFO \
4949
--image_pull_policy=Never \
50-
--output=/saved_model/model_output \
51-
--volume="host_path=${PWD},mount_path=/saved_model"
50+
--output=/data/saved_model/model_output \
51+
--volume="host_path=${DATA_PATH},mount_path=/data"
5252
elif [[ "$JOB_TYPE" == "evaluate" ]]; then
5353
elasticdl evaluate \
5454
--image_name=elasticdl:ci \
@@ -71,7 +71,8 @@ elif [[ "$JOB_TYPE" == "evaluate" ]]; then
7171
--tensorboard_log_dir=/tmp/tensorboard-log \
7272
--job_name=test-evaluate \
7373
--log_level=INFO \
74-
--image_pull_policy=Never
74+
--image_pull_policy=Never \
75+
--volume="host_path=${DATA_PATH},mount_path=/data"
7576
elif [[ "$JOB_TYPE" == "predict" ]]; then
7677
elasticdl predict \
7778
--image_name=elasticdl:ci \
@@ -91,7 +92,8 @@ elif [[ "$JOB_TYPE" == "predict" ]]; then
9192
--num_ps_pods="$PS_NUM" \
9293
--job_name=test-predict \
9394
--log_level=INFO \
94-
--image_pull_policy=Never
95+
--image_pull_policy=Never \
96+
--volume="host_path=${DATA_PATH},mount_path=/data"
9597
elif [[ "$JOB_TYPE" == "odps" ]]; then
9698
elasticdl train \
9799
--image_name=elasticdl:ci \

scripts/travis/gen_dataset.sh

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/usr/bin/env bash
2+
# Copyright 2020 The ElasticDL Authors. All rights reserved.
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
# Generate mnist dataset
16+
DATA_PATH=$1
17+
18+
python elasticdl/python/data/recordio_gen/image_label.py --dataset mnist --fraction 0.15 \
19+
--records_per_shard 4096 "$DATA_PATH"
20+
21+
# Generate frappe dataset
22+
python elasticdl/python/data/recordio_gen/frappe_recordio_gen.py --data /root/.keras/datasets \
23+
--output_dir "$DATA_PATH"/frappe --fraction 0.05
24+
25+
# Generate heart dataset
26+
python elasticdl/python/data/recordio_gen/heart_recordio_gen.py --data_dir /root/.keras/datasets \
27+
--output_dir "$DATA_PATH"/heart

scripts/travis/run_job.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
set -e
16+
1517
JOB_TYPE=$1
18+
DATA_PATH=$2
1619
MAXCOMPUTE_TABLE="odps_integration_build_$TRAVIS_BUILD_NUMBER_$(date +%s)"
1720

1821
if [[ "$JOB_TYPE" == "odps" ]] && \
@@ -38,7 +41,7 @@ else
3841
-v /home/"$USER"/.minikube/:/home/"$USER"/.minikube/ \
3942
-v "$PWD":/work \
4043
-w /work elasticdl:ci \
41-
bash -c "scripts/client_test.sh $JOB_TYPE $PS_NUM $WORKER_NUM"
44+
bash -c "scripts/client_test.sh $JOB_TYPE $PS_NUM $WORKER_NUM $DATA_PATH"
4245
python3 scripts/validate_job_status.py "$JOB_TYPE" "$PS_NUM" "$WORKER_NUM"
4346
if [[ "$JOB_TYPE" == "odps" ]]; then
4447
bash scripts/travis/cleanup_odps_table.sh

0 commit comments

Comments
 (0)