From e2d51a87f0727f8537b46048d8241aeebb6e48d6 Mon Sep 17 00:00:00 2001 From: Xiaoqiang Zheng Date: Fri, 28 Oct 2016 10:29:28 -0800 Subject: Merge changes from github. Change: 137532946 --- tensorflow/tools/dist_test/build_server.sh | 39 ++++++++++++++++++----- tensorflow/tools/dist_test/server/Dockerfile | 7 ++-- tensorflow/tools/dist_test/server/Dockerfile.test | 7 ++-- 3 files changed, 39 insertions(+), 14 deletions(-) (limited to 'tensorflow/tools/dist_test') diff --git a/tensorflow/tools/dist_test/build_server.sh b/tensorflow/tools/dist_test/build_server.sh index 178fba8065..878fabd248 100755 --- a/tensorflow/tools/dist_test/build_server.sh +++ b/tensorflow/tools/dist_test/build_server.sh @@ -16,7 +16,14 @@ # # Builds the test server for distributed (GRPC) TensorFlow # -# Usage: build_server.sh [--test] +# Usage: build_server.sh [--test] +# +# Arguments: +# docker_image_name: Name of the docker image to build. +# E.g.: tensorflow/tf_grpc_test_server:0.11.0rc1 +# +# whl_url: URL from which the TensorFlow whl file will be downloaded. +# E.g.: https://ci.tensorflow.org/view/Nightly/job/nightly-matrix-cpu/TF_BUILD_IS_OPT=OPT,TF_BUILD_IS_PIP=PIP,TF_BUILD_PYTHON_VERSION=PYTHON2,label=cpu-slave/lastSuccessfulBuild/artifact/pip_test/whl/tensorflow-0.11.0rc1-cp27-none-linux_x86_64.whl # # The optional flag --test lets the script to use the Dockerfile for the # testing GRPC server. Without the flag, the script will build the non-test @@ -33,22 +40,35 @@ die() { } # Check arguments -if [[ $# != 1 ]] && [[ $# != 2 ]]; then - die "Usage: $0 [--test]" +if [[ $# -lt 2 ]]; then + die "Usage: $0 [--test]" fi DOCKER_IMG_NAME=$1 -shift +WHL_URL=$2 +shift 2 # Current script directory DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -DOCKER_FILE="${DIR}/server/Dockerfile" +BUILD_DIR=$(mktemp -d) +echo "" +echo "Using whl file URL: ${WHL_URL}" +echo "Building in temporary directory: ${BUILD_DIR}" + +cp -r ${DIR}/* "${BUILD_DIR}"/ || \ + die "Failed to copy files to ${BUILD_DIR}" + +DOCKER_FILE="${BUILD_DIR}/server/Dockerfile" if [[ $1 == "--test" ]]; then - DOCKER_FILE="${DIR}/server/Dockerfile.test" + DOCKER_FILE="${BUILD_DIR}/server/Dockerfile.test" fi echo "Using Docker file: ${DOCKER_FILE}" +# Download whl file into the build context directory. +wget -P "${BUILD_DIR}" ${WHL_URL} || \ + die "Failed to download tensorflow whl file from URL: ${WHL_URL}" + if [[ ! -f "${DOCKER_FILE}" ]]; then die "ERROR: Unable to find dockerfile: ${DOCKER_FILE}" fi @@ -56,5 +76,8 @@ echo "Dockerfile: ${DOCKER_FILE}" # Call docker build docker build --no-cache -t "${DOCKER_IMG_NAME}" \ - -f "${DOCKER_FILE}" \ - "${DIR}" + -f "${DOCKER_FILE}" "${BUILD_DIR}" || \ + die "Failed to build docker image: ${DOCKER_IMG_NAME}" + +# Clean up docker build context directory. +rm -rf "${BUILD_DIR}" diff --git a/tensorflow/tools/dist_test/server/Dockerfile b/tensorflow/tools/dist_test/server/Dockerfile index 9cc61a826b..4b13b814e3 100644 --- a/tensorflow/tools/dist_test/server/Dockerfile +++ b/tensorflow/tools/dist_test/server/Dockerfile @@ -34,9 +34,10 @@ RUN curl -O https://bootstrap.pypa.io/get-pip.py && \ python get-pip.py && \ rm get-pip.py -# Install TensorFlow CPU version from nightly build -RUN pip --no-cache-dir install \ - https://ci.tensorflow.org/view/Nightly/job/nightly-matrix-cpu/TF_BUILD_IS_OPT=OPT,TF_BUILD_IS_PIP=PIP,TF_BUILD_PYTHON_VERSION=PYTHON2,label=cpu-slave/lastSuccessfulBuild/artifact/pip_test/whl/tensorflow-0.11.0rc0-cp27-none-linux_x86_64.whl +# Install TensorFlow wheel +COPY tensorflow-*.whl / +RUN pip install /tensorflow-*.whl && \ + rm -f /tensorflow-*.whl # Copy files, including the GRPC server binary at # server/grpc_tensorflow_server.py diff --git a/tensorflow/tools/dist_test/server/Dockerfile.test b/tensorflow/tools/dist_test/server/Dockerfile.test index 5bafa29468..22438f3984 100644 --- a/tensorflow/tools/dist_test/server/Dockerfile.test +++ b/tensorflow/tools/dist_test/server/Dockerfile.test @@ -40,9 +40,10 @@ RUN curl -O https://bootstrap.pypa.io/get-pip.py && \ # Install python panda for the census wide&deep test RUN pip install --upgrade pandas==0.18.1 -# Install TensorFlow CPU version. -RUN pip --no-cache-dir install \ - https://ci.tensorflow.org/view/Nightly/job/nightly-matrix-cpu/TF_BUILD_IS_OPT=OPT,TF_BUILD_IS_PIP=PIP,TF_BUILD_PYTHON_VERSION=PYTHON2,label=cpu-slave/lastSuccessfulBuild/artifact/pip_test/whl/tensorflow-0.11.0rc0-cp27-none-linux_x86_64.whl +# Install TensorFlow wheel +COPY tensorflow-*.whl / +RUN pip install /tensorflow-*.whl && \ + rm -f /tensorflow-*.whl # Copy files, including the GRPC server binary at # server/grpc_tensorflow_server.py -- cgit v1.2.3