mirror of
https://github.com/zebrajr/tensorflow.git
synced 2026-01-15 12:15:41 +00:00
Move the tf whl size check to common.
PiperOrigin-RevId: 368522387 Change-Id: I710dcc27d665f488b7887023ed6a7a4a249e5a27
This commit is contained in:
committed by
TensorFlower Gardener
parent
8fe9603850
commit
82f83aae97
@@ -18,13 +18,8 @@
|
||||
set -e
|
||||
set -x
|
||||
|
||||
# CPU size
|
||||
MAC_CPU_MAX_WHL_SIZE=190M
|
||||
LINUX_CPU_MAX_WHL_SIZE=170M
|
||||
WIN_CPU_MAX_WHL_SIZE=113M
|
||||
# GPU size
|
||||
LINUX_GPU_MAX_WHL_SIZE=435M
|
||||
WIN_GPU_MAX_WHL_SIZE=252M
|
||||
# Get size check function
|
||||
source tensorflow/tools/ci_build/release/common.sh
|
||||
|
||||
function run_smoke_test() {
|
||||
|
||||
@@ -55,7 +50,7 @@ function run_smoke_test() {
|
||||
test_tf_imports
|
||||
|
||||
# Test TensorFlow whl file size
|
||||
test_tf_whl_size
|
||||
test_tf_whl_size ${WHL_NAME}
|
||||
|
||||
RESULT=$?
|
||||
|
||||
@@ -103,48 +98,6 @@ function test_tf_imports() {
|
||||
return $RESULT
|
||||
}
|
||||
|
||||
function test_tf_whl_size() {
|
||||
# First, list all wheels with their sizes:
|
||||
echo "Found these wheels: "
|
||||
find $WHL_NAME -type f -exec ls -lh {} \;
|
||||
echo "===================="
|
||||
# Check CPU whl size.
|
||||
if [[ "$WHL_NAME" == *"_cpu"* ]]; then
|
||||
# Check MAC CPU whl size.
|
||||
if [[ "$WHL_NAME" == *"-macos"* ]] && [[ $(find $WHL_NAME -type f -size +${MAC_CPU_MAX_WHL_SIZE}) ]]; then
|
||||
echo "Mac CPU whl size has exceeded ${MAC_CPU_MAX_WHL_SIZE}. To keep
|
||||
within pypi's CDN distribution limit, we must not exceed that threshold."
|
||||
return 1
|
||||
fi
|
||||
# Check Linux CPU whl size.
|
||||
if [[ "$WHL_NAME" == *"-manylinux"* ]] && [[ $(find $WHL_NAME -type f -size +${LINUX_CPU_MAX_WHL_SIZE}) ]]; then
|
||||
echo "Linux CPU whl size has exceeded ${LINUX_CPU_MAX_WHL_SIZE}. To keep
|
||||
within pypi's CDN distribution limit, we must not exceed that threshold."
|
||||
return 1
|
||||
fi
|
||||
# Check Windows CPU whl size.
|
||||
if [[ "$WHL_NAME" == *"-win"* ]] && [[ $(find $WHL_NAME -type f -size +${WIN_CPU_MAX_WHL_SIZE}) ]]; then
|
||||
echo "Windows CPU whl size has exceeded ${WIN_CPU_MAX_WHL_SIZE}. To keep
|
||||
within pypi's CDN distribution limit, we must not exceed that threshold."
|
||||
return 1
|
||||
fi
|
||||
# Check GPU whl size
|
||||
elif [[ "$WHL_NAME" == *"_gpu"* ]]; then
|
||||
# Check Linux GPU whl size.
|
||||
if [[ "$WHL_NAME" == *"-manylinux"* ]] && [[ $(find $WHL_NAME -type f -size +${LINUX_GPU_MAX_WHL_SIZE}) ]]; then
|
||||
echo "Linux GPU whl size has exceeded ${LINUX_GPU_MAX_WHL_SIZE}. To keep
|
||||
within pypi's CDN distribution limit, we must not exceed that threshold."
|
||||
return 1
|
||||
fi
|
||||
# Check Windows GPU whl size.
|
||||
if [[ "$WHL_NAME" == *"-win"* ]] && [[ $(find $WHL_NAME -type f -size +${WIN_GPU_MAX_WHL_SIZE}) ]]; then
|
||||
echo "Windows GPU whl size has exceeded ${WIN_GPU_MAX_WHL_SIZE}. To keep
|
||||
within pypi's CDN distribution limit, we must not exceed that threshold."
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
###########################################################################
|
||||
# Main
|
||||
###########################################################################
|
||||
|
||||
@@ -35,7 +35,19 @@ for f in $(ls "${KOKORO_GFILE_DIR}"/tf_nightly_gpu*dev*cp3*-cp3*-win_amd64.whl);
|
||||
copy_to_new_project_name "${f}" tf_nightly python
|
||||
done
|
||||
|
||||
OVERALL_RETVAL=0
|
||||
# Upload the built packages to pypi.
|
||||
for f in $(ls "${KOKORO_GFILE_DIR}"/tf_nightly*dev*cp3*-cp3*-win_amd64.whl); do
|
||||
python -m twine upload -r pypi-warehouse "$f" || echo
|
||||
test_tf_whl_size $f
|
||||
RETVAL=$?
|
||||
|
||||
# Upload the PIP package if whl test passes.
|
||||
if [ ${RETVAL} -eq 0 ]; then
|
||||
python -m twine upload -r pypi-warehouse "$f"
|
||||
else
|
||||
echo "Unable to upload package $f. Size check failed."
|
||||
OVERALL_RETVAL=1
|
||||
fi
|
||||
done
|
||||
|
||||
exit $OVERALL_RETVAL
|
||||
|
||||
@@ -434,3 +434,55 @@ function test_xml_summary_exit {
|
||||
test_xml_summary
|
||||
exit "${RETVAL}"
|
||||
}
|
||||
|
||||
# CPU size
|
||||
MAC_CPU_MAX_WHL_SIZE=190M
|
||||
LINUX_CPU_MAX_WHL_SIZE=170M
|
||||
WIN_CPU_MAX_WHL_SIZE=113M
|
||||
# GPU size
|
||||
LINUX_GPU_MAX_WHL_SIZE=435M
|
||||
WIN_GPU_MAX_WHL_SIZE=252M
|
||||
|
||||
function test_tf_whl_size() {
|
||||
WHL_PATH=${1}
|
||||
# First, list all wheels with their sizes:
|
||||
echo "Found these wheels: "
|
||||
find $WHL_PATH -type f -exec ls -lh {} \;
|
||||
echo "===================="
|
||||
# Check CPU whl size.
|
||||
if [[ "$WHL_PATH" == *"_cpu"* ]]; then
|
||||
# Check MAC CPU whl size.
|
||||
if [[ "$WHL_PATH" == *"-macos"* ]] && [[ $(find $WHL_PATH -type f -size +${MAC_CPU_MAX_WHL_SIZE}) ]]; then
|
||||
echo "Mac CPU whl size has exceeded ${MAC_CPU_MAX_WHL_SIZE}. To keep
|
||||
within pypi's CDN distribution limit, we must not exceed that threshold."
|
||||
return 1
|
||||
fi
|
||||
# Check Linux CPU whl size.
|
||||
if [[ "$WHL_PATH" == *"-manylinux"* ]] && [[ $(find $WHL_PATH -type f -size +${LINUX_CPU_MAX_WHL_SIZE}) ]]; then
|
||||
echo "Linux CPU whl size has exceeded ${LINUX_CPU_MAX_WHL_SIZE}. To keep
|
||||
within pypi's CDN distribution limit, we must not exceed that threshold."
|
||||
return 1
|
||||
fi
|
||||
# Check Windows CPU whl size.
|
||||
if [[ "$WHL_PATH" == *"-win"* ]] && [[ $(find $WHL_PATH -type f -size +${WIN_CPU_MAX_WHL_SIZE}) ]]; then
|
||||
echo "Windows CPU whl size has exceeded ${WIN_CPU_MAX_WHL_SIZE}. To keep
|
||||
within pypi's CDN distribution limit, we must not exceed that threshold."
|
||||
return 1
|
||||
fi
|
||||
# Check GPU whl size
|
||||
elif [[ "$WHL_PATH" == *"_gpu"* ]]; then
|
||||
# Check Linux GPU whl size.
|
||||
if [[ "$WHL_PATH" == *"-manylinux"* ]] && [[ $(find $WHL_PATH -type f -size +${LINUX_GPU_MAX_WHL_SIZE}) ]]; then
|
||||
echo "Linux GPU whl size has exceeded ${LINUX_GPU_MAX_WHL_SIZE}. To keep
|
||||
within pypi's CDN distribution limit, we must not exceed that threshold."
|
||||
return 1
|
||||
fi
|
||||
# Check Windows GPU whl size.
|
||||
if [[ "$WHL_PATH" == *"-win"* ]] && [[ $(find $WHL_PATH -type f -size +${WIN_GPU_MAX_WHL_SIZE}) ]]; then
|
||||
echo "Windows GPU whl size has exceeded ${WIN_GPU_MAX_WHL_SIZE}. To keep
|
||||
within pypi's CDN distribution limit, we must not exceed that threshold."
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
@@ -155,10 +155,6 @@ create_python_test_dir "${PY_TEST_DIR}"
|
||||
./bazel-bin/tensorflow/tools/pip_package/build_pip_package "$PWD/${PY_TEST_DIR}" ${EXTRA_PIP_FLAGS}
|
||||
|
||||
if [[ "$TF_NIGHTLY" == 1 ]]; then
|
||||
WHL_PATH=$(ls ${PY_TEST_DIR}/tf_nightly*.whl)
|
||||
# Test the whl pip package.
|
||||
chmod +x tensorflow/tools/ci_build/builds/nightly_release_smoke_test.sh
|
||||
./tensorflow/tools/ci_build/builds/nightly_release_smoke_test.sh ${WHL_PATH}
|
||||
exit 0
|
||||
fi
|
||||
|
||||
|
||||
@@ -153,10 +153,6 @@ create_python_test_dir "${PY_TEST_DIR}"
|
||||
--gpu ${EXTRA_PIP_FLAGS}
|
||||
|
||||
if [[ "$TF_NIGHTLY" == 1 ]]; then
|
||||
WHL_PATH=$(ls ${PY_TEST_DIR}/tf_nightly*.whl)
|
||||
# Test the whl pip package.
|
||||
chmod +x tensorflow/tools/ci_build/builds/nightly_release_smoke_test.sh
|
||||
./tensorflow/tools/ci_build/builds/nightly_release_smoke_test.sh ${WHL_PATH}
|
||||
exit 0
|
||||
fi
|
||||
|
||||
|
||||
Reference in New Issue
Block a user