From 7e17fdff2868df65139f5f0eb79bca40b6bbc041 Mon Sep 17 00:00:00 2001 From: Dong Lin Date: Wed, 15 Jan 2020 21:16:16 -0800 Subject: [PATCH] server_lib.create_local_server() should create TF server with job_name=localhost PiperOrigin-RevId: 289994931 Change-Id: Ica2f09beca3cbea8d36c8034e6c930fa96ed8664 --- tensorflow/python/client/session_list_devices_test.py | 5 +++-- tensorflow/python/training/server_lib.py | 2 +- tensorflow/python/training/supervisor_test.py | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/tensorflow/python/client/session_list_devices_test.py b/tensorflow/python/client/session_list_devices_test.py index dd381c689fd..602189bea9e 100644 --- a/tensorflow/python/client/session_list_devices_test.py +++ b/tensorflow/python/client/session_list_devices_test.py @@ -54,8 +54,9 @@ class SessionListDevicesTest(test_util.TensorFlowTestCase): server = server_lib.Server.create_local_server() with session.Session(server.target) as sess: devices = sess.list_devices() - self.assertTrue('/job:local/replica:0/task:0/device:CPU:0' in set( - [d.name for d in devices]), devices) + self.assertTrue( + '/job:localhost/replica:0/task:0/device:CPU:0' in set( + [d.name for d in devices]), devices) # All valid device incarnations must be non-zero. self.assertTrue(all(d.incarnation != 0 for d in devices)) diff --git a/tensorflow/python/training/server_lib.py b/tensorflow/python/training/server_lib.py index a6db7efb1e4..259a9a16c98 100644 --- a/tensorflow/python/training/server_lib.py +++ b/tensorflow/python/training/server_lib.py @@ -231,7 +231,7 @@ class Server(object): """ # Specifying port 0 means that the OS will choose a free port for the # server. - return Server({"local": ["localhost:0"]}, + return Server({"localhost": ["localhost:0"]}, protocol="grpc", config=config, start=start) diff --git a/tensorflow/python/training/supervisor_test.py b/tensorflow/python/training/supervisor_test.py index 180ddb52876..fa0f89f3aa2 100644 --- a/tensorflow/python/training/supervisor_test.py +++ b/tensorflow/python/training/supervisor_test.py @@ -555,7 +555,7 @@ class SupervisorTest(test.TestCase): def get_session(is_chief): g = ops.Graph() with g.as_default(): - with ops.device("/job:local"): + with ops.device("/job:localhost"): v = variables.VariableV1( 1, name="default_ready_for_local_init_op_v_" + str(uid)) vadd = v.assign_add(1) @@ -613,7 +613,7 @@ class SupervisorTest(test.TestCase): def get_session(is_chief): g = ops.Graph() with g.as_default(): - with ops.device("/job:local"): + with ops.device("/job:localhost"): v = variables.VariableV1( 1.0, name="ready_for_local_init_op_restore_v_" + str(uid)) vadd = v.assign_add(1)