Search code examples
google-cloud-platformgoogle-compute-enginetensorboard

Viewing tensorboard output from scrip that is running in GCE


I have a piece of python code running in GCE that trains a simple keras model on some images. I also provided the tensorboard callback. Now I want to view the output of this tensorboard log. How do I go about this since the tensorboard log files are on GCE?

I run tensorboard -logdir logs and I get the output:

TensorBoard 1.7.0 at http://instance_1:6006 (Press CTRL+C to quit)

Putting the address into the browser didn't work and I am wondering if it would be possible to view this output.


Solution

  • My recommendation is expose the tensorboard port to the public and block the access on the firewall for only access with your IP.

    For doing that you need to create a firewall rule for the instance that allows your public IP access to the TCP port 6006. You have a guide for adding firewall rules on GCP here.

    Now execute the following command to expose the tensorboard port:

    tensorboard --logdir --host 0.0.0.0 --port 6006
    

    You can ensure that the port is exposed using $ netstat -plunt.

    Now go to http://$PUBLIC_IP_OF_instance_1:6006 .