Skip to content

Commit 2105bc6

Browse files
committed
make tpu tensorflow build conditional
1 parent b22de75 commit 2105bc6

File tree

6 files changed

+25
-13
lines changed

6 files changed

+25
-13
lines changed

Jenkinsfile

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,22 @@ pipeline {
5656
'''
5757
}
5858
}
59+
stage('tensorflow TPU') {
60+
options {
61+
timeout(time: 180, unit: 'MINUTES')
62+
}
63+
steps {
64+
sh '''#!/bin/bash
65+
set -exo pipefail
66+
source tpu/config.txt
67+
cd packages/
68+
./build_package --base-image gcr.io/kaggle-images/python:${BASE_IMAGE_TAG} \
69+
--package tpu-tensorflow \
70+
--version $TENSORFLOW_VERSION \
71+
--push
72+
'''
73+
}
74+
}
5975
}
6076
}
6177
stage('Build/Test/Diff') {
@@ -155,7 +171,7 @@ pipeline {
155171
stages {
156172
stage('Build Tensorflow TPU Image') {
157173
options {
158-
timeout(time: 120, unit: 'MINUTES')
174+
timeout(time: 20, unit: 'MINUTES')
159175
}
160176
steps {
161177
sh '''#!/bin/bash

packages/build_package

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,8 @@ fi
117117

118118
# Keep only `tf2-gpu.2-6:m80` in `gcr.io/deeplearning-platform-release/tf2-gpu.2-6:m80`
119119
TAG=${BASE_IMAGE/gcr.io\/deeplearning-platform-release\//}
120+
# Keep only `python:v108` in `gcr.io/kaggle-images/python:v108`
121+
TAG=${TAG/gcr.io\/kaggle-images\//}
120122
# Replace the `:` in `tf2-gpu.2-6:m80` by `-`
121123
TAG=${TAG/:/-}
122124
# Append the package version

packages/tpu-tensorflow.Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
ARG BASE_IMAGE_TAG
1+
ARG BASE_IMAGE
22

3-
FROM gcr.io/kaggle-images/python:${BASE_IMAGE_TAG} AS builder
3+
FROM ${BASE_IMAGE} AS builder
44

55
ARG PACKAGE_VERSION
66

@@ -14,7 +14,7 @@ RUN cd /usr/local/src && \
1414
RUN cd /usr/local/src && \
1515
git clone https://github.com/tensorflow/tensorflow && \
1616
cd tensorflow && \
17-
git checkout tags/v${TENSORFLOW_VERSION} && \
17+
git checkout tags/v${PACKAGE_VERSION} && \
1818
# TODO(rosbo): Is it really needed?
1919
pip install keras_applications --no-deps && \
2020
pip install keras_preprocessing --no-deps

tpu/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
ARG BASE_IMAGE_TAG
22
ARG LIBTPU_IMAGE_TAG
3-
ARG TENSORFLOW_WHL_IMAGE_TAG
3+
ARG TENSORFLOW_VERSION
44

55
FROM gcr.io/cloud-tpu-v2-images/libtpu:${LIBTPU_IMAGE_TAG} as libtpu
6-
FROM gcr.io/kaggle-images/python-tpu-tensorflow-whl:${TENSORFLOW_WHL_IMAGE_TAG} AS tensorflow_whl
6+
FROM gcr.io/kaggle-images/python-tpu-tensorflow-whl:python-${BASE_IMAGE_TAG}-${TENSORFLOW_VERSION} AS tensorflow_whl
77
FROM gcr.io/kaggle-images/python:${BASE_IMAGE_TAG}
88

99
ENV ISTPUVM=1

tpu/build

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ EOF
1212
}
1313

1414
CACHE_FLAG='--no-cache'
15-
TENSORFLOW_DOCKERFILE='tensorflow.Dockerfile'
16-
TENSORFLOW_IMAGE_TAG='kaggle/python-tpuvm-tensorflow-build'
1715
DOCKERFILE='Dockerfile'
1816
IMAGE_TAG='kaggle/python-tpuvm-build'
1917
BUILD_ARGS=''
@@ -49,15 +47,11 @@ for l in `cat ${SRCDIR}/config.txt`; do
4947
done
5048

5149
readonly CACHE_FLAG
52-
readonly TENSORFLOW_DOCKERFILE
53-
readonly TENSORFLOW_IMAGE_TAG
5450
readonly DOCKERFILE
5551
readonly IMAGE_TAG
5652
readonly BUILD_ARGS
5753

58-
TENSORFLOW_DOCKERFILE_PATH="$SRCDIR/$TENSORFLOW_DOCKERFILE"
5954
DOCKERFILE_PATH="$SRCDIR/$DOCKERFILE"
6055

6156
set -x
62-
docker build --rm --pull $CACHE_FLAG -t "$TENSORFLOW_IMAGE_TAG" -f "$TENSORFLOW_DOCKERFILE_PATH" $BUILD_ARGS .
6357
docker build --rm --pull $CACHE_FLAG -t "$IMAGE_TAG" -f "$DOCKERFILE_PATH" $BUILD_ARGS .

tpu/config.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
BASE_IMAGE_TAG=v108
22
LIBTPU_IMAGE_TAG=libtpu_1.1.0_RC00
3-
TENSORFLOW_WHL_IMAGE_TAG=local
3+
TENSORFLOW_VERSION=2.8.0

0 commit comments

Comments
 (0)