@cliffwoolley
Latest commit d6a9bcf Aug 2, 2019 History
Fixes #1956 to allow the combination of Jupyter+TensorBoard to work when
the TensorBoard backend is running somewhere other than the user’s local
machine.

Rather than `localhost` being hardcoded, we use a short JavaScript
snippet in the IFrame source to have the client determine for itself the
hostname that should be contacted. This allows the solution also to work
from inside a container, where we might not know the host’s
outward-facing IP address.

Test Plan:
Install Docker and `nvidia-docker`, then run

```sh
tmpdir="$(mktemp -d)" \
&& bazel run //tensorboard/pip_package:extract_pip_package "${tmpdir}" \
&& nvidia-docker run -it --rm -v "${tmpdir}":/tensorboard \
    -p 8888:8888 -p 6006:6006 nvcr.io/nvidia/tensorflow:19.03-py3
```

to get a Docker shell. Inside the container, run

```sh
pip install -qU /tensorboard/*py3* \
&& jupyter notebook --allow-root --ip 0.0.0.0
```

and navigate to the provided notebook URL via a hostname other than
`localhost` (e.g., your machine’s `hostname`). Create a new IPython
notebook and execute the cell

```
%load_ext tensorboard
%tensorboard --logdir /tmp/whatever
```

and verify that the output contains a working TensorBoard iframe whose
`src` attribute is under the main frame’s origin (e.g., your machine’s
`hostname`), not `localhost`.

Signed-off-by: Cliff Woolley <jwoolley@nvidia.com>
Signed-off-by: William Chargin <wchargin@google.com>
2 contributors

Users who have contributed to this file

@wchargin @cliffwoolley