aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/python
diff options
context:
space:
mode:
authorGravatar A. Unique TensorFlower <gardener@tensorflow.org>2018-10-08 10:28:59 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-10-08 10:39:54 -0700
commit049d98c84ca7474459175914ca49c1fa3c11581d (patch)
tree2021021f2a5f8c5274832eb064af67e0a8f44796 /tensorflow/python
parenta04cd08ee7a8c5245d76a59849e1f7e8ba8a3f52 (diff)
Wait for shared resources to initialize before initializing local resources.
shared resources are very similar to global variables functionally and they are initialized at the same time but since workers are only waiting for global variables being initialized, there is a race condition that sometimes the shared resource is not ready. PiperOrigin-RevId: 216208679
Diffstat (limited to 'tensorflow/python')
-rw-r--r--tensorflow/python/training/monitored_session.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/tensorflow/python/training/monitored_session.py b/tensorflow/python/training/monitored_session.py
index 82f0e3be52..a479f38165 100644
--- a/tensorflow/python/training/monitored_session.py
+++ b/tensorflow/python/training/monitored_session.py
@@ -195,8 +195,12 @@ class Scaffold(object):
default_ready_op)
if self._ready_for_local_init_op is None:
def default_ready_for_local_init_op():
- return variables.report_uninitialized_variables(
- variables.global_variables())
+ return array_ops.concat([
+ variables.report_uninitialized_variables(
+ variables.global_variables()),
+ resources.report_uninitialized_resources(
+ resources.shared_resources())
+ ], 0)
self._ready_for_local_init_op = Scaffold.get_or_default(
'ready_for_local_init_op', ops.GraphKeys.READY_FOR_LOCAL_INIT_OP,
default_ready_for_local_init_op)