tensorboard icon indicating copy to clipboard operation
tensorboard copied to clipboard

TensorBoard doesn't load new data when summaries are stored in GCS.

Open mrfortynine opened this issue 8 years ago • 32 comments

I have been storing summaries in GCS bucket, and running TensorBoard on a Compute Engine instance. This set up worked fairly well. Coming back from holiday break, I noticed that TensorBoard no longer reload new summary events. The only way for me to see new data is to restart TensorBoard process.

mrfortynine avatar Jan 10 '18 23:01 mrfortynine

Do you happen to have the TensorBoard logs stored anywhere? And is the problem reproducible or did it just happen this once after waiting a long time?

nfelt avatar Jan 10 '18 23:01 nfelt

I have been experiencing this for the last two hours and it's still on going . Where can I get TensorBoard log?

mrfortynine avatar Jan 10 '18 23:01 mrfortynine

TensorBoard should log to standard out by default, so if you started it manually on Compute Engine it would just be logging to the console. If it's more customized it might be logging to /var/log or somewhere else, but I couldn't say for sure without knowing more about your specific setup.

How big is your logdir - is it fairly large? Sometimes very large or deeply nested logdirs can take so long to scan through that TensorBoard essentially appears to be frozen after it loads data for the first time.

nfelt avatar Jan 10 '18 23:01 nfelt

The logdir is not large at all. The deepest level is two. I have no more than 200 files in total since I just started the training. The event file is about 80MB at this moment.

I used default TensorBoard installation on Compute Engine, nothing customized. I don't see any interesting logs other than this in console:

jia_pu@jia-tensorboard:~$ tensorboard --logdir gs://cruise-jia/ssd_training_samples_large
TensorBoard 0.4.0rc3 at http://jia-tensorboard:6006 (Press CTRL+C to quit)

And this is all I have in /var/log:

jia_pu@jia-tensorboard:~$ ls -l /var/log/
total 1576
-rw-r--r-- 1 root      root      0 Jan  1 06:46 alternatives.log
-rw-r--r-- 1 root      root   3134 Dec 19 21:54 alternatives.log.1
-rw-r----- 1 root      adm       0 Dec 25 06:42 apport.log
-rw-r----- 1 root      adm     393 Dec 25 04:28 apport.log.1
drwxr-xr-x 2 root      root   4096 Jan  1 06:46 apt
-rw-r----- 1 syslog    adm  149791 Jan 10 23:39 auth.log
-rw-r----- 1 syslog    adm  249024 Jan  7 06:47 auth.log.1
-rw-r----- 1 syslog    adm   25961 Dec 31 06:47 auth.log.2.gz
-rw-r----- 1 syslog    adm   19091 Dec 24 06:25 auth.log.3.gz
-rw-r--r-- 1 root      root  58424 Dec 19 21:46 boot.log
-rw-rw---- 1 root      utmp 263808 Jan 10 23:39 btmp
-rw-rw---- 1 root      utmp 273024 Jan  1 06:34 btmp.1
-rw-r--r-- 1 syslog    adm  122970 Dec 19 21:46 cloud-init.log
-rw-r--r-- 1 root      root   3833 Dec 19 21:46 cloud-init-output.log
drwxr-xr-x 2 root      root   4096 Nov 30  2016 dist-upgrade
-rw-r--r-- 1 root      adm   28531 Dec 19 21:46 dmesg
-rw-r--r-- 1 root      root      0 Dec 19 21:46 dmesg.0
-rw-r--r-- 1 root      root   3477 Jan 10 06:37 dpkg.log
-rw-r--r-- 1 root      root  65475 Dec 20 06:30 dpkg.log.1
drwxr-xr-x 2 root      root   4096 Dec  8 17:57 fsck
-rw-r----- 1 syslog    adm       0 Dec 31 06:49 kern.log
-rw-r----- 1 syslog    adm   14192 Dec 25 04:28 kern.log.1
-rw-r----- 1 syslog    adm    9926 Dec 20 06:29 kern.log.2.gz
drwxr-xr-x 2 landscape root   4096 Dec 19 21:46 landscape
-rw-rw-r-- 1 root      utmp 292584 Jan 10 21:30 lastlog
drwxr-xr-x 2 ntp       ntp    4096 Jul 12 12:23 ntpstats
-rw-r----- 1 syslog    adm    2141 Jan 10 23:17 syslog
-rw-r----- 1 syslog    adm    3307 Jan 10 06:25 syslog.1
-rw-r----- 1 syslog    adm     517 Jan  9 06:25 syslog.2.gz
-rw-r----- 1 syslog    adm     490 Jan  8 06:25 syslog.3.gz
-rw-r----- 1 syslog    adm     531 Jan  7 06:47 syslog.4.gz
-rw-r----- 1 syslog    adm     490 Jan  6 06:25 syslog.5.gz
-rw-r----- 1 syslog    adm     479 Jan  5 06:25 syslog.6.gz
-rw-r----- 1 syslog    adm     497 Jan  4 06:25 syslog.7.gz
-rw-r--r-- 1 root      root 179834 Dec 19 21:46 udev
drwxr-xr-x 2 root      root   4096 Jan 10 06:35 unattended-upgrades
drwxr-xr-x 2 root      root   4096 Dec 21 06:44 upstart
-rw-rw-r-- 1 root      utmp   4992 Jan 10 21:30 wtmp
-rw-rw-r-- 1 root      utmp  13440 Dec 21 06:34 wtmp.1

mrfortynine avatar Jan 11 '18 00:01 mrfortynine

Also, I should mention that this happens even when I run tensorboard on my local machine.

mrfortynine avatar Jan 11 '18 00:01 mrfortynine

When TensorBoard reads individual event log files, it polls the end of the file in case records get appended. That behavior isn't possible on GCS since objects are sort of immutable and atomic.

Out of curiosity, when you store the newer summaries, do you put them in a second event log file, with a higher timestamp?

jart avatar Jan 11 '18 00:01 jart

Here is the code I use to write summaries. Does this answer your question? It seems a new event file gets created only when current event file has grown to a certain size. Maybe tensorboard only updates when the second event file is created. However, my impression is that tensorboard updates much more frequently than what I'm seeing right now back in December last year.

mrfortynine avatar Jan 11 '18 00:01 mrfortynine

I think the multiple events files are due to restarting training. Assuming that’s the case, I’m fairly certain that I have seen tensorboard correctly reloading new data from a single event file stored on GCS as recent as December last year.

mrfortynine avatar Jan 11 '18 15:01 mrfortynine

Are you training with multiple threads/processes? If so, could you ensure that only 1 thread is writing summaries to disk? Specifically, ensure that only 1 thread has is_chief set to true here? https://github.com/tensorflow/models/blob/master/research/object_detection/trainer.py#L323

Also, that the master argument is correct?

TensorBoard fails to pick up new summaries if multiple FileWriters concurrently write to disk.

chihuahua avatar Jan 12 '18 01:01 chihuahua

I can take a closer look at the the script. The object detection project comes with samples that write events to GCS. I'm just using their scripts. However I want to emphasize that this "used to work" as recent as last month. I haven't changed anything in training script. Is it possible that something in GCS has changed that causes this?

mrfortynine avatar Jan 12 '18 01:01 mrfortynine

Hmm, you noted that this happens even when running tensorboard on a local machine, right? Furthermore, when you restart TensorBoard, you do see the most recent events reflected, right? To me, that seems to hint at a problem on the data-reading side.

chihuahua avatar Jan 12 '18 01:01 chihuahua

Yes to both of you questions. By "data-reading" side, do you mean tensorboard or even GCS SDK?

mrfortynine avatar Jan 12 '18 01:01 mrfortynine

Oh ... maybe. By data-reading, I mean TensorBoard logic that reads data from disk to render in the web app. GCS logic seems related, but it seems less of a culprit if we can restart TensorBoard and see updated data. That means we can successfully read from GCS.

chihuahua avatar Jan 12 '18 01:01 chihuahua

The default TensorBoard version on Compute Engine hasn't changed between December and January this year, right?

mrfortynine avatar Jan 12 '18 01:01 mrfortynine

Could you please note how you are running the scripts? Which shell commands? Are several commands running at once?

chihuahua avatar Jan 12 '18 01:01 chihuahua

True. The bug in which TensorBoard does not pick up data from multiple event writers has existed for a long time though.

chihuahua avatar Jan 12 '18 01:01 chihuahua

I will post the exact command line shortly. Here's the job description ML engine sees. I'm pretty certain that I only submitted the job once.

Training input	
{
  "scaleTier": "CUSTOM",
  "masterType": "complex_model_l_gpu",
  "workerType": "complex_model_l_gpu",
  "parameterServerType": "standard",
  "workerCount": "5",
  "parameterServerCount": "3",
  "packageUris": [
    "gs://cruise-jia/ssd_training_samples_large/train/packages/4f140252d755df5e9f1cc89580e41425745409ceff2fbf951b80c07eb74aeaf5/object_detection-0.1.tar.gz",
    "gs://cruise-jia/ssd_training_samples_large/train/packages/4f140252d755df5e9f1cc89580e41425745409ceff2fbf951b80c07eb74aeaf5/slim-0.1.tar.gz"
  ],
  "pythonModule": "object_detection.train",
  "args": [
    "--train_dir",
    "gs://cruise-jia/ssd_training_samples_large/train",
    "--pipeline_config_path",
    "gs://cruise-jia/ssd_training_samples_large/cloud.config"
  ],
  "region": "us-central1",
  "runtimeVersion": "1.2",
  "jobDir": "gs://cruise-jia/ssd_training_samples_large/train"
}

mrfortynine avatar Jan 12 '18 01:01 mrfortynine

Thank you. One thing that I'm trying to figure out is where this train method is called. https://github.com/tensorflow/models/blob/master/research/object_detection/trainer.py#L172

Could we try something? At this call to train: https://github.com/tensorflow/models/blob/master/research/object_detection/trainer.py#L319

Could we pass it a summary_writer parameter? Its value would be:

if is_chief:
  summary_writer = tf.summary.FileWriter(train_dir, graph=tf.get_default_graph())
else:
  summary_writer = None

chihuahua avatar Jan 12 '18 01:01 chihuahua

Thank you for looking into this. I will try it out. It may take me a couple of days as I will be traveling. Will report back.

mrfortynine avatar Jan 12 '18 02:01 mrfortynine

Oh it's possible you might have accidentally installed tensorflow on pypi rather than tensorflow-tensorboard. It's a problem we're going to be solving soon. Try just pip install tb-nightly.

jart avatar Jan 16 '18 11:01 jart