Skip to content

Commit 634f93a

Browse files
nfeltjart
authored andcommitted
Disable tf.gfile's GCS filesystem caching
1 parent ee28b80 commit 634f93a

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

tensorboard/backend/event_processing/event_file_loader.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ def Load(self):
5757
# GetNext() expects a status argument on TF <= 1.7
5858
with tf.errors.raise_exception_on_not_ok_status() as status:
5959
self._reader.GetNext(status)
60-
except (tf.errors.DataLossError, tf.errors.OutOfRangeError):
60+
except (tf.errors.DataLossError, tf.errors.OutOfRangeError) as e:
61+
tf.logging.debug('Cannot read more events: %s', e)
6162
# We ignore partial read exceptions, because a record may be truncated.
6263
# PyRecordReader holds the offset prior to the failed read, so retrying
6364
# will succeed.

tensorboard/main.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,18 @@
2525
from __future__ import division
2626
from __future__ import print_function
2727

28+
# pylint: disable=g-import-not-at-top
29+
# Disable the TF GCS filesystem cache which interacts pathologically with the
30+
# pattern of reads used by TensorBoard for logdirs. See for details:
31+
# https://github.com/tensorflow/tensorboard/issues/1225
32+
# This must be set before the first import of tensorflow.
33+
import os
34+
os.environ['GCS_READ_CACHE_DISABLED'] = '1'
35+
2836
import tensorflow as tf
2937

38+
# pylint: enable=g-import-not-at-top
39+
3040
from tensorboard import default
3141
from tensorboard import program
3242

0 commit comments

Comments
 (0)