Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ env:
matrix:
- TF_VERSION_ID=tf-nightly
- TF_VERSION_ID=tf-nightly-2.0-preview
- TF_VERSION_ID= # Do not install TensorFlow in this case

cache:
directories:
Expand Down Expand Up @@ -104,7 +105,15 @@ install:
- pip install mock==2.0.0
- pip install moto==1.3.7
- pip install yamllint==1.5.0
- pip install -I "${TF_VERSION_ID}"
- |
# Install TensorFlow if requested
if [ -n "${TF_VERSION_ID}" ]; then
pip install -I "${TF_VERSION_ID}"
else
# Requirements typically found through TensorFlow
pip install "absl-py>=0.7.0"
pip install "numpy<2.0,>=1.14.5"
fi

before_script:
# fail the build if there are Python syntax errors or undefined names
Expand All @@ -127,7 +136,14 @@ script:
# Note: bazel test implies fetch+build, but this gives us timing.
- bazel fetch //tensorboard/...
- bazel build //tensorboard/...
- bazel test //tensorboard/...
- |
# When TensorFlow is not installed, run a restricted subset of tests.
if [ -z "${TF_VERSION_ID}" ]; then
test_tag_filters=support_notf
else
test_tag_filters=
fi
- bazel test //tensorboard/... --test_tag_filters="${test_tag_filters}"
# Run manual S3 test
- bazel test //tensorboard/compat/tensorflow_stub:gfile_s3_test
- bazel run //tensorboard/pip_package:build_pip_package -- --tf-version "${TF_VERSION_ID}" --smoke
Expand Down
2 changes: 2 additions & 0 deletions tensorboard/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ py_test(
srcs = ["lib_test.py"],
srcs_version = "PY2AND3",
visibility = ["//tensorboard:internal"],
tags = ["support_notf"],
deps = [
":lib",
"@org_pythonhosted_six",
Expand Down Expand Up @@ -366,6 +367,7 @@ py_test(
srcs = ["lazy_test.py"],
srcs_version = "PY2AND3",
size = "small",
tags = ["support_notf"],
deps = [
":lazy",
"@org_pythonhosted_six",
Expand Down
1 change: 1 addition & 0 deletions tensorboard/compat/tensorflow_stub/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ py_test(
size = "small",
srcs = ["io/gfile_test.py"],
srcs_version = "PY2AND3",
tags = ["support_notf"],
deps = [
":tensorflow_stub",
],
Expand Down
64 changes: 40 additions & 24 deletions tensorboard/pip_package/build_pip_package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -125,15 +125,23 @@ smoke() {
smoke_tf="$2"
set +x
printf '\n\n%70s\n' | tr ' ' '='
echo "Smoke testing with ${smoke_python} and ${smoke_tf}..."
if [ -z "${smoke_tf}" ]; then
echo "Smoke testing with ${smoke_python} and no tensorflow..."
export TENSORBOARD_NO_TF=1
else
echo "Smoke testing with ${smoke_python} and ${smoke_tf}..."
fi
printf '\n'
set -x
command -v "${smoke_python}" >/dev/null
virtualenv -qp "${smoke_python}" "${smoke_venv}"
cd "${smoke_venv}"
. bin/activate
pip install -qU pip
pip install -qU "${smoke_tf}"

if [ -n "${smoke_tf}" ]; then
pip install -qU "${smoke_tf}"
fi
pip install -qU ../dist/*"py${py_major_version}"*.whl >/dev/null
pip freeze # Log the results of pip installation

Expand All @@ -153,32 +161,40 @@ smoke() {
python -c "
import tensorboard as tb
assert tb.__version__ == tb.version.VERSION
tb.summary.scalar_pb('test', 42)
from tensorboard.plugins.projector import visualize_embeddings
from tensorboard.plugins.beholder import Beholder, BeholderHook
tb.notebook.start # don't invoke; just check existence
"
if [ -n "${smoke_tf}" ]; then
# Only test summary scalar and beholder with TF
python -c "
import tensorboard as tb
tb.summary.scalar_pb('test', 42)
from tensorboard.plugins.beholder import Beholder, BeholderHook
"
fi

# Exhaustively test various sequences of importing tf.summary.
test_tf_summary() {
# First argument is subpath to test, e.g. '' or '.compat.v2'.
import_attr="import tensorflow as tf; a = tf${1}.summary; a.write; a.scalar"
import_as="import tensorflow${1}.summary as b; b.write; b.scalar"
import_from="from tensorflow${1} import summary as c; c.write; c.scalar"
printf '%s\n' "${import_attr}" "${import_as}" "${import_from}" | python -
printf '%s\n' "${import_attr}" "${import_from}" "${import_as}" | python -
printf '%s\n' "${import_as}" "${import_attr}" "${import_from}" | python -
printf '%s\n' "${import_as}" "${import_from}" "${import_attr}" | python -
printf '%s\n' "${import_from}" "${import_attr}" "${import_as}" | python -
printf '%s\n' "${import_from}" "${import_as}" "${import_attr}" | python -
}
test_tf_summary '.compat.v2'
is_tf_2() {
python -c "import tensorflow as tf; assert tf.__version__[:2] == '2.'" \
>/dev/null 2>&1
}
if is_tf_2 ; then
test_tf_summary ''
if [ -n "${smoke_tf}" ]; then
# Exhaustively test various sequences of importing tf.summary.
test_tf_summary() {
# First argument is subpath to test, e.g. '' or '.compat.v2'.
import_attr="import tensorflow as tf; a = tf${1}.summary; a.write; a.scalar"
import_as="import tensorflow${1}.summary as b; b.write; b.scalar"
import_from="from tensorflow${1} import summary as c; c.write; c.scalar"
printf '%s\n' "${import_attr}" "${import_as}" "${import_from}" | python -
printf '%s\n' "${import_attr}" "${import_from}" "${import_as}" | python -
printf '%s\n' "${import_as}" "${import_attr}" "${import_from}" | python -
printf '%s\n' "${import_as}" "${import_from}" "${import_attr}" | python -
printf '%s\n' "${import_from}" "${import_attr}" "${import_as}" | python -
printf '%s\n' "${import_from}" "${import_as}" "${import_attr}" | python -
}
test_tf_summary '.compat.v2'
is_tf_2() {
python -c "import tensorflow as tf; assert tf.__version__[:2] == '2.'" \
>/dev/null 2>&1
}
if is_tf_2 ; then
test_tf_summary ''
fi
fi

deactivate
Expand Down
1 change: 1 addition & 0 deletions tensorboard/summary/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ py_test(
size = "small",
srcs = ["summary_test.py"],
srcs_version = "PY2AND3",
tags = ["support_notf"],
deps = [
":summary",
":summary_v1",
Expand Down